[Asterisk-cvs] asterisk/channels chan_zap.c,1.248,1.249

markster at lists.digium.com markster at lists.digium.com
Sun Jun 6 03:50:09 CDT 2004


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

Modified Files:
	chan_zap.c 
Log Message:
Don't require "c" before CRV syntax


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.248
retrieving revision 1.249
diff -u -d -r1.248 -r1.249
--- chan_zap.c	6 Jun 2004 03:32:55 -0000	1.248
+++ chan_zap.c	6 Jun 2004 08:52:24 -0000	1.249
@@ -6109,33 +6109,6 @@
 		ast_log(LOG_WARNING, "Channel requested with no data\n");
 		return NULL;
 	}
-#ifdef ZAPATA_PRI
-	if (dest[0] == 'c') {
-		/* This is requesting a specific CRV.  The format after the C is trunkgroup:CRV, so grab them */
-		/* Retrieve the group number */
-		char *stringp=NULL;
-		stringp=dest + 1;
-		s = strsep(&stringp, "/");
-		if (((res = sscanf(s, "%d:%d%c%d", &trunkgroup, &crv, &opt, &y)) < 2) || (trunkgroup < 1) || (crv < 1)) {
-			ast_log(LOG_WARNING, "Unable to determine trunk group and CRV for data %s\n", (char *)data);
-			return NULL;
-		}
-		res--;
-		for (x=0;x<NUM_SPANS;x++) {
-			if (pris[x].trunkgroup == trunkgroup) {
-				pri = pris + x;
-				lock = &pri->lock;
-				break;
-			}
-		}
-		if (!pri) {
-			ast_log(LOG_WARNING, "Unable to find trunk group %d\n", trunkgroup);
-			return NULL;
-		}
-		channelmatch = crv;
-		p = pris[x].crvs;
-	} else
-#endif	
 	if (toupper(dest[0]) == 'G' || toupper(dest[0])=='R') {
 		/* Retrieve the group number */
 		char *stringp=NULL;
@@ -6172,7 +6145,30 @@
 		if (!strcasecmp(s, "pseudo")) {
 			/* Special case for pseudo */
 			x = CHAN_PSEUDO;
-		} else if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
+		} 
+#ifdef ZAPATA_PRI
+		else if ((res = sscanf(s, "%d:%d%c%d", &trunkgroup, &crv, &opt, &y)) > 1) {
+			if ((trunkgroup < 1) || (crv < 1)) {
+				ast_log(LOG_WARNING, "Unable to determine trunk group and CRV for data %s\n", (char *)data);
+				return NULL;
+			}
+			res--;
+			for (x=0;x<NUM_SPANS;x++) {
+				if (pris[x].trunkgroup == trunkgroup) {
+					pri = pris + x;
+					lock = &pri->lock;
+					break;
+				}
+			}
+			if (!pri) {
+				ast_log(LOG_WARNING, "Unable to find trunk group %d\n", trunkgroup);
+				return NULL;
+			}
+			channelmatch = crv;
+			p = pris[x].crvs;
+		}
+#endif	
+		else if ((res = sscanf(s, "%d%c%d", &x, &opt, &y)) < 1) {
 			ast_log(LOG_WARNING, "Unable to determine channel for data %s\n", (char *)data);
 			return NULL;
 		}




More information about the svn-commits mailing list