[asterisk-commits] rmudgett: branch group/issue8824 r161905 - in /team/group/issue8824: ./ chann...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 8 16:13:05 CST 2008


Author: rmudgett
Date: Mon Dec  8 16:13:04 2008
New Revision: 161905

URL: http://svn.digium.com/view/asterisk?view=rev&rev=161905
Log:
*  Addresses JIRA ABE-1747
mISDN now uses the nationalprefix and internationalprefix misdn.conf
parameters to prefix any received number from the ISDN link if that
number has the corresponding Type-Of-Number.

Modified:
    team/group/issue8824/CHANGES
    team/group/issue8824/channels/chan_misdn.c
    team/group/issue8824/configs/misdn.conf.sample

Modified: team/group/issue8824/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/CHANGES?view=diff&rev=161905&r1=161904&r2=161905
==============================================================================
--- team/group/issue8824/CHANGES (original)
+++ team/group/issue8824/CHANGES Mon Dec  8 16:13:04 2008
@@ -36,12 +36,15 @@
     channel.
   * Made misdn.conf parameter callerid accept the "name" <number> format
     used by the rest of the system.
+  * Made use the nationalprefix and internationalprefix misdn.conf
+    parameters to prefix any received number from the ISDN link if that
+    number has the corresponding Type-Of-Number.
 
 SIP channel driver (chan_sip) changes
 -------------------------------------------
   * The sendrpid parameter has been expanded to include the options
     'rpid' and 'pai'. Setting sendrpid to 'rpid' will cause Remote-Party-ID
-    header to be sent (equivalent to setting sendrpid=yes) and setting 
+    header to be sent (equivalent to setting sendrpid=yes) and setting
     sendrpid to 'pai' will cause P-Asserted-Identity header to be sent.
 
 ------------------------------------------------------------------------------

