[asterisk-commits] rmudgett: branch rmudgett/dahdi_facility r224033 - in /team/rmudgett/dahdi_fa...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 14 11:00:11 CDT 2009


Author: rmudgett
Date: Wed Oct 14 11:00:06 2009
New Revision: 224033

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=224033
Log:
Added ability to send/receive keypad digits in the SETUP message.

Send keypad digits in SETUP message: Dial(DAHDI/g1[/K<keypad_digits>][/extension])
Access any received keypad digits in SETUP message by: ${CHANNEL(keypad_digits)}

Merge changes in team/rmudgett/dahdi_deflection branch up to -r224032

Modified:
    team/rmudgett/dahdi_facility/CHANGES
    team/rmudgett/dahdi_facility/channels/chan_dahdi.c
    team/rmudgett/dahdi_facility/channels/sig_pri.c
    team/rmudgett/dahdi_facility/channels/sig_pri.h
    team/rmudgett/dahdi_facility/configure.ac

Modified: team/rmudgett/dahdi_facility/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/CHANGES?view=diff&rev=224033&r1=224032&r2=224033
==============================================================================
--- team/rmudgett/dahdi_facility/CHANGES (original)
+++ team/rmudgett/dahdi_facility/CHANGES Wed Oct 14 11:00:06 2009
@@ -18,6 +18,13 @@
  * Added support for BRI PTMP NT mode. (Requires latest LibPRI.)
  * Added handling of received HOLD/RETRIEVE messages and the optional ability
    to transfer a held call on disconnect similar to an analog phone.
+ * Added CallRerouting/CallDeflection support for Q.SIG, ETSI PTP, ETSI PTMP.
+   Will reroute/deflect an outgoing call when receive the message.
+   Can use the DAHDISendCallreroutingFacility to send the message for the
+   supported switches.
+ * Added ability to send/receive keypad digits in the SETUP message.
+   Send keypad digits in SETUP message: Dial(DAHDI/g1[/K<keypad_digits>][/extension])
+   Access any received keypad digits in SETUP message by: ${CHANNEL(keypad_digits)}
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.2 to Asterisk 1.6.3  -------------

Modified: team/rmudgett/dahdi_facility/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/channels/chan_dahdi.c?view=diff&rev=224033&r1=224032&r2=224033
==============================================================================
--- team/rmudgett/dahdi_facility/channels/chan_dahdi.c (original)
+++ team/rmudgett/dahdi_facility/channels/chan_dahdi.c Wed Oct 14 11:00:06 2009
@@ -6073,6 +6073,7 @@
 		ast_mutex_lock(&p->lock);
 		snprintf(buf, len, "%f", p->txgain);
 		ast_mutex_unlock(&p->lock);
+#if defined(HAVE_PRI)
 #if defined(HAVE_PRI_REVERSE_CHARGE)
 	} else if (!strcasecmp(data, "reversecharge")) {
 		ast_mutex_lock(&p->lock);
@@ -6087,6 +6088,22 @@
 		}
 		ast_mutex_unlock(&p->lock);
 #endif
