On 12/07/04 11:11, Michael Sandee wrote:
pridialplan=unknown
prilocaldialplan=national

Not only is this that undocumented, but the string "prilocaldialplan" doesn't even show up in the latest CVS HEAD source code, so that's not going to work...


On 12/07/04 13:36, Thomas wrote:
I have an E100P connected to our partner's PBX. They want the following:
Called number must have numbering plan/type set as:
unknown/unknown and calling number in: ISDN/national.

Our telco requires exactly this same thing - different TON for the calling and called numbers. You want to apply a patch I wrote that allows you to configure them separately.


It swaps the single setting "pridialplan" for two settings that take the same values as pridialplan: "calledpridialplan" and "callerpridialplan".

I attach the patch (although it is against a pretty old version of chan_zap.c). I will also clean this up soon and add it to the bug tracker.

Best regards,

Al

--
Alastair Maw
Systems Analyst
Tel: +44 (0) 845 666 7778
http://www.mxtelecom.com
--- chan_zap.c.org	2004-02-20 16:53:31.000000000 +0000
+++ chan_zap.c	2004-03-05 12:03:53.000000000 +0000
@@ -282,7 +282,8 @@
 	int minidle;				/* Min # of "idling" calls to keep active */
 	int nodetype;				/* Node type */
 	int switchtype;				/* Type of switch to emulate */
-	int dialplan;			/* Dialing plan */
+	int callerdialplan;		/* Caller dialing plan */
+	int calleddialplan;		/* Called dialing plan */
 	int dchannel;			/* What channel the dchannel is on */
 	int channels;			/* Num of chans in span (31 or 24) */
 	int overlapdial;		/* In overlap dialing mode */
@@ -317,7 +318,8 @@
 }
 
 static int switchtype = PRI_SWITCH_NI2;
-static int dialplan = PRI_NATIONAL_ISDN + 1;
+static int callerdialplan = PRI_NATIONAL_ISDN + 1;
+static int calleddialplan = PRI_NATIONAL_ISDN + 1;
 
 #endif
 
@@ -1595,9 +1597,9 @@
 		}
 		p->digital = ast_test_flag(ast,AST_FLAG_DIGITAL);
 		if (pri_call(p->pri->pri, p->call, p->digital ? PRI_TRANS_CAP_DIGITAL : PRI_TRANS_CAP_SPEECH, 
-			p->prioffset, p->pri->nodetype == PRI_NETWORK ? 0 : 1, 1, l, p->pri->dialplan - 1, n,
+			p->prioffset, p->pri->nodetype == PRI_NETWORK ? 0 : 1, 1, l, p->pri->callerdialplan - 1, n,
 			l ? (ast->restrictcid ? PRES_PROHIB_USER_NUMBER_PASSED_SCREEN : (p->use_callingpres ? ast->callingpres : PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN)) : PRES_NUMBER_NOT_AVAILABLE,
-			c + p->stripmsd, p->pri->dialplan - 1, 
+			c + p->stripmsd, p->pri->calleddialplan - 1, 
 			((p->law == ZT_LAW_ALAW) ? PRI_LAYER_1_ALAW : PRI_LAYER_1_ULAW))) {
 			ast_log(LOG_WARNING, "Unable to setup call to %s\n", c + p->stripmsd);
 			return -1;
@@ -5364,8 +5366,13 @@
 						free(tmp);
 						return NULL;
 					}
-					if ((pris[span].dialplan) && (pris[span].dialplan != dialplan)) {
-						ast_log(LOG_ERROR, "Span %d is already a %s dialing plan\n", span + 1, pri_plan2str(pris[span].dialplan));
+					if ((pris[span].calleddialplan) && (pris[span].calleddialplan != calleddialplan)) {
+						ast_log(LOG_ERROR, "Span %d is already a %s called dialing plan\n", span + 1, pri_plan2str(pris[span].calleddialplan));
+						free(tmp);
+						return NULL;
+					}
+					if ((pris[span].callerdialplan) && (pris[span].callerdialplan != callerdialplan)) {
+						ast_log(LOG_ERROR, "Span %d is already a %s caller dialing plan\n", span + 1, pri_plan2str(pris[span].callerdialplan));
 						free(tmp);
 						return NULL;
 					}
@@ -5391,7 +5398,8 @@
 					}
 					pris[span].nodetype = pritype;
 					pris[span].switchtype = switchtype;
-					pris[span].dialplan = dialplan;
+					pris[span].calleddialplan = calleddialplan;
+					pris[span].callerdialplan = callerdialplan;
 					pris[span].chanmask[offset] |= MASK_AVAIL;
 					pris[span].pvt[offset] = tmp;
 					pris[span].channels = numchans;
@@ -7556,19 +7564,33 @@
 			}
 #endif
 #ifdef ZAPATA_PRI
-		} else if (!strcasecmp(v->name, "pridialplan")) {
+		} else if (!strcasecmp(v->name, "calledpridialplan")) {
+			if (!strcasecmp(v->value, "national")) {
+				calleddialplan = PRI_NATIONAL_ISDN + 1;
+			} else if (!strcasecmp(v->value, "unknown")) {
+				calleddialplan = PRI_UNKNOWN + 1;
+			} else if (!strcasecmp(v->value, "private")) {
+				calleddialplan = PRI_PRIVATE + 1;
+			} else if (!strcasecmp(v->value, "international")) {
+				calleddialplan = PRI_INTERNATIONAL_ISDN + 1;
+			} else if (!strcasecmp(v->value, "local")) {
+				calleddialplan = PRI_LOCAL_ISDN + 1;
+			} else {
+				ast_log(LOG_WARNING, "Unknown called PRI dialplan '%s' at line %d.\n", v->value, v->lineno);
+			}
+		} else if (!strcasecmp(v->name, "callerpridialplan")) {
 			if (!strcasecmp(v->value, "national")) {
-				dialplan = PRI_NATIONAL_ISDN + 1;
+				callerdialplan = PRI_NATIONAL_ISDN + 1;
 			} else if (!strcasecmp(v->value, "unknown")) {
-				dialplan = PRI_UNKNOWN + 1;
+				callerdialplan = PRI_UNKNOWN + 1;
 			} else if (!strcasecmp(v->value, "private")) {
-				dialplan = PRI_PRIVATE + 1;
+				callerdialplan = PRI_PRIVATE + 1;
 			} else if (!strcasecmp(v->value, "international")) {
-				dialplan = PRI_INTERNATIONAL_ISDN + 1;
+				callerdialplan = PRI_INTERNATIONAL_ISDN + 1;
 			} else if (!strcasecmp(v->value, "local")) {
-				dialplan = PRI_LOCAL_ISDN + 1;
+				callerdialplan = PRI_LOCAL_ISDN + 1;
 			} else {
-				ast_log(LOG_WARNING, "Unknown PRI dialplan '%s' at line %d.\n", v->value, v->lineno);
+				ast_log(LOG_WARNING, "Unknown caller PRI dialplan '%s' at line %d.\n", v->value, v->lineno);
 			}
 		} else if (!strcasecmp(v->name, "switchtype")) {
 			if (!strcasecmp(v->value, "national")) 

Reply via email to