Modified: team/group/issue8824/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_misdn.c?view=diff&rev=161905&r1=161904&r2=161905
==============================================================================
--- team/group/issue8824/channels/chan_misdn.c (original)
+++ team/group/issue8824/channels/chan_misdn.c Mon Dec  8 16:13:04 2008
@@ -1255,6 +1255,41 @@
 		break;
 	}
 }
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Add a confiured prefix to the given number.
+ *
+ * \param port Logical port number
+ * \param number_type Type-of-number passed in.
+ * \param number Given number string to add prefix
+ * \param size Buffer size number string occupies.
+ *
+ * \return Nothing
+ */
+static void misdn_add_number_prefix(int port, enum mISDN_NUMBER_TYPE number_type, char *number, size_t size)
+{
+	char prefix[MISDN_MAX_NUMBER_LEN];
+	char saved_number[MISDN_MAX_NUMBER_LEN];
+
+	prefix[0] = 0;
+	switch (number_type) {
+	case NUMTYPE_INTERNATIONAL:
+		misdn_cfg_get(port, MISDN_CFG_INTERNATPREFIX, prefix, sizeof(prefix));
+		break;
+	case NUMTYPE_NATIONAL:
+		misdn_cfg_get(port, MISDN_CFG_NATPREFIX, prefix, sizeof(prefix));
+		break;
+	default:
+		return;
+	}
+	ast_copy_string(saved_number, number, sizeof(saved_number));
+	snprintf(number, size, "%s%s", prefix, saved_number);
+}	/* end misdn_add_number_prefix() */
 
 static void export_aoc_vars(int originator, struct ast_channel *ast, struct misdn_bchannel *bc)
 {
@@ -2789,12 +2824,11 @@
 
 	misdn_cfg_get(bc->port, MISDN_CFG_EARLY_BCONNECT, &bc->early_bconnect, sizeof(bc->early_bconnect));
 
+	misdn_cfg_get(port, MISDN_CFG_DISPLAY_CONNECTED, &bc->display_connected, sizeof(bc->display_connected));
+	misdn_cfg_get(port, MISDN_CFG_DISPLAY_SETUP, &bc->display_setup, sizeof(bc->display_setup));
+
 	misdn_cfg_get(port, MISDN_CFG_PICKUPGROUP, &pg, sizeof(pg));
 	misdn_cfg_get(port, MISDN_CFG_CALLGROUP, &cg, sizeof(cg));
-
-	misdn_cfg_get(port, MISDN_CFG_DISPLAY_CONNECTED, &bc->display_connected, sizeof(bc->display_connected));
-	misdn_cfg_get(port, MISDN_CFG_DISPLAY_SETUP, &bc->display_setup, sizeof(bc->display_setup));
-
 	chan_misdn_log(5, port, " --> * CallGrp:%s PickupGrp:%s\n", ast_print_group(buf, sizeof(buf), cg), ast_print_group(buf2, sizeof(buf2), pg));
 	ast->pickupgroup = pg;
 	ast->callgroup = cg;
@@ -2838,8 +2872,6 @@
 
 		ch->overlap_dial = 0;
 	} else {
-		char prefix[BUFFERSIZE + 1];
-
 		/* ORIGINATOR MISDN (incoming call) */
 
  		if (strstr(faxdetect, "incoming") || strstr(faxdetect, "both")) {
@@ -2850,42 +2882,16 @@
  		}
 
 		/* Add configured prefix to caller.number */
-		prefix[0] = 0;
-		switch (bc->caller.number_type) {
-		case NUMTYPE_INTERNATIONAL:
-			misdn_cfg_get(bc->port, MISDN_CFG_INTERNATPREFIX, prefix, sizeof(prefix));
-			break;
-		case NUMTYPE_NATIONAL:
-			misdn_cfg_get(bc->port, MISDN_CFG_NATPREFIX, prefix, sizeof(prefix));
-			break;
-		default:
-			break;
-		}
-		ast_copy_string(buf, bc->caller.number, sizeof(buf));
-		snprintf(bc->caller.number, sizeof(bc->caller.number), "%s%s", prefix, buf);
-
-		if ( ast_strlen_zero(bc->dialed.number) && !ast_strlen_zero(bc->keypad)) {
+		misdn_add_number_prefix(bc->port, bc->caller.number_type, bc->caller.number, sizeof(bc->caller.number));
+
+		if (ast_strlen_zero(bc->dialed.number) && !ast_strlen_zero(bc->keypad)) {
 			ast_copy_string(bc->dialed.number, bc->keypad, sizeof(bc->dialed.number));
 		}
 
 		/* Add configured prefix to dialed.number */
-		prefix[0] = 0;
-		switch (bc->dialed.number_type) {
-		case NUMTYPE_INTERNATIONAL:
-			misdn_cfg_get(bc->port, MISDN_CFG_INTERNATPREFIX, prefix, sizeof(prefix));
-			break;
-		case NUMTYPE_NATIONAL:
-			misdn_cfg_get(bc->port, MISDN_CFG_NATPREFIX, prefix, sizeof(prefix));
-			break;
-		default:
-			break;
-		}
-		ast_copy_string(buf, bc->dialed.number, sizeof(buf));
-		snprintf(bc->dialed.number, sizeof(bc->dialed.number), "%s%s", prefix, buf);
-
-		if (strcmp(bc->dialed.number, ast->exten)) {
-			ast_copy_string(ast->exten, bc->dialed.number, sizeof(ast->exten));
-		}
+		misdn_add_number_prefix(bc->port, bc->dialed.number_type, bc->dialed.number, sizeof(bc->dialed.number));
+
+		ast_copy_string(ast->exten, bc->dialed.number, sizeof(ast->exten));
 	
 		misdn_cfg_get(bc->port, MISDN_CFG_OVERLAP_DIAL, &ch->overlap_dial, sizeof(ch->overlap_dial));
 		ast_mutex_init(&ch->overlap_tv_lock);
@@ -5216,6 +5222,9 @@
 		if (!ast_strlen_zero(bc->redirecting.from.number)) {
 			struct ast_party_redirecting redirecting;
 
+			/* Add configured prefix to redirecting.from.number */
+			misdn_add_number_prefix(bc->port, bc->redirecting.from.number_type, bc->redirecting.from.number, sizeof(bc->redirecting.from.number));
+
 			/* Update asterisk channel redirecting information */
 			ast_party_redirecting_set_init(&redirecting, &chan->redirecting);
 			redirecting.from.number = bc->redirecting.from.number;
@@ -5491,6 +5500,9 @@
 			break;
 
 		stop_indicate(ch);
+
+		/* Add configured prefix to connected.number */
+		misdn_add_number_prefix(bc->port, bc->connected.number_type, bc->connected.number, sizeof(bc->connected.number));
 
 		/* Update the connected line information on the other channel */
 		ast_party_connected_line_init(&connected);

Modified: team/group/issue8824/configs/misdn.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/configs/misdn.conf.sample?view=diff&rev=161905&r1=161904&r2=161905
==============================================================================
--- team/group/issue8824/configs/misdn.conf.sample (original)
+++ team/group/issue8824/configs/misdn.conf.sample Mon Dec  8 16:13:04 2008
@@ -190,10 +190,11 @@
 ;
 allowed_bearers=all
 
-; Prefixes for national and international Type-Of-Number, these are
-; put before the caller number and dialed number if a corresponding
-; dialplan is set for incoming calls.  See the dialplan and localdialplan
-; options.
+; Prefixes for national and international Type-Of-Number.  These are
+; inserted before any number (caller, dialed, connected, redirecting,
+; redirection) received from the ISDN link if that number has the
+; correspondng Type-Of-Number.
+; See the dialplan options.
 ;
 ; default values: nationalprefix      : 0
 ;                 internationalprefix : 00




More information about the asterisk-commits mailing list