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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 8 16:14:55 CDT 2009


Author: jpeeler
Date: Wed Jul  8 16:14:51 2009
New Revision: 205408

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205408
Log:
check in some working ring detection when using bell202 caller id

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=205408&r1=205407&r2=205408
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/chan_dahdi.c Wed Jul  8 16:14:51 2009
@@ -1591,8 +1591,9 @@
 			}
 		}
 
-		if (analog_p->ringt)
+		if (analog_p->ringt) {
 			analog_p->ringt--;
+		}
 		if (analog_p->ringt == 1) {
 			return -1;
 		}
@@ -1621,7 +1622,7 @@
 	}
 
 	*ev = ANALOG_EVENT_NONE;
-	return 1;
+	return 2;
 }
 
 static const char *event2str(int event);
@@ -7449,7 +7450,12 @@
 				ast_mutex_unlock(&p->lock);
 				return &p->subs[idx].f;
 			} else if (errno == ELAST) {
-				f = __dahdi_exception(ast);
+				if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
+					struct analog_pvt *analog_p = p->sig_pvt;
+					f = analog_exception(analog_p, ast);
+				} else {
+					f = __dahdi_exception(ast);
+				}
 			} else
 				ast_log(LOG_WARNING, "dahdi_rec: %s\n", strerror(errno));
 		}
@@ -7458,7 +7464,12 @@
 	}
 	if (res != (p->subs[idx].linear ? READ_SIZE * 2 : READ_SIZE)) {
 		ast_debug(1, "Short read (%d/%d), must be an event...\n", res, p->subs[idx].linear ? READ_SIZE * 2 : READ_SIZE);
-		f = __dahdi_exception(ast);
+		if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
+			struct analog_pvt *analog_p = p->sig_pvt;
+			f = analog_exception(analog_p, ast);
+		} else {
+			f = __dahdi_exception(ast);
+		}
 		ast_mutex_unlock(&p->lock);
 		return f;
 	}
@@ -9059,8 +9070,9 @@
 								}
 								break;
 							}
-							if (p->ringt)
+							if (p->ringt) {
 								p->ringt--;
+							}
 							if (p->ringt == 1) {
 								res = -1;
 								break;
@@ -10987,7 +10999,7 @@
 				tmp->callwaitingcallerid = analog_p->callwaitingcallerid = 1;
 				analog_p->usedistinctiveringdetection = conf->chan.usedistinctiveringdetection;
 				analog_p->ringt = conf->chan.ringt;
-				analog_p->ringt_base = conf->chan.ringt_base;
+				analog_p->ringt_base = ringt_base;
 	
 				ast_copy_string(analog_p->mohsuggest, conf->chan.mohsuggest, sizeof(analog_p->mohsuggest));
 				ast_copy_string(analog_p->cid_num, conf->chan.cid_num, sizeof(analog_p->cid_num));

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=205408&r1=205407&r2=205408
==============================================================================
--- team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c (original)
+++ team/jpeeler/asterisk-sigwork-trunk/channels/sig_analog.c Wed Jul  8 16:14:51 2009
@@ -2002,28 +2002,33 @@
 						break;
 					}
 
-					if (res == 1) {
+					if (res == 1 || res == 2) {
 						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);
 							goto quit;
-						} else if (ev != ANALOG_EVENT_NONE) {
-							break;
+						} //else if (ev != ANALOG_EVENT_NONE) { 
+//							break;
+//						}
+						if (res != 2) {
+							/* Let us detect callerid when the telco uses distinctive ring */
+							curRingData[receivedRingT] = p->ringt;
+
+							if (p->ringt < p->ringt_base/2) {
+								break;
+							}
+							/* Increment the ringT counter so we can match it against
+							   values in chan_dahdi.conf for distinctive ring */
+							if (++receivedRingT == ARRAY_LEN(curRingData)) {
+								break;
+							}
 						}
-						/* Let us detect callerid when the telco uses distinctive ring */
-						curRingData[receivedRingT] = p->ringt;
-
-						if (p->ringt < p->ringt_base/2)
-							break;
-						/* Increment the ringT counter so we can match it against
-						   values in chan_dahdi.conf for distinctive ring */
-						if (++receivedRingT == ARRAY_LEN(curRingData))
-							break;
-					}
-
-					if (ast_tvdiff_ms(ast_tvnow(), start) > timeout)
+					}
+
+					if (ast_tvdiff_ms(ast_tvnow(), start) > timeout) {
 						break;
+					}
 
 				}
 				name = namebuf;




More information about the asterisk-commits mailing list