[asterisk-commits] murf: trunk r70001 - in /trunk: channels/ configs/ doc/ include/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 19 12:07:28 CDT 2007


Author: murf
Date: Tue Jun 19 12:07:28 2007
New Revision: 70001

URL: http://svn.digium.com/view/asterisk?view=rev&rev=70001
Log:
These changes were submitted via bug 6683, to allow CID detection in India, with carriers that do Polarity/DTMF CID signalling.

Added:
    trunk/doc/India-CID.txt   (with props)
Modified:
    trunk/channels/chan_zap.c
    trunk/configs/zapata.conf.sample
    trunk/include/asterisk/callerid.h

Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=70001&r1=70000&r2=70001
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Tue Jun 19 12:07:28 2007
@@ -6398,7 +6398,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;
@@ -6644,6 +6644,45 @@
 				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;
+                                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. */
+                                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) {
@@ -6822,6 +6861,7 @@
 			} else
 				ast_log(LOG_WARNING, "Unable to get caller ID space\n");
 		}
+		}
 		else
 			cs = NULL;
 
@@ -6956,7 +6996,11 @@
 		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_detached(&threadid, NULL, 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);
@@ -7047,7 +7091,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",
@@ -11920,6 +11964,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: trunk/configs/zapata.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/zapata.conf.sample?view=diff&rev=70001&r1=70000&r2=70001
==============================================================================
--- trunk/configs/zapata.conf.sample (original)
+++ trunk/configs/zapata.conf.sample Tue Jun 19 12:07:28 2007
@@ -257,6 +257,9 @@
 ; 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; using DTMF.
+;                    (see doc/India-CID.txt)
 ;
 ;cidstart=ring
 ;

Added: trunk/doc/India-CID.txt
URL: http://svn.digium.com/view/asterisk/trunk/doc/India-CID.txt?view=auto&rev=70001
==============================================================================
--- trunk/doc/India-CID.txt (added)
+++ trunk/doc/India-CID.txt Tue Jun 19 12:07:28 2007
@@ -1,0 +1,75 @@
+India finds itself in a unique situation (hopefully). It has several 
+telephone line providers, and they are not all using the same CID 
+signalling; and the CID signalling is not like other countries. 
+
+In order to help those in India quickly find to the CID signalling
+system that their carrier uses (or range of them), and get the
+configs right with a minimal amount of experimentation, this file
+is provided. Not all carriers are covered, and not all mentioned
+below are complete. Those with updates to this table should post
+the new information on bug 6683 of the asterisk bug tracker.
+
+
+---------------------------------------------------------
+Provider: Bharti (is this BSNL?)
+Config: cidstart=polarity_in
+        cidsignalling=dtmf
+Results: ? (this should work), but needs to be tested?
+tested by:
+--------------------------------------------------------
+
+Provider: VSNL
+Config:
+
+Results: ?
+tested by:
+--------------------------------------------------------
+
+Provider: BSNL
+Config: cid_start=ring
+         cid_signalling=dtmf
+
+Results: ?
+tested by: (abhi)
+--------------------------------------------------------
+
+Provider: MTNL, old BSNL
+Config: cidsignalling = v23
+        cidstart=ring
+
+Results: works
+tested by: (enterux)
+--------------------------------------------------------
+
+Provider: MTNL (Delhi)
+Config: cidsignalling = v23
+        cidstart = ring
+
+cidsignalling = dtmf
+cidstart = polarity_IN
+
+cidsignalling = dtmf
+cidstart = polarity
+
+Results: fails
+tested by: brealer
+--------------------------------------------------------
+
+Provider: TATA
+Config: cidsignalling = dtmf
+        cidstart=polarity_IN
+
+Results: works
+tested by: brealer
+---------------------------------------------------------
+
+Asterisk still doesn't work with some of the CID scenarios in India.
+If you are in India, and not able to make CID work with any of the
+permutations of cidsignalling and cidstart, it could be that this
+particular situation is not covered by Asterisk. A good course of 
+action would be to get in touch with the provider, and find out from
+them exactly how their CID signalling works. Describe this to us,
+and perhaps someone will be able to extend the code to cover their
+signalling.
+
+

Propchange: trunk/doc/India-CID.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/doc/India-CID.txt
------------------------------------------------------------------------------
    svn:keywords = Author Id Date Revision

Propchange: trunk/doc/India-CID.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: trunk/include/asterisk/callerid.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/callerid.h?view=diff&rev=70001&r1=70000&r2=70001
==============================================================================
--- trunk/include/asterisk/callerid.h (original)
+++ trunk/include/asterisk/callerid.h Tue Jun 19 12:07:28 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