[asterisk-commits] murf: branch murf/bug6683 r59255 - in /team/murf/bug6683: channels/ configs/ ...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Mar 27 08:40:12 MST 2007


Author: murf
Date: Tue Mar 27 10:40:11 2007
New Revision: 59255

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59255
Log:
a small change to confine the PRERING change to just those who want it for India.

Modified:
    team/murf/bug6683/channels/chan_zap.c
    team/murf/bug6683/configs/zapata.conf.sample
    team/murf/bug6683/include/asterisk/callerid.h

Modified: team/murf/bug6683/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6683/channels/chan_zap.c?view=diff&rev=59255&r1=59254&r2=59255
==============================================================================
--- team/murf/bug6683/channels/chan_zap.c (original)
+++ team/murf/bug6683/channels/chan_zap.c Tue Mar 27 10:40:11 2007
@@ -6402,7 +6402,7 @@
 		/* If we want caller id, we're in a prering state due to a polarity reversal
 		 * and we're set to use a polarity reversal to trigger the start of caller id,
 		 * grab the caller id and wait for ringing to start... */
-		} else if (p->use_callerid && (chan->_state == AST_STATE_PRERING && p->cid_start == CID_START_POLARITY)) {
+		} else if (p->use_callerid && (chan->_state == AST_STATE_PRERING && (p->cid_start == CID_START_POLARITY || p->cid_start == CID_START_POLARITY_IN))) {
 			/* If set to use DTMF CID signalling, listen for DTMF */
 			if (p->cid_signalling == CID_SIG_DTMF) {
 				int i = 0;
@@ -6652,6 +6652,48 @@
 				return NULL;
 			}
 		} else if (p->use_callerid && p->cid_start == CID_START_RING) {
+                        if (p->cid_signalling == CID_SIG_DTMF) {
+                                int i = 0;
+                                cs = NULL;
+                                ast_log(LOG_DEBUG, "Receiving DTMF cid on "
+                                                "channel %s\n", chan->name);
+                                zt_setlinear(p->subs[index].zfd, 0);
+                                res = 2000;
+                                for (;;) {
+                                        struct ast_frame *f;
+                                        res = ast_waitfor(chan, res);
+                                        if (res <= 0) {
+                                                ast_log(LOG_WARNING, "DTMFCID timed out waiting for ring. "
+                                                                "Exiting simple switch\n");
+                                                ast_hangup(chan);
+                                                return NULL;
+                                        }
+                                        f = ast_read(chan);
+                                        if (f->frametype == AST_FRAME_DTMF) {
+                                                dtmfbuf[i++] = f->subclass;
+                                                ast_log(LOG_DEBUG, "CID got digit '%c'\n", f->subclass);
+                                                res = 2000;
+                                        }
+                                        ast_frfree(f);
+
+                                        if (p->ringt_base == p->ringt)
+                                                break;
+
+                                }
+                                dtmfbuf[i] = '\0';
+                                zt_setlinear(p->subs[index].zfd, p->subs[index].linear);
+                                /* Got cid and ring. */
+                                ast_log(LOG_DEBUG, "CID got string '%s'\n", dtmfbuf);
+                                callerid_get_dtmf(dtmfbuf, dtmfcid, &flags);
+                                ast_log(LOG_DEBUG, "CID is '%s', flags %d\n",
+                                                dtmfcid, flags);
+                                /* If first byte is NULL, we have no cid */
+                                if (!ast_strlen_zero(dtmfcid))
+                                        number = dtmfcid;
+                                else
+                                        number = NULL;
+                                /* If set to use V23 Signalling, launch our FSK gubbins and listen for it */
+                        } else {
 			/* FSK Bell202 callerID */
 			cs = callerid_new(p->cid_signalling);
 			if (cs) {
@@ -6831,6 +6873,7 @@
 			} else
 				ast_log(LOG_WARNING, "Unable to get caller ID space\n");
 		}
+		}
 		else
 			cs = NULL;
 
@@ -6967,7 +7010,10 @@
 		case SIG_SF_FEATB:
 		case SIG_SF:
 				/* Check for callerid, digits, etc */
-				chan = zt_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0);
+				if (i->cid_start == CID_START_POLARITY_IN)
+					chan = zt_new(i, AST_STATE_PRERING, 0, SUB_REAL, 0, 0);
+				else
+					chan = zt_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0);
 				if (chan && ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
 					ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
 					res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
@@ -7058,7 +7104,7 @@
 		case SIG_FXSLS:
 		case SIG_FXSKS:
 		case SIG_FXSGS:
-			if (i->cid_start == CID_START_POLARITY) {
+			if (i->cid_start == CID_START_POLARITY || i->cid_start == CID_START_POLARITY_IN) {
 				i->polarity = POLARITY_REV;
 				ast_verbose(VERBOSE_PREFIX_2 "Starting post polarity "
 					    "CID detection on channel %d\n",
@@ -11854,6 +11900,8 @@
 		} else if (!strcasecmp(v->name, "cidstart")) {
 			if (!strcasecmp(v->value, "ring"))
 				confp->chan.cid_start = CID_START_RING;
+			else if (!strcasecmp(v->value, "polarity_in"))
+				confp->chan.cid_start = CID_START_POLARITY_IN;
 			else if (!strcasecmp(v->value, "polarity"))
 				confp->chan.cid_start = CID_START_POLARITY;
 			else if (ast_true(v->value))

Modified: team/murf/bug6683/configs/zapata.conf.sample
URL: http://svn.digium.com/view/asterisk/team/murf/bug6683/configs/zapata.conf.sample?view=diff&rev=59255&r1=59254&r2=59255
==============================================================================
--- team/murf/bug6683/configs/zapata.conf.sample (original)
+++ team/murf/bug6683/configs/zapata.conf.sample Tue Mar 27 10:40:11 2007
@@ -257,6 +257,7 @@
 ; What signals the start of caller ID
 ;     ring     = a ring signals the start
 ;     polarity = polarity reversal signals the start
+;     polarity_IN = polarity reversal signals the start, for India, for dtmf dialtone detection
 ;
 ;cidstart=ring
 ;

Modified: team/murf/bug6683/include/asterisk/callerid.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug6683/include/asterisk/callerid.h?view=diff&rev=59255&r1=59254&r2=59255
==============================================================================
--- team/murf/bug6683/include/asterisk/callerid.h (original)
+++ team/murf/bug6683/include/asterisk/callerid.h Tue Mar 27 10:40:11 2007
@@ -58,6 +58,7 @@
 
 #define CID_START_RING	1
 #define CID_START_POLARITY 2
+#define CID_START_POLARITY_IN 3
 
 
 #define AST_LIN2X(a) ((codec == AST_FORMAT_ALAW) ? (AST_LIN2A(a)) : (AST_LIN2MU(a)))



More information about the asterisk-commits mailing list