mirror of
https://github.com/asterisk/asterisk.git
synced 2025-12-05 12:41:49 +00:00
These changes were submitted via bug 6683, to allow CID detection in India, with carriers that do Polarity/DTMF CID signalling.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@70001 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -6398,7 +6398,7 @@ static void *ss_thread(void *data)
|
|||||||
/* If we want caller id, we're in a prering state due to a polarity reversal
|
/* 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,
|
* 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... */
|
* 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 set to use DTMF CID signalling, listen for DTMF */
|
||||||
if (p->cid_signalling == CID_SIG_DTMF) {
|
if (p->cid_signalling == CID_SIG_DTMF) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -6644,6 +6644,45 @@ static void *ss_thread(void *data)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else if (p->use_callerid && p->cid_start == CID_START_RING) {
|
} 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 */
|
/* FSK Bell202 callerID */
|
||||||
cs = callerid_new(p->cid_signalling);
|
cs = callerid_new(p->cid_signalling);
|
||||||
if (cs) {
|
if (cs) {
|
||||||
@@ -6822,6 +6861,7 @@ static void *ss_thread(void *data)
|
|||||||
} else
|
} else
|
||||||
ast_log(LOG_WARNING, "Unable to get caller ID space\n");
|
ast_log(LOG_WARNING, "Unable to get caller ID space\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cs = NULL;
|
cs = NULL;
|
||||||
|
|
||||||
@@ -6956,7 +6996,11 @@ static int handle_init_event(struct zt_pvt *i, int event)
|
|||||||
case SIG_SF_FEATB:
|
case SIG_SF_FEATB:
|
||||||
case SIG_SF:
|
case SIG_SF:
|
||||||
/* Check for callerid, digits, etc */
|
/* 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)) {
|
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);
|
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);
|
res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
|
||||||
@@ -7047,7 +7091,7 @@ static int handle_init_event(struct zt_pvt *i, int event)
|
|||||||
case SIG_FXSLS:
|
case SIG_FXSLS:
|
||||||
case SIG_FXSKS:
|
case SIG_FXSKS:
|
||||||
case SIG_FXSGS:
|
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;
|
i->polarity = POLARITY_REV;
|
||||||
ast_verbose(VERBOSE_PREFIX_2 "Starting post polarity "
|
ast_verbose(VERBOSE_PREFIX_2 "Starting post polarity "
|
||||||
"CID detection on channel %d\n",
|
"CID detection on channel %d\n",
|
||||||
@@ -11920,6 +11964,8 @@ static int process_zap(struct zt_chan_conf *confp, struct ast_variable *v, int r
|
|||||||
} else if (!strcasecmp(v->name, "cidstart")) {
|
} else if (!strcasecmp(v->name, "cidstart")) {
|
||||||
if (!strcasecmp(v->value, "ring"))
|
if (!strcasecmp(v->value, "ring"))
|
||||||
confp->chan.cid_start = CID_START_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"))
|
else if (!strcasecmp(v->value, "polarity"))
|
||||||
confp->chan.cid_start = CID_START_POLARITY;
|
confp->chan.cid_start = CID_START_POLARITY;
|
||||||
else if (ast_true(v->value))
|
else if (ast_true(v->value))
|
||||||
|
|||||||
@@ -257,6 +257,9 @@ usecallerid=yes
|
|||||||
; What signals the start of caller ID
|
; What signals the start of caller ID
|
||||||
; ring = a ring signals the start
|
; ring = a ring signals the start
|
||||||
; polarity = polarity reversal 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
|
;cidstart=ring
|
||||||
;
|
;
|
||||||
|
|||||||
75
doc/India-CID.txt
Normal file
75
doc/India-CID.txt
Normal file
@@ -0,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.
|
||||||
|
|
||||||
|
|
||||||
@@ -58,6 +58,7 @@
|
|||||||
|
|
||||||
#define CID_START_RING 1
|
#define CID_START_RING 1
|
||||||
#define CID_START_POLARITY 2
|
#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)))
|
#define AST_LIN2X(a) ((codec == AST_FORMAT_ALAW) ? (AST_LIN2A(a)) : (AST_LIN2MU(a)))
|
||||||
|
|||||||
Reference in New Issue
Block a user