[Asterisk-cvs] asterisk/channels chan_zap.c,1.327,1.328

markster at lists.digium.com markster at lists.digium.com
Tue Aug 31 09:43:58 CDT 2004


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

Modified Files:
	chan_zap.c 
Log Message:
Permit in-band and out-of-band Busy/Congestion (bug #2325)


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.327
retrieving revision 1.328
diff -u -d -r1.327 -r1.328
--- chan_zap.c	31 Aug 2004 00:08:52 -0000	1.327
+++ chan_zap.c	31 Aug 2004 13:47:23 -0000	1.328
@@ -223,6 +223,8 @@
 static int cur_rxflash = -1;
 static int cur_debounce = -1;
 
+static int priindication_oob = 0;
+
 #ifdef ZAPATA_PRI
 static int minunused = 2;
 static int minidle = 0;
@@ -494,6 +496,7 @@
 	int busydetect;
 	int busycount;
 	int callprogress;
+	int priindication_oob;
 	struct timeval flashtime;	/* Last flash-hook time */
 	struct ast_dsp *dsp;
 	int cref;					/* Call reference number */
@@ -4135,7 +4138,12 @@
 	if (index == SUB_REAL) {
 		switch(condition) {
 		case AST_CONTROL_BUSY:
-			res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_BUSY);
+#ifdef ZAPATA_PRI
+			if (p->priindication_oob && p->sig == SIG_PRI)
+				res = pri_hangup(p->pri->pri, p->call, PRI_CAUSE_USER_BUSY);
+			else
+#endif
+				res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_BUSY);
 			break;
 		case AST_CONTROL_RINGING:
 #ifdef ZAPATA_PRI
@@ -4198,7 +4206,12 @@
 			break;
 		case AST_CONTROL_CONGESTION:
 			chan->hangupcause = AST_CAUSE_CONGESTION;
-			res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
+#ifdef ZAPATA_PRI
+			if (p->priindication_oob && p->sig == SIG_PRI)
+				res = pri_hangup(p->pri->pri, p->call, PRI_CAUSE_SWITCH_CONGESTION);
+			else
+#endif
+				res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
 			break;
 		case AST_CONTROL_RADIO_KEY:
 			if (p->radio) 
@@ -6132,6 +6145,8 @@
 		tmp->zaptrcallerid = zaptrcallerid;
 		tmp->restrictcid = restrictcid;
 		tmp->use_callingpres = use_callingpres;
+		tmp->priindication_oob = priindication_oob;
+
 		strncpy(tmp->accountcode, accountcode, sizeof(tmp->accountcode)-1);
 		tmp->amaflags = amaflags;
 		if (!here) {
@@ -9094,19 +9109,27 @@
 				ast_mutex_unlock(&iflock);
 				return -1;
 			}
-               } else if (!strcasecmp(v->name, "nsf")) {
-                       if (!strcasecmp(v->value, "sdn"))
-                               nsf = PRI_NSF_SDN;
-                       else if (!strcasecmp(v->value, "megacom"))
-                               nsf = PRI_NSF_MEGACOM;
-                       else if (!strcasecmp(v->value, "accunet"))
-                               nsf = PRI_NSF_ACCUNET;
-                       else if (!strcasecmp(v->value, "none"))
-                               nsf = PRI_NSF_NONE;
-                       else {
-                               ast_log(LOG_WARNING, "Unknown network-specific facility '%s'\n", v->value);
-                               nsf = PRI_NSF_NONE;
-                       }
+		} else if (!strcasecmp(v->name, "nsf")) {
+			if (!strcasecmp(v->value, "sdn"))
+				nsf = PRI_NSF_SDN;
+			else if (!strcasecmp(v->value, "megacom"))
+				nsf = PRI_NSF_MEGACOM;
+			else if (!strcasecmp(v->value, "accunet"))
+				nsf = PRI_NSF_ACCUNET;
+			else if (!strcasecmp(v->value, "none"))
+				nsf = PRI_NSF_NONE;
+			else {
+				ast_log(LOG_WARNING, "Unknown network-specific facility '%s'\n", v->value);
+				nsf = PRI_NSF_NONE;
+			}
+		} else if (!strcasecmp(v->name, "priindication")) {
+			if (!strcasecmp(v->value, "outofband"))
+				priindication_oob = 1;
+			else if (!strcasecmp(v->name, "inband"))
+				priindication_oob = 0;
+			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, "minunused")) {
 			minunused = atoi(v->value);
 		} else if (!strcasecmp(v->name, "idleext")) {




More information about the svn-commits mailing list