diff --git a/src/channels/chan_voicemngr.c b/src/channels/chan_voicemngr.c index 725462786d9f60b297bd725810dd247e17e14f4f..196913f29733635b7a242fad38bdc000ff26eae2 100644 --- a/src/channels/chan_voicemngr.c +++ b/src/channels/chan_voicemngr.c @@ -2581,11 +2581,13 @@ void handle_dtmf_calling(struct chan_voicemngr_subchannel *sub) int dtmfbuf_len = strlen(p->dtmfbuf); char dtmf_last_char = p->dtmfbuf[(dtmfbuf_len - 1)]; char dtmf_one_before_last_char = p->dtmfbuf[(dtmfbuf_len > 1 ? dtmfbuf_len - 2 : 0)]; - + + sub->direct_extension = 0; if (ast_exists_extension(NULL, p->context_direct, p->dtmfbuf, 1, p->cid_num) && !ast_matchmore_extension(NULL, p->context_direct, p->dtmfbuf, 1, p->cid_num)) { //We have a full match in the "direct" context, so have asterisk place a call immediately ast_debug(9, "Direct extension matching %s found\n", p->dtmfbuf); + sub->direct_extension = 1; chan_voicemngr_start_calling(sub, p->context_direct); } @@ -3119,7 +3121,7 @@ static void handle_dtmf(enum LINE_EVENT event, if (p->dtmf_first < 0) { p->dtmf_first = dtmf_button; ast_debug(9,"Pressed DTMF %s\n", dtmfMap->name); - if (owner && chan_voicemngr_should_relay_dtmf(sub) && (sub->dtmf_mode == AST_SIP_DTMF_INFO || sub->conference_initiator == 1)) { + if (owner && chan_voicemngr_should_relay_dtmf(sub) && (sub->dtmf_mode == AST_SIP_DTMF_INFO || sub->conference_initiator == 1 || sub->direct_extension == 1)) { // INCALL send_outgoing_dtmf(owner, dtmf_button, AST_FRAME_DTMF_BEGIN); } @@ -3171,7 +3173,7 @@ static void handle_dtmf(enum LINE_EVENT event, ast_queue_frame(owner, &f); } } else { - if (owner && (sub->dtmf_mode == AST_SIP_DTMF_INFO || sub->conference_initiator == 1)) { + if (owner && (sub->dtmf_mode == AST_SIP_DTMF_INFO || sub->conference_initiator == 1 || sub->direct_extension)) { // INCALL send_outgoing_dtmf(owner, dtmf_button, AST_FRAME_DTMF_END); } @@ -3877,6 +3879,7 @@ static struct chan_voicemngr_pvt *chan_voicemngr_allocate_pvt(void) sub->sip_client_id = -1; sub->period = default_ptime; // 20 ms sub->dtmf_mode = AST_SIP_DTMF_RFC_4733; + sub->direct_extension = 0; sub->conference_initiator = 0; tmp->sub[i] = sub; sub->ingressRtcpPackets = 0; @@ -5764,6 +5767,7 @@ static int chan_voicemngr_close_connection(struct chan_voicemngr_subchannel *sub sub->codec = -1; sub->call_id = CALLID_INVALID; sub->updated_codec = 0; + sub->direct_extension = 0; ast_debug(1, "Virtual Asterisk connection %d/%d destroyed\n", p->line_id, sub->connection_id); } diff --git a/src/channels/chan_voicemngr.h b/src/channels/chan_voicemngr.h index a024544b93251552c178f3923d726e4a2830ee80..1884723f5ce71d98584122acb380d8ec8a4fdec1 100644 --- a/src/channels/chan_voicemngr.h +++ b/src/channels/chan_voicemngr.h @@ -189,6 +189,7 @@ struct chan_voicemngr_subchannel { int updated_codec; int sip_client_id; /* The SIP client used for the current call: -1 = not set, 0 = internal call, 1..MAX_SIP_CLIENTS = sip client id*/ int congestion_timer_id; + int direct_extension; }; struct chan_voicemngr_channel_tech {