[Asterisk-cvs] asterisk/channels chan_zap.c,1.491,1.492

mattf mattf
Tue Aug 30 11:38:29 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv20595/channels

Modified Files:
	chan_zap.c 
Log Message:
Add support for override of the default pri exclusive/preferred channel 
selection behavior


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.491
retrieving revision 1.492
diff -u -d -r1.491 -r1.492
--- chan_zap.c	29 Aug 2005 21:18:20 -0000	1.491
+++ chan_zap.c	30 Aug 2005 15:39:43 -0000	1.492
@@ -257,6 +257,7 @@
 static int cur_rxwink = -1;
 static int cur_rxflash = -1;
 static int cur_debounce = -1;
+static int cur_priexclusive = 0;
 
 static int priindication_oob = 0;
 
@@ -545,6 +546,7 @@
 	unsigned int permcallwaiting:1;
 	unsigned int permhidecallerid:1;		/* Whether to hide our outgoing caller ID or not */
 	unsigned int priindication_oob:1;
+	unsigned int priexclusive:1;
 	unsigned int pulse:1;
 	unsigned int pulsedial:1;			/* whether a pulse dial phone is detected */
 	unsigned int restrictcid:1;			/* Whether restrict the callerid -> only send ANI */
@@ -1877,6 +1879,8 @@
 		int dp_strip;
 		int prilocaldialplan;
 		int ldp_strip;
+		int exclusive;
+
 		c = strchr(dest, '/');
 		if (c)
 			c++;
@@ -1933,8 +1937,18 @@
 			pri_set_crv(p->pri->pri, p->call, p->channel, 0);
 		}
 		p->digital = IS_DIGITAL(ast->transfercapability);
-		pri_sr_set_channel(sr, p->bearer ? PVT_TO_CHANNEL(p->bearer) : PVT_TO_CHANNEL(p), 
-								p->pri->nodetype == PRI_NETWORK ? 0 : 1, 1);
+		/* Add support for exclusive override */
+		if (p->priexclusive)
+			exclusive = 1;
+		else {
+		/* otherwise, traditional behavior */
+			if (p->pri->nodetype == PRI_NETWORK)
+				exclusive = 0;
+			else
+				exclusive = 1;
+		}
+		
+		pri_sr_set_channel(sr, p->bearer ? PVT_TO_CHANNEL(p->bearer) : PVT_TO_CHANNEL(p), exclusive, 1);
 		pri_sr_set_bearer(sr, p->digital ? PRI_TRANS_CAP_DIGITAL : ast->transfercapability, 
 					(p->digital ? -1 : 
 						((p->law == ZT_LAW_ALAW) ? PRI_LAYER_1_ALAW : PRI_LAYER_1_ULAW)));
@@ -4670,7 +4684,7 @@
 			ast_log(LOG_DEBUG,"Received AST_CONTROL_PROGRESS on %s\n",chan->name);
 #ifdef ZAPATA_PRI
 			p->digital = 0;	/* Digital-only calls isn't allows any inband progress messages */
-			if (!p->proceeding && p->sig==SIG_PRI && p->pri && !p->outgoing) {
+			if ((p->proceeding < 2) && p->sig==SIG_PRI && p->pri && !p->outgoing) {
 				if (p->pri->pri) {		
 					if (!pri_grab(p, p->pri)) {
 						pri_progress(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1);
@@ -6927,6 +6941,7 @@
 		tmp->restrictcid = restrictcid;
 		tmp->use_callingpres = use_callingpres;
 		tmp->priindication_oob = priindication_oob;
+		tmp->priexclusive = cur_priexclusive;
 		tmp->emdigitwait = cur_emdigitwait;
 		if (tmp->usedistinctiveringdetection) {
 			if (!tmp->use_callerid) {
@@ -10408,6 +10423,8 @@
 				else
 					ast_log(LOG_WARNING, "'%s' is not a valid pri indication value, should be 'inband' or 'outofband' at line %d\n",
 						v->value, v->lineno);
+			} else if (!strcasecmp(v->name, "priexclusive")) {
+				cur_priexclusive = ast_true(v->value);
 			} else if (!strcasecmp(v->name, "internationalprefix")) {
 				ast_copy_string(internationalprefix, v->value, sizeof(internationalprefix));
 			} else if (!strcasecmp(v->name, "nationalprefix")) {




More information about the svn-commits mailing list