aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2010-04-29 22:11:47 +0000
committerrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2010-04-29 22:11:47 +0000
commitd337ca36324d17c3507a9cd25b68a1c1a4dca03f (patch)
treef51e535e74ecd28779cd4a9beeb7237a3b17c713
parent939a1c2fa5fd72eae67af43385c2f10dc63c1635 (diff)
DTMF CallerID detection problems.
The code handling DTMF CallerID drops digits on long CallerID numbers and may timeout waiting for the first ring with shorter numbers. The DTMF emulation mode was not turned off when processing DTMF CallerID. When the emulation code gets behind in processing the DTMF digits it can skip a digit. For shorter numbers, the timeout may have been too short. I increased it from 2 seconds to 4 seconds. Four seconds is a typical time between rings for many countries. (closes issue #16460) Reported by: sum Patches: issue16460.patch uploaded by rmudgett (license 664) issue16460_v1.6.2.patch uploaded by rmudgett (license 664) Tested by: sum, rmudgett Review: https://reviewboard.asterisk.org/r/634/ JIRA SWP-562 JIRA AST-334 JIRA SWP-901 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@260195 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_dahdi.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 28bdebe28..7d5ec489b 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -6589,14 +6589,25 @@ static void *ss_thread(void *data)
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);
+ ast_log(LOG_DEBUG, "Receiving DTMF cid on channel %s\n", chan->name);
dahdi_setlinear(p->subs[index].dfd, 0);
- res = 2000;
+ /*
+ * We are the only party interested in the Rx stream since
+ * we have not answered yet. We don't need or even want DTMF
+ * emulation. The DTMF digits can come so fast that emulation
+ * can drop some of them.
+ */
+ ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
+ res = 4000;/* This is a typical OFF time between rings. */
for (;;) {
struct ast_frame *f;
res = ast_waitfor(chan, res);
if (res <= 0) {
+ /*
+ * We do not need to restore the dahdi_setlinear()
+ * or AST_FLAG_END_DTMF_ONLY flag settings since we
+ * are hanging up the channel.
+ */
ast_log(LOG_WARNING, "DTMFCID timed out waiting for ring. "
"Exiting simple switch\n");
ast_hangup(chan);
@@ -6606,22 +6617,24 @@ static void *ss_thread(void *data)
if (!f)
break;
if (f->frametype == AST_FRAME_DTMF) {
- dtmfbuf[i++] = f->subclass;
+ if (i < ARRAY_LEN(dtmfbuf) - 1) {
+ dtmfbuf[i++] = f->subclass;
+ }
ast_log(LOG_DEBUG, "CID got digit '%c'\n", f->subclass);
- res = 2000;
+ res = 4000;/* This is a typical OFF time between rings. */
}
ast_frfree(f);
if (chan->_state == AST_STATE_RING ||
chan->_state == AST_STATE_RINGING)
break; /* Got ring */
}
+ ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
dtmfbuf[i] = '\0';
dahdi_setlinear(p->subs[index].dfd, 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);
+ 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;
@@ -6706,13 +6719,10 @@ static void *ss_thread(void *data)
if (p->cid_signalling == CID_SIG_V23_JP) {
res = dahdi_set_hook(p->subs[SUB_REAL].dfd, DAHDI_ONHOOK);
usleep(1);
- res = 4000;
- } else {
-
- /* Finished with Caller*ID, now wait for a ring to make sure there really is a call coming */
- res = 2000;
}
+ /* Finished with Caller*ID, now wait for a ring to make sure there really is a call coming */
+ res = 4000;/* This is a typical OFF time between rings. */
for (;;) {
struct ast_frame *f;
res = ast_waitfor(chan, res);