[Asterisk-cvs] asterisk/channels chan_zap.c,1.344,1.345

markster at lists.digium.com markster at lists.digium.com
Thu Sep 30 11:23:50 CDT 2004


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

Modified Files:
	chan_zap.c 
Log Message:
Merge ring pulse stuff (Bug #2016)


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.344
retrieving revision 1.345
diff -u -d -r1.344 -r1.345
--- chan_zap.c	26 Sep 2004 18:16:06 -0000	1.344
+++ chan_zap.c	30 Sep 2004 15:26:04 -0000	1.345
@@ -9480,6 +9480,7 @@
 			int i;
 			struct zt_ring_cadence new_cadence;
 			int cid_location = -1;
+                        int firstcadencepos = 0;
 			char original_args[80];
 			int cadence_is_ok = 1;
 
@@ -9495,23 +9496,30 @@
 
 			/* Ring cadences cannot be negative */
 			for (i=0;i<element_count;i++) {
-				if (c[i] < 1) {
-					if ((i % 2 == 1) && (cid_location == -1)) {
-						/* Silence duration, negative possibly okay */
-						if (c[i] == 0) {
-							ast_log(LOG_ERROR, "Silence duration cannot be zero: %s\n", original_args);
-							cadence_is_ok = 0;
-						} else {
-							cid_location = i;
+			        if (c[i] == 0) {
+				        ast_log(LOG_ERROR, "Ring or silence duration cannot be zero: %s\n", original_args);
+					cadence_is_ok = 0;
+					break;
+				} else if (c[i] < 0) {
+					if (i % 2 == 1) {
+					        /* Silence duration, negative possibly okay */
+						if (cid_location == -1) {
+						        cid_location = i;
 							c[i] *= -1;
+						} else {
+						        ast_log(LOG_ERROR, "CID location specified twice: %s\n",original_args);
+							cadence_is_ok = 0;
+							break;
 						}
-					} else if (cid_location) {
-						ast_log(LOG_ERROR, "CID location specified twice: %s\n",original_args);
-						cadence_is_ok = 0;
 					} else {
-						ast_log(LOG_ERROR, "Negative or zero ring duration: %s\n",original_args);
-						cadence_is_ok = 0;
-						break;
+						if (firstcadencepos == 0) {
+						        firstcadencepos = i; /* only recorded to avoid duplicate specification */
+							                     /* duration will be passed negative to the zaptel driver */
+						} else {
+						        ast_log(LOG_ERROR, "First cadence position specified twice: %s\n",original_args);
+							cadence_is_ok = 0;
+							break;
+						}
 					}
 				}
 			}




More information about the svn-commits mailing list