[svn-commits] tilghman: trunk r56952 - in /trunk: channels/ configs/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Feb 26 17:11:33 MST 2007


Author: tilghman
Date: Mon Feb 26 18:11:32 2007
New Revision: 56952

URL: http://svn.digium.com/view/asterisk?view=rev&rev=56952
Log:
Issue 7789 - some telcos want the TON set based on the number, but without the NANP prefix removed

Modified:
    trunk/channels/chan_zap.c
    trunk/configs/zapata.conf.sample

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=56952&r1=56951&r2=56952
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Mon Feb 26 18:11:32 2007
@@ -1264,7 +1264,7 @@
 #ifdef HAVE_PRI
 static char *dialplan2str(int dialplan)
 {
-	if (dialplan == -1) {
+	if (dialplan == -1 || dialplan == -2) {
 		return("Dynamically set dialplan in ISDN");
 	}
 	return (pri_plan2str(dialplan));
@@ -2300,12 +2300,16 @@
 			ast_verbose(VERBOSE_PREFIX_3 "Requested transfer capability: 0x%.2x - %s\n", ast->transfercapability, ast_transfercapability2str(ast->transfercapability));
 		dp_strip = 0;
  		pridialplan = p->pri->dialplan - 1;
- 		if (pridialplan == -2) { /* compute dynamically */
+		if (pridialplan == -2 || pridialplan == -3) { /* compute dynamically */
  			if (strncmp(c + p->stripmsd, p->pri->internationalprefix, strlen(p->pri->internationalprefix)) == 0) {
- 				dp_strip = strlen(p->pri->internationalprefix);
+				if (pridialplan == -2) {
+ 					dp_strip = strlen(p->pri->internationalprefix);
+				}
  				pridialplan = PRI_INTERNATIONAL_ISDN;
  			} else if (strncmp(c + p->stripmsd, p->pri->nationalprefix, strlen(p->pri->nationalprefix)) == 0) {
- 				dp_strip = strlen(p->pri->nationalprefix);
+				if (pridialplan == -2) {
+ 					dp_strip = strlen(p->pri->nationalprefix);
+				}
  				pridialplan = PRI_NATIONAL_ISDN;
  			} else {
 				pridialplan = PRI_LOCAL_ISDN;
@@ -2315,12 +2319,16 @@
 
 		ldp_strip = 0;
 		prilocaldialplan = p->pri->localdialplan - 1;
-		if ((l != NULL) && (prilocaldialplan == -2)) { /* compute dynamically */
+		if ((l != NULL) && (prilocaldialplan == -2 || prilocaldialplan == -3)) { /* compute dynamically */
 			if (strncmp(l, p->pri->internationalprefix, strlen(p->pri->internationalprefix)) == 0) {
-				ldp_strip = strlen(p->pri->internationalprefix);
+				if (prilocaldialplan == -2) {
+					ldp_strip = strlen(p->pri->internationalprefix);
+				}
 				prilocaldialplan = PRI_INTERNATIONAL_ISDN;
 			} else if (strncmp(l, p->pri->nationalprefix, strlen(p->pri->nationalprefix)) == 0) {
-				ldp_strip = strlen(p->pri->nationalprefix);
+				if (prilocaldialplan == -2) {
+					ldp_strip = strlen(p->pri->nationalprefix);
+				}
 				prilocaldialplan = PRI_NATIONAL_ISDN;
 			} else {
 				prilocaldialplan = PRI_LOCAL_ISDN;
@@ -9121,6 +9129,10 @@
 
 static void apply_plan_to_number(char *buf, size_t size, const struct zt_pri *pri, const char *number, const int plan)
 {
+	if (pri->dialplan == -2) { /* autodetect the TON but leave the number untouched */
+		snprintf(buf, size, "%s", number);
+		return;
+	}
 	switch (plan) {
 	case PRI_INTERNATIONAL_ISDN:		/* Q.931 dialplan == 0x11 international dialplan => prepend international prefix digits */
 		snprintf(buf, size, "%s%s", pri->internationalprefix, number);
@@ -12130,6 +12142,8 @@
 					confp->pri.dialplan = PRI_LOCAL_ISDN + 1;
 	 			} else if (!strcasecmp(v->value, "dynamic")) {
  					confp->pri.dialplan = -1;
+				} else if (!strcasecmp(v->value, "redundant")) {
+					confp->pri.dialplan = -2;
 				} else {
 					ast_log(LOG_WARNING, "Unknown PRI dialplan '%s' at line %d.\n", v->value, v->lineno);
 				}
@@ -12146,6 +12160,8 @@
 					confp->pri.localdialplan = PRI_LOCAL_ISDN + 1;
 				} else if (!strcasecmp(v->value, "dynamic")) {
 					confp->pri.localdialplan = -1;
+				} else if (!strcasecmp(v->value, "redundant")) {
+					confp->pri.localdialplan = -2;
 				} else {
 					ast_log(LOG_WARNING, "Unknown PRI dialplan '%s' at line %d.\n", v->value, v->lineno);
 				}

Modified: trunk/configs/zapata.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/zapata.conf.sample?view=diff&rev=56952&r1=56951&r2=56952
==============================================================================
--- trunk/configs/zapata.conf.sample (original)
+++ trunk/configs/zapata.conf.sample Mon Feb 26 18:11:32 2007
@@ -74,6 +74,7 @@
 ; national:	  National ISDN
 ; international:  International ISDN
 ; dynamic:	  Dynamically selects the appropriate dialplan
+; redundant:      Same as dynamic, except that the underlying number is not changed (not common)
 ;
 ;pridialplan=national
 ;
@@ -85,6 +86,7 @@
 ; national:	  National ISDN
 ; international:  International ISDN
 ; dynamic:	  Dynamically selects the appropriate dialplan
+; redundant:      Same as dynamic, except that the underlying number is not changed (not common)
 ;
 ;prilocaldialplan=national
 ;



More information about the svn-commits mailing list