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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Nov 6 20:14:40 CST 2007


Author: tilghman
Date: Tue Nov  6 20:14:40 2007
New Revision: 89078

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89078
Log:
Provide the ability to directly manipulate the TON/NPI bits in the dialstring.
Reported by: thetatag
Patch by: thetatag/stevens/tilghman
Closes issue #5331

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=89078&r1=89077&r2=89078
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Tue Nov  6 20:14:40 2007
@@ -2353,7 +2353,6 @@
 			}
 		}
 
-
 		if (strlen(c) < p->stripmsd) {
 			ast_log(LOG_WARNING, "Number '%s' is shorter than stripmsd (%d)\n", c, p->stripmsd);
 			ast_mutex_unlock(&p->lock);
@@ -2434,6 +2433,56 @@
 				pridialplan = PRI_LOCAL_ISDN;
  			}
  		}
+		while (c[p->stripmsd] > '9' && c[p->stripmsd] != '*' && c[p->stripmsd] != '#') {
+			switch (c[p->stripmsd]) {
+			case 'U':
+				pridialplan = (PRI_TON_UNKNOWN << 4) | (pridialplan & 0xf);
+				break;
+			case 'I':
+				pridialplan = (PRI_TON_INTERNATIONAL << 4) | (pridialplan & 0xf);
+				break;
+			case 'N':
+				pridialplan = (PRI_TON_NATIONAL << 4) | (pridialplan & 0xf);
+				break;
+			case 'L':
+				pridialplan = (PRI_TON_NET_SPECIFIC << 4) | (pridialplan & 0xf);
+				break;
+			case 'S':
+				pridialplan = (PRI_TON_SUBSCRIBER << 4) | (pridialplan & 0xf);
+				break;
+			case 'A':
+				pridialplan = (PRI_TON_ABBREVIATED << 4) | (pridialplan & 0xf);
+				break;
+			case 'R':
+				pridialplan = (PRI_TON_RESERVED << 4) | (pridialplan & 0xf);
+				break;
+			case 'u':
+				pridialplan = PRI_NPI_UNKNOWN | (pridialplan & 0xf0);
+				break;
+			case 'e':
+				pridialplan = PRI_NPI_E163_E164 | (pridialplan & 0xf0);
+				break;
+			case 'x':
+				pridialplan = PRI_NPI_X121 | (pridialplan & 0xf0);
+				break;
+			case 'f':
+				pridialplan = PRI_NPI_F69 | (pridialplan & 0xf0);
+				break;
+			case 'n':
+				pridialplan = PRI_NPI_NATIONAL | (pridialplan & 0xf0);
+				break;
+			case 'p':
+				pridialplan = PRI_NPI_PRIVATE | (pridialplan & 0xf0);
+				break;
+			case 'r':
+				pridialplan = PRI_NPI_RESERVED | (pridialplan & 0xf0);
+				break;
+			default:
+				if (isalpha(*c))
+					ast_log(LOG_WARNING, "Unrecognized pridialplan %s modifier: %c\n", *c > 'Z' ? "NPI" : "TON", *c);
+			}
+			c++;
+		}
  		pri_sr_set_called(sr, c + p->stripmsd + dp_strip, pridialplan, s ? 1 : 0);
 
 		ldp_strip = 0;
