From 063d622d53ff5e7818ee75658ba8539016788941 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Thu, 21 May 2009 19:11:39 +0200 Subject: [PATCH] Fixed disabling of DTMF using 'n' option of chan_lcr. Please enter the commit message for your changes. modified: README modified: apppbx.cpp modified: bchannel.c modified: chan_lcr.c modified: chan_lcr.h --- README | 1 + apppbx.cpp | 2 +- bchannel.c | 2 +- chan_lcr.c | 21 +++++++++++++-------- chan_lcr.h | 6 ++---- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/README b/README index 0857d0b..6603931 100644 --- a/README +++ b/README @@ -501,5 +501,6 @@ Changes after Version 1.5 - Debug option now works for GSM. - Fixed some GSM information elements. - OpenBSC api changes. +- Fixed disabling of DTMF using 'n' option of chan_lcr. diff --git a/apppbx.cpp b/apppbx.cpp index a64467e..fc50737 100644 --- a/apppbx.cpp +++ b/apppbx.cpp @@ -3268,7 +3268,7 @@ void EndpointAppPBX::ea_message_join(unsigned int join_id, int message_type, uni join_notify(portlist, message_type, param); break; - /* JOIN wants keypad / dtml */ + /* JOIN wants keypad / dtmf */ case MESSAGE_ENABLEKEYPAD: PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint with terminal '%s' (caller id '%s') received keypad enable request.\n", ea_endpoint->ep_serial, e_ext.number, e_callerinfo.id); e_enablekeypad = 1; diff --git a/bchannel.c b/bchannel.c index 187409f..0cba9db 100644 --- a/bchannel.c +++ b/bchannel.c @@ -483,7 +483,7 @@ void bchannel_dtmf(struct bchannel *bchannel, int on) int sock; sock = bchannel->b_sock; - bchannel->b_dtmf = 1; + bchannel->b_dtmf = on; if (bchannel->b_state == BSTATE_ACTIVE && bchannel->b_mode == 0) ph_control(sock, on?DTMF_TONE_START:DTMF_TONE_STOP, 0, "DSP-DTMF", 1, bchannel->b_mode); } diff --git a/chan_lcr.c b/chan_lcr.c index 00c27f8..4560651 100644 --- a/chan_lcr.c +++ b/chan_lcr.c @@ -414,7 +414,11 @@ void apply_opt(struct chan_call *call, char *data) break; } CDEBUG(call, call->ast, "Option 'n' (no DTMF).\n"); - call->no_dtmf = 1; + if (call->dsp_dtmf) { + call->dsp_dtmf = 0; + if (call->bchannel) + bchannel_dtmf(call->bchannel, 0); + } break; case 'c': if (opt[1] == '\0') { @@ -1158,6 +1162,11 @@ void lcr_in_dtmf(struct chan_call *call, int val) if (!call->pbx_started) return; + if (!call->dsp_dtmf) { + CDEBUG(call, call->ast, "Recognised DTMF digit '%c', but ignoring. This is fixed in later mISDN driver.\n", val); + return; + } + CDEBUG(call, call->ast, "Recognised DTMF digit '%c'.\n", val); digit[0] = val; digit[1] = '\0'; @@ -1205,7 +1214,6 @@ int receive_message(int message_type, unsigned int ref, union parameter *param) memcpy(bchannel->b_bf_key, param->bchannel.crypt, param->bchannel.crypt_len); } bchannel->b_txdata = 0; - bchannel->b_dtmf = 1; bchannel->b_tx_dejitter = 1; /* in case, ref is not set, this bchannel instance must @@ -1216,7 +1224,7 @@ int receive_message(int message_type, unsigned int ref, union parameter *param) { bchannel->call = call; call->bchannel = bchannel; - if (call->dtmf) + if (call->dsp_dtmf) bchannel_dtmf(bchannel, 1); if (call->bf_len) bchannel_blowfish(bchannel, call->bf_key, call->bf_len); @@ -1289,6 +1297,8 @@ int receive_message(int message_type, unsigned int ref, union parameter *param) /* set ref */ call->ref = ref; call->ref_was_assigned = 1; + /* set dtmf (default, use option 'n' to disable */ + call->dsp_dtmf = 1; /* wait for setup (or release from asterisk) */ } else { @@ -2065,11 +2075,6 @@ static int lcr_answer(struct ast_channel *ast) /* enable keypad */ // memset(&newparam, 0, sizeof(union parameter)); // send_message(MESSAGE_ENABLEKEYPAD, call->ref, &newparam); - /* enable dtmf */ - if (call->no_dtmf) - CDEBUG(call, ast, "DTMF is disabled by option.\n"); - else - call->dtmf = 1; ast_mutex_unlock(&chan_lock); return 0; diff --git a/chan_lcr.h b/chan_lcr.h index 5ddb4eb..60a64fd 100644 --- a/chan_lcr.h +++ b/chan_lcr.h @@ -50,10 +50,8 @@ struct chan_call { char cid_rdnis[64]; /* cached cid for setup */ char display[128]; /* display for setup */ - int dtmf; - /* shall dtmf be enabled */ - int no_dtmf; - /* dtmf disabled by option */ + int dsp_dtmf; + /* decode dtmf by dsp */ int inband_dtmf; /* generate dtmf tones, if requested by asterisk */ int rebuffer; /* send only 160 bytes frames -- 2.13.6