[asterisk-commits] jpeeler: branch jpeeler/asterisk-sigwork-trunk r193346 - /team/jpeeler/asteri...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 8 12:22:28 CDT 2009


Author: jpeeler
Date: Fri May  8 12:22:24 2009
New Revision: 193346

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=193346
Log:
make cid detection failures a little more graceful, fix small build error

Modified:
    team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c
    team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c?view=diff&rev=193346&r1=193345&r2=193346
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c Fri May  8 12:22:24 2009
@@ -1551,13 +1551,13 @@
 {
 	struct dahdi_pvt *p = pvt;
 	int index = SUB_REAL;
+	p->cs = callerid_new(cid_signalling);
+	if (!p->cs) {
+		ast_log(LOG_ERROR, "Unable to alloc callerid\n");
+		return -1;
+	}
 	bump_gains(p);
 	dahdi_setlinear(p->subs[index].dfd, 0);
-	p->cs = callerid_new(cid_signalling);
-	if (!p->cs) {
-		ast_log(LOG_ERROR, "Unable toalloc callerid\n");
-		return -1;
-	}
 
 	return 0;
 		

Modified: team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c?view=diff&rev=193346&r1=193345&r2=193346
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c Fri May  8 12:22:24 2009
@@ -1969,33 +1969,33 @@
 			namebuf[0] = 0;
 			numbuf[0] = 0;
 
-			analog_start_cid_detect(p, p->cid_signalling);
-			while (1) {
-				res = analog_get_callerid(p, namebuf, numbuf, &ev, timeout - ast_tvdiff_ms(ast_tvnow(), start));
-
-				if (res == 0) {
-					break;
-				}
-
-				if (res == 1) {
-					if (ev == ANALOG_EVENT_POLARITY && p->hanguponpolarityswitch && p->polarity == POLARITY_REV) {
-						ast_debug(1, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel);
-						p->polarity = POLARITY_IDLE;
-						ast_hangup(chan);
-						return NULL;
-					} else if (ev != ANALOG_EVENT_NONE) {
+			if (!analog_start_cid_detect(p, p->cid_signalling)) {
+				while (1) {
+					res = analog_get_callerid(p, namebuf, numbuf, &ev, timeout - ast_tvdiff_ms(ast_tvnow(), start));
+
+					if (res == 0) {
 						break;
 					}
-				}
-
-				if (ast_tvdiff_ms(ast_tvnow(), start) > timeout)
-					break;
-
-			}
-			name = namebuf;
-			number = numbuf;
-
-			analog_stop_cid_detect(p);
+
+					if (res == 1) {
+						if (ev == ANALOG_EVENT_POLARITY && p->hanguponpolarityswitch && p->polarity == POLARITY_REV) {
+							ast_debug(1, "Hanging up due to polarity reversal on channel %d while detecting callerid\n", p->channel);
+							p->polarity = POLARITY_IDLE;
+							ast_hangup(chan);
+							return NULL;
+						} else if (ev != ANALOG_EVENT_NONE) {
+							break;
+						}
+					}
+
+					if (ast_tvdiff_ms(ast_tvnow(), start) > timeout)
+						break;
+
+				}
+				name = namebuf;
+				number = numbuf;
+
+				analog_stop_cid_detect(p);
 
 #if 0
 			/* XXX */
@@ -2097,6 +2097,8 @@
 			} else
 				ast_log(LOG_WARNING, "Unable to get caller ID space\n");
 #endif
+			} else
+				ast_log(LOG_WARNING, "Unable to get caller ID space\n");
 		}
 		else
 			cs = NULL;
@@ -2937,7 +2939,6 @@
 
 	ast_debug(1, "channel (%d) - signaling (%d) - event (%s)\n", 
 				i->channel, i->sig, analog_event2str(event));
-	}
 
 	pthread_attr_init(&attr);
 	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);




More information about the asterisk-commits mailing list