From 4bc1b731cb36369d27983fd166558915fbe358ba Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Sun, 13 Jul 2014 02:46:28 -0400 Subject: [PATCH] freetdm: ftdmod_gsm: Allow hwdtmf parameter to accept detect or generate You can now enable the hardware dtmf detection and/or generation --- libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c | 25 +++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c index c89e3ae520..b1c762f27c 100755 --- a/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c +++ b/libs/freetdm/src/ftmod/ftmod_gsm/ftmod_gsm.c @@ -913,6 +913,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) ftdm_channel_t *ftdmchan = NULL; ftdm_channel_t *dchan = NULL; ftdm_channel_t *bchan = NULL; + ftdm_bool_t hwdtmf_detect = FTDM_FALSE; + ftdm_bool_t hwdtmf_generate = FTDM_FALSE; unsigned paramindex = 0; const char *var = NULL; @@ -999,8 +1001,15 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) span_config.debug_mask = wat_str2debug(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring GSM span %s with debug mask %s == 0x%X\n", span->name, val, span_config.debug_mask); } else if (!strcasecmp(var, "hwdtmf")) { - if (ftdm_true(val)) { - span_config.hardware_dtmf = WAT_TRUE; + hwdtmf_detect = FTDM_FALSE; + hwdtmf_generate = FTDM_FALSE; + if (!strcasecmp(val, "generate")) { + hwdtmf_generate = FTDM_TRUE; + } else if (!strcasecmp(val, "detect")) { + hwdtmf_detect = FTDM_TRUE; + } else if (!strcasecmp(val, "both") || ftdm_true(val)) { + hwdtmf_detect = FTDM_TRUE; + hwdtmf_generate = FTDM_TRUE; } else { span_config.hardware_dtmf = WAT_FALSE; } @@ -1015,11 +1024,15 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_gsm_configure_span_signaling) span->stop = ftdm_gsm_stop; span->sig_read = NULL; span->sig_write = NULL; - if (span_config.hardware_dtmf == WAT_TRUE) { - span->sig_send_dtmf = ftdm_gsm_send_dtmf; - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SIG_DTMF_DETECTION); + if (hwdtmf_detect || hwdtmf_generate) { + span_config.hardware_dtmf = WAT_TRUE; + if (hwdtmf_generate) { + span->sig_send_dtmf = ftdm_gsm_send_dtmf; + } + if (hwdtmf_detect) { + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SIG_DTMF_DETECTION); + } } - span->signal_cb = sig_cb; span->signal_type = FTDM_SIGTYPE_GSM; span->signal_data = gsm_data;