[svn-commits] seanbright: trunk r204749 - in /trunk: ./ channels/ configs/ funcs/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 2 12:46:19 CDT 2009


Author: seanbright
Date: Thu Jul  2 12:46:14 2009
New Revision: 204749

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=204749
Log:
Support setting and receiving Reverse Charging Indication over ISDN PRI.

This is a continuation of revision 885 to LibPRI (Capture and expose the Reverse
Charging Indication IE on ISDN PRI) which added the ability to get/set Reverse
Charging Indication in LibPRI.  This patch adds the ability to specify RCI on
the outbound leg of a PRI call from within Asterisk, by prefixing the dialed
number with a capital 'C' like:

...,Dial(DAHDI/g1/C4445556666)

And to read it off an inbound channel:

exten => s,1,Set(RCI=${CHANNEL(reversecharge)})

Thanks again to rmudgett for the thorough review.

(closes issue #13760)
Reported by: mrgabu

Review: https://reviewboard.asterisk.org/r/303/

Modified:
    trunk/CHANGES
    trunk/channels/chan_dahdi.c
    trunk/channels/sig_pri.c
    trunk/channels/sig_pri.h
    trunk/configs/chan_dahdi.conf.sample
    trunk/funcs/func_channel.c

Modified: trunk/CHANGES
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/CHANGES?view=diff&rev=204749&r1=204748&r2=204749
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Thu Jul  2 12:46:14 2009
@@ -46,6 +46,11 @@
 -----------
  * Added rtsavesysname option into iax.conf to allow the systname to be saved
    on realtime updates.
+
+DAHDI Changes
+-------------
+ * Added Reverse Charging Indication receipt & transmission (requires latest
+   LibPRI).
 
 Applications
 ------------

Modified: trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=204749&r1=204748&r2=204749
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Thu Jul  2 12:46:14 2009
@@ -5403,7 +5403,7 @@
 {
 	struct dahdi_pvt *p = chan->tech_pvt;
 	int res = 0;
-	
+
 	if (!strcasecmp(data, "rxgain")) {
 		ast_mutex_lock(&p->lock);
 		snprintf(buf, len, "%f", p->rxgain);
@@ -5412,8 +5412,19 @@
 		ast_mutex_lock(&p->lock);
 		snprintf(buf, len, "%f", p->txgain);
 		ast_mutex_unlock(&p->lock);
+#ifdef HAVE_PRI
+	} else if (!strcasecmp(data, "reversecharge")) {
+		ast_mutex_lock(&p->lock);
+		if (p->sig == SIG_PRI || p->sig == SIG_BRI || p->sig == SIG_BRI_PTMP) {
+			snprintf(buf, len, "%d", ((struct sig_pri_chan *) p->sig_pvt)->reverse_charging_indication);
+		} else {
+			*buf = '\0';
+			res = -1;
+		}
+		ast_mutex_unlock(&p->lock);
+#endif
 	} else {
-		ast_copy_string(buf, "", len);
+		*buf = '\0';
 		res = -1;
 	}
 

Modified: trunk/channels/sig_pri.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_pri.c?view=diff&rev=204749&r1=204748&r2=204749
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Thu Jul  2 12:46:14 2009
@@ -1163,7 +1163,8 @@
 							pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
 							if (e->ring.redirectingreason >= 0)
 								pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
-						
+							pri->pvts[chanpos]->reverse_charging_indication = e->ring.reversecharge;
+
 							sig_pri_lock_private(pri->pvts[chanpos]);
 							ast_mutex_lock(&pri->lock);
 
@@ -1208,7 +1209,8 @@
 
 								if (e->ring.redirectingreason >= 0)
 									pbx_builtin_setvar_helper(c, "PRIREDIRECTREASON", redirectingreason2str(e->ring.redirectingreason));
-							
+								pri->pvts[chanpos]->reverse_charging_indication = e->ring.reversecharge;
+
 								snprintf(calledtonstr, sizeof(calledtonstr)-1, "%d", e->ring.calledplan);
 								pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
 
@@ -1888,6 +1890,11 @@
 		case 'r':
 			pridialplan = PRI_NPI_RESERVED | (pridialplan & 0xf0);
 			break;
+#if defined(PRI_REVERSECHARGE_REQUESTED)
+		case 'C':
+			pri_sr_set_reversecharge(sr, PRI_REVERSECHARGE_REQUESTED);
+			break;
+#endif
 		default:
 			if (isalpha(c[p->stripmsd])) {
 				ast_log(LOG_WARNING, "Unrecognized pridialplan %s modifier: %c\n",

Modified: trunk/channels/sig_pri.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_pri.h?view=diff&rev=204749&r1=204748&r2=204749
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Thu Jul  2 12:46:14 2009
@@ -162,6 +162,7 @@
 	struct sig_pri_callback *calls;
 	void *chan_pvt;
 	ast_mutex_t service_lock;						/*!< Mutex for service messages */
+	int reverse_charging_indication;
 };
 
 struct sig_pri_pri {

Modified: trunk/configs/chan_dahdi.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/configs/chan_dahdi.conf.sample?view=diff&rev=204749&r1=204748&r2=204749
==============================================================================
--- trunk/configs/chan_dahdi.conf.sample (original)
+++ trunk/configs/chan_dahdi.conf.sample Thu Jul  2 12:46:14 2009
@@ -76,6 +76,11 @@
 ;
 ;service_message_support=yes
 ; Enable service message support for channel. Must be set after switchtype.
+;
+; PRI Reverse Charging Indication: Indicate to the called party that the
+; call will be reverse charged.  To enable, prefix the dialed number with one
+; of the following letters:
+; C - Reverse Charge Indication Requested
 ;
 ; PRI Dialplan: The ISDN-level Type Of Number (TON) or numbering plan, used for
 ; the dialed number.  For most installations, leaving this as 'unknown' (the

Modified: trunk/funcs/func_channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/funcs/func_channel.c?view=diff&rev=204749&r1=204748&r2=204749
==============================================================================
--- trunk/funcs/func_channel.c (original)
+++ trunk/funcs/func_channel.c Thu Jul  2 12:46:14 2009
@@ -205,6 +205,16 @@
 						<para>R/O Get the peer's username.</para>
 					</enum>
 				</enumlist>
+				<para><emphasis>chan_dahdi</emphasis> provides the following additional options:</para>
+				<enumlist>
+					<enum name="reversecharge">
+						<para>R/O Reverse Charging Indication, one of:</para>
+						<enumlist>
+							<enum name="-1 - None" />
+							<enum name="1 - Reverse Charging Requested" />
+						</enumlist>
+					</enum>
+				</enumlist>
 			</parameter>
 		</syntax>
 		<description>




More information about the svn-commits mailing list