aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b>2005-09-01 19:02:37 +0000
committermattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b>2005-09-01 19:02:37 +0000
commitd6d95933f0ed40461173549261f618150045be1f (patch)
treef351be6bc4f66dcea1b7c50c7c71dccef555b532 /channels
parent0970909dc00ea8fd43a83a5c7d7ddd37ab771d66 (diff)
New, more robust way of doing e&m digit collection. Bug #3805
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6483 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_zap.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index aaae4e806..f84da6369 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -166,8 +166,6 @@ static const char config[] = "zapata.conf";
#define DCHAN_AVAILABLE (DCHAN_PROVISIONED | DCHAN_NOTINALARM | DCHAN_UP)
-static int cur_emdigitwait = 250; /* Wait time in ms for digits on EM channel */
-
static char context[AST_MAX_CONTEXT] = "default";
static char cid_num[256] = "";
static char cid_name[256] = "";
@@ -640,7 +638,6 @@ static struct zt_pvt {
int cidrings; /* Which ring to deliver CID on */
int dtmfrelax; /* whether to run in relaxed DTMF mode */
int fake_event;
- int emdigitwait;
int polarityonanswerdelay;
struct timeval polaritydelaytv;
int sendcalleridafter;
@@ -5180,8 +5177,25 @@ static void *ss_thread(void *data)
if ((res < 1) && (p->dsp)) ast_dsp_digitreset(p->dsp);
break;
default:
- /* If we got it, get the rest */
- res = my_getsigstr(chan,dtmfbuf + 1,' ', p->emdigitwait);
+ /* If we got the first digit, get the rest */
+ len = 1;
+ while((len < AST_MAX_EXTENSION-1) && ast_matchmore_extension(chan, chan->context, dtmfbuf, 1, p->cid_num)) {
+ if (ast_exists_extension(chan, chan->context, dtmfbuf, 1, p->cid_num)) {
+ timeout = matchdigittimeout;
+ } else {
+ timeout = gendigittimeout;
+ }
+ res = ast_waitfordigit(chan, timeout);
+ if (res < 0) {
+ ast_log(LOG_DEBUG, "waitfordigit returned < 0...\n");
+ ast_hangup(chan);
+ return NULL;
+ } else if (res) {
+ dtmfbuf[len++] = res;
+ } else {
+ break;
+ }
+ }
break;
}
}
@@ -6962,7 +6976,6 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_p
tmp->use_callingpres = use_callingpres;
tmp->priindication_oob = priindication_oob;
tmp->priexclusive = cur_priexclusive;
- tmp->emdigitwait = cur_emdigitwait;
if (tmp->usedistinctiveringdetection) {
if (!tmp->use_callerid) {
ast_log(LOG_NOTICE, "Distinctive Ring detect requires 'usecallerid' be on\n");
@@ -10594,8 +10607,6 @@ static int setup_zap(int reload)
cur_rxflash = atoi(v->value);
} else if (!strcasecmp(v->name, "debounce")) {
cur_debounce = atoi(v->value);
- } else if (!strcasecmp(v->name, "emdigitwait")) {
- cur_emdigitwait = atoi(v->value);
} else if (!strcasecmp(v->name, "toneduration")) {
int toneduration;
int ctlfd;