diff options
author | mattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-05-16 18:48:09 +0000 |
---|---|---|
committer | mattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-05-16 18:48:09 +0000 |
commit | 957e90f828c220e2f46bd617582ba7f6ef183819 (patch) | |
tree | d945e64c4c3445b2dbb566fa816dc73c09636fbc /channels/chan_zap.c | |
parent | 4c3b9d9b2cead8b78d5b5d595e1e4be45eeb1139 (diff) |
Additions to chan_zap.c to receive PRI_EVENT_KEYPAD_DIGIT properly. Bug #4286
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5704 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_zap.c')
-rwxr-xr-x | channels/chan_zap.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 5bd6025c4..f144b9def 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -7847,6 +7847,34 @@ static void *pri_dchannel(void *vpri) } } break; + case PRI_EVENT_KEYPAD_DIGIT: + chanpos = pri_find_principle(pri, e->digit.channel); + if (chanpos < 0) { + ast_log(LOG_WARNING, "KEYPAD_DIGITs received on unconfigured channel %d/%d span %d\n", + PRI_SPAN(e->digit.channel), PRI_CHANNEL(e->digit.channel), pri->span); + } else { + chanpos = pri_fixup_principle(pri, chanpos, e->digit.call); + if (chanpos > -1) { + ast_mutex_lock(&pri->pvts[chanpos]->lock); + /* queue DTMF frame if the PBX for this call was already started (we're forwarding KEYPAD_DIGITs further on */ + if (pri->overlapdial && pri->pvts[chanpos]->call==e->digit.call && pri->pvts[chanpos]->owner) { + /* how to do that */ + int digitlen = strlen(e->digit.digits); + char digit; + int i; + for (i=0; i<digitlen; i++) { + digit = e->digit.digits[i]; + { + struct ast_frame f = { AST_FRAME_DTMF, digit, }; + zap_queue_frame(pri->pvts[chanpos], &f, pri); + } + } + } + ast_mutex_unlock(&pri->pvts[chanpos]->lock); + } + } + break; + case PRI_EVENT_INFO_RECEIVED: chanpos = pri_find_principle(pri, e->ring.channel); if (chanpos < 0) { |