@@ -2451,6 +2500,58 @@
 				prilocaldialplan = PRI_NATIONAL_ISDN;
 			} else {
 				prilocaldialplan = PRI_LOCAL_ISDN;
+			}
+		}
+		if (l != NULL) {
+			while (*l > '9' && *l != '*' && *l != '#') {
+				switch (*l) {
+				case 'U':
+					prilocaldialplan = (PRI_TON_UNKNOWN << 4) | (prilocaldialplan & 0xf);
+					break;
+				case 'I':
+					prilocaldialplan = (PRI_TON_INTERNATIONAL << 4) | (prilocaldialplan & 0xf);
+					break;
+				case 'N':
+					prilocaldialplan = (PRI_TON_NATIONAL << 4) | (prilocaldialplan & 0xf);
+					break;
+				case 'L':
+					prilocaldialplan = (PRI_TON_NET_SPECIFIC << 4) | (prilocaldialplan & 0xf);
+					break;
+				case 'S':
+					prilocaldialplan = (PRI_TON_SUBSCRIBER << 4) | (prilocaldialplan & 0xf);
+					break;
+				case 'A':
+					prilocaldialplan = (PRI_TON_ABBREVIATED << 4) | (prilocaldialplan & 0xf);
+					break;
+				case 'R':
+					prilocaldialplan = (PRI_TON_RESERVED << 4) | (prilocaldialplan & 0xf);
+					break;
+				case 'u':
+					prilocaldialplan = PRI_NPI_UNKNOWN | (prilocaldialplan & 0xf0);
+					break;
+				case 'e':
+					prilocaldialplan = PRI_NPI_E163_E164 | (prilocaldialplan & 0xf0);
+					break;
+				case 'x':
+					prilocaldialplan = PRI_NPI_X121 | (prilocaldialplan & 0xf0);
+					break;
+				case 'f':
+					prilocaldialplan = PRI_NPI_F69 | (prilocaldialplan & 0xf0);
+					break;
+				case 'n':
+					prilocaldialplan = PRI_NPI_NATIONAL | (prilocaldialplan & 0xf0);
+					break;
+				case 'p':
+					prilocaldialplan = PRI_NPI_PRIVATE | (prilocaldialplan & 0xf0);
+					break;
+				case 'r':
+					prilocaldialplan = PRI_NPI_RESERVED | (prilocaldialplan & 0xf0);
+					break;
+				default:
+					if (isalpha(*l))
+						ast_log(LOG_WARNING, "Unrecognized prilocaldialplan %s modifier: %c\n", *c > 'Z' ? "NPI" : "TON", *c);
+				}
+				l++;
 			}
 		}
 		pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan,

Modified: trunk/configs/zapata.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/zapata.conf.sample?view=diff&rev=89078&r1=89077&r2=89078
==============================================================================
--- trunk/configs/zapata.conf.sample (original)
+++ trunk/configs/zapata.conf.sample Tue Nov  6 20:14:40 2007
@@ -87,14 +87,41 @@
 ; unknown:        Unknown
 ; private:        Private ISDN
 ; local:          Local ISDN
-; national:	  National ISDN
+; national:       National ISDN
 ; international:  International ISDN
-; dynamic:	  Dynamically selects the appropriate dialplan
+; dynamic:        Dynamically selects the appropriate dialplan
 ; redundant:      Same as dynamic, except that the underlying number is not 
 ;                 changed (not common)
 ;
 ;pridialplan=national
 ;prilocaldialplan=national
+; 
+; pridialplan may be also set at dialtime, by prefixing the dialled number with
+; one of the following letters:
+; U - Unknown
+; P - Private
+; L - Local
+; N - National
+; I - International
+; D - Dynamic
+; R - Redundant
+;
+; Additionally, you may also set the following NPI bits (also by prefixing the
+; dialled string with one of the following letters):
+; u - Unknown
+; e - E.163/E.164
+; x - X.121
+; f - F.69
+; n - National
+; p - Private
+; r - Reserved
+;
+; You may also set the prilocaldialplan in the same way, but by prefixing the
+; Caller*ID Number, rather than the dialled number.  Please note that telcos
+; which require this kind of additional manipulation of the TON/NPI are *rare*.
+; Most telco PRIs will work fine simply by setting pridialplan to unknown or
+; dynamic.
+;
 ;
 ; PRI caller ID prefixes based on the given TON/NPI (dialplan)
 ; This is especially needed for EuroISDN E1-PRIs




More information about the svn-commits mailing list