+#if defined(HAVE_PRI_SETUP_KEYPAD)
+	} else if (!strcasecmp(data, "keypad_digits")) {
+		ast_mutex_lock(&p->lock);
+		switch (p->sig) {
+		case SIG_PRI_LIB_HANDLE_CASES:
+			ast_copy_string(buf, ((struct sig_pri_chan *) p->sig_pvt)->keypad_digits,
+				len);
+			break;
+		default:
+			*buf = '\0';
+			res = -1;
+			break;
+		}
+		ast_mutex_unlock(&p->lock);
+#endif	/* defined(HAVE_PRI_SETUP_KEYPAD) */
+#endif	/* defined(HAVE_PRI) */
 	} else {
 		*buf = '\0';
 		res = -1;

Modified: team/rmudgett/dahdi_facility/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/channels/sig_pri.c?view=diff&rev=224033&r1=224032&r2=224033
==============================================================================
--- team/rmudgett/dahdi_facility/channels/sig_pri.c (original)
+++ team/rmudgett/dahdi_facility/channels/sig_pri.c Wed Oct 14 11:00:06 2009
@@ -780,6 +780,14 @@
 		old_chan->setup_ack = 0;
 		old_chan->outgoing = 0;
 		old_chan->digital = 0;
+
+		/* More stuff to transfer to the new channel. */
+#if defined(HAVE_PRI_REVERSE_CHARGE)
+		new_chan->reverse_charging_indication = old_chan->reverse_charging_indication;
+#endif	/* defined(HAVE_PRI_REVERSE_CHARGE) */
+#if defined(HAVE_PRI_SETUP_KEYPAD)
+		strcpy(new_chan->keypad_digits, old_chan->keypad_digits);
+#endif	/* defined(HAVE_PRI_SETUP_KEYPAD) */
 
 		if (new_chan->no_b_channel) {
 			/* Copy the real channel configuration to the no B channel interface. */
@@ -2252,6 +2260,11 @@
 #if defined(HAVE_PRI_REVERSE_CHARGE)
 								pri->pvts[chanpos]->reverse_charging_indication = e->ring.reversecharge;
 #endif
+#if defined(HAVE_PRI_SETUP_KEYPAD)
+								ast_copy_string(pri->pvts[chanpos]->keypad_digits,
+									e->ring.keypad_digits,
+									sizeof(pri->pvts[chanpos]->keypad_digits));
+#endif	/* defined(HAVE_PRI_SETUP_KEYPAD) */
 
 								sig_pri_handle_subcmds(pri, chanpos, e->e, e->ring.channel,
 									e->ring.subcmds, e->ring.call);
@@ -2312,6 +2325,11 @@
 #if defined(HAVE_PRI_REVERSE_CHARGE)
 								pri->pvts[chanpos]->reverse_charging_indication = e->ring.reversecharge;
 #endif
+#if defined(HAVE_PRI_SETUP_KEYPAD)
+								ast_copy_string(pri->pvts[chanpos]->keypad_digits,
+									e->ring.keypad_digits,
+									sizeof(pri->pvts[chanpos]->keypad_digits));
+#endif	/* defined(HAVE_PRI_SETUP_KEYPAD) */
 
 								snprintf(calledtonstr, sizeof(calledtonstr), "%d", e->ring.calledplan);
 								pbx_builtin_setvar_helper(c, "CALLEDTON", calledtonstr);
@@ -2968,6 +2986,9 @@
 	int prilocaldialplan;
 	int ldp_strip;
 	int exclusive;
+#if defined(HAVE_PRI_SETUP_KEYPAD)
+	const char *keypad;
+#endif	/* defined(HAVE_PRI_SETUP_KEYPAD) */
 
 	ast_log(LOG_DEBUG, "CALLING CID_NAME: %s CID_NUM:: %s\n", ast->cid.cid_name, ast->cid.cid_num);
 
@@ -2993,6 +3014,34 @@
 	} else {
 		c = "";
 	}
+
+#if defined(HAVE_PRI_SETUP_KEYPAD)
+	/*
+	 *  v--- c points here
+	 * /[K<keypad-digits>/]extension
+	 */
+	if (c[0] == 'K') {
+		/* Extract the keypad facility digits. */
+		keypad = c + 1;
+		c = strchr(keypad, '/');
+		if (c) {
+			/* Terminate the keypad facility digits. */
+			*c++ = '\0';
+		} else {
+			c = "";
+		}
+		if (ast_strlen_zero(keypad)) {
+			/* What no keypad digits? */
+			keypad = NULL;
+		}
+	} else {
+		keypad = NULL;
+	}
+	/*
+	 *  v--- c points here
+	 * /extension
+	 */
+#endif	/* defined(HAVE_PRI_SETUP_KEYPAD) */
 
 	l = NULL;
 	n = NULL;
@@ -3107,6 +3156,11 @@
 			pri_sr_set_reversecharge(sr, PRI_REVERSECHARGE_REQUESTED);
 			break;
 #endif
+#if defined(HAVE_PRI_SETUP_KEYPAD)
+		case 'K':
+			/* Reserve this letter for keypad facility digits. */
+			break;
+#endif	/* defined(HAVE_PRI_SETUP_KEYPAD) */
 		default:
 			if (isalpha(c[p->stripmsd])) {
 				ast_log(LOG_WARNING, "Unrecognized pridialplan %s modifier: %c\n",
@@ -3116,7 +3170,15 @@
 		}
 		c++;
 	}
-	pri_sr_set_called(sr, c + p->stripmsd + dp_strip, pridialplan, s ? 1 : 0);
+#if defined(HAVE_PRI_SETUP_KEYPAD)
+	if (keypad) {
+		pri_sr_set_keypad_digits(sr, keypad);
+	}
+	if (!keypad || !ast_strlen_zero(c + p->stripmsd + dp_strip))
+#endif	/* defined(HAVE_PRI_SETUP_KEYPAD) */
+	{
+		pri_sr_set_called(sr, c + p->stripmsd + dp_strip, pridialplan, s ? 1 : 0);
+	}
 
 	ldp_strip = 0;
 	prilocaldialplan = p->pri->localdialplan - 1;

Modified: team/rmudgett/dahdi_facility/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/channels/sig_pri.h?view=diff&rev=224033&r1=224032&r2=224033
==============================================================================
--- team/rmudgett/dahdi_facility/channels/sig_pri.h (original)
+++ team/rmudgett/dahdi_facility/channels/sig_pri.h Wed Oct 14 11:00:06 2009
@@ -31,6 +31,7 @@
 #include <dahdi/user.h>
 #define HAVE_PRI_CALL_HOLD 1	/* BUGBUG remove this line and put test in configure.ac */
 #define HAVE_PRI_CALL_REROUTING 1	/* BUGBUG remove this line and put test in configure.ac */
+#define HAVE_PRI_SETUP_KEYPAD 1	/* BUGBUG remove this line and put test in configure.ac */
 
 enum sig_pri_tone {
 	SIG_PRI_TONE_RINGTONE = 0,
@@ -146,6 +147,10 @@
 	/* Internal variables -- Don't touch */
 	/* Probably will need DS0 number, DS1 number, and a few other things */
 	char dialdest[256];				/* Queued up digits for overlap dialing.  They will be sent out as information messages when setup ACK is received */
+#if defined(HAVE_PRI_SETUP_KEYPAD)
+	/*! \brief Keypad digits that came in with the SETUP message. */
+	char keypad_digits[AST_MAX_EXTENSION];
+#endif	/* defined(HAVE_PRI_SETUP_KEYPAD) */
 
 	unsigned int alerting:1;		/*!< TRUE if channel is alerting/ringing */
 	unsigned int alreadyhungup:1;	/*!< TRUE if the call has already gone/hungup */

Modified: team/rmudgett/dahdi_facility/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/configure.ac?view=diff&rev=224033&r1=224032&r2=224033
==============================================================================
--- team/rmudgett/dahdi_facility/configure.ac (original)
+++ team/rmudgett/dahdi_facility/configure.ac Wed Oct 14 11:00:06 2009
@@ -290,6 +290,7 @@
 AST_EXT_LIB_SETUP([PRI], [ISDN PRI], [pri])
 AST_EXT_LIB_SETUP_DEPENDENT([PRI_CALL_HOLD], [ISDN PRI call hold], [PRI], [pri])
 AST_EXT_LIB_SETUP_DEPENDENT([PRI_CALL_REROUTING], [ISDN PRI call rerouting and call deflection], [PRI], [pri])
+AST_EXT_LIB_SETUP_DEPENDENT([PRI_SETUP_KEYPAD], [ISDN PRI keypad facility in SETUP], [PRI], [pri])
 # ------------------------------------v
 # TODO: The code can be changed to always include these features now.
 # These features will always be present if pri_connected_line_update is available.
@@ -1445,6 +1446,7 @@
 AST_EXT_LIB_CHECK([PRI], [pri], [pri_connected_line_update], [libpri.h])
 AST_EXT_LIB_CHECK([PRI_CALL_HOLD], [pri], [pri_hold_enable], [libpri.h])
 AST_EXT_LIB_CHECK([PRI_CALL_REROUTING], [pri], [pri_reroute_enable], [libpri.h])
+AST_EXT_LIB_CHECK([PRI_SETUP_KEYPAD], [pri], [pri_sr_set_keypad_digits], [libpri.h])
 
 # ------------------------------------v
 # TODO: The code can be changed to always include these features now.




More information about the asterisk-commits mailing list