diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index ec6c2fb757..099035409f 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3457,7 +3457,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co ftdmchan->dtmf_on = val; GOTO_STATUS(done, FTDM_SUCCESS); } else { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "invalid value %d range 10-1000", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "invalid value %d range 10-1000", val); GOTO_STATUS(done, FTDM_FAIL); } } @@ -3471,7 +3471,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co ftdmchan->dtmf_off = val; GOTO_STATUS(done, FTDM_SUCCESS); } else { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "invalid value %d range 10-1000", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "invalid value %d range 10-1000", val); GOTO_STATUS(done, FTDM_FAIL); } } @@ -5108,6 +5108,12 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_channels(ftdm_span_t *span, const if (chan_config->dtmf_on_start) { span->channels[chan_index]->dtmfdetect.trigger_on_start = 1; } + if (chan_config->dtmf_time_on) { + ftdm_channel_command(span->channels[chan_index], FTDM_COMMAND_SET_DTMF_ON_PERIOD, &chan_config->dtmf_time_on); + } + if (chan_config->dtmf_time_off) { + ftdm_channel_command(span->channels[chan_index], FTDM_COMMAND_SET_DTMF_OFF_PERIOD, &chan_config->dtmf_time_off); + } } return FTDM_SUCCESS; @@ -5347,6 +5353,14 @@ static ftdm_status_t load_config(void) chan_config.dtmf_on_start = FTDM_FALSE; } } + } else if (!strcasecmp(var, "dtmf_time_on")) { + if (sscanf(val, "%u", &(chan_config.dtmf_time_on)) != 1) { + ftdm_log(FTDM_LOG_ERROR, "invalid dtmf_time_on: '%s'\n", val); + } + } else if (!strcasecmp(var, "dtmf_time_off")) { + if (sscanf(val, "%u", &(chan_config.dtmf_time_off)) != 1) { + ftdm_log(FTDM_LOG_ERROR, "invalid dtmf_time_off: '%s'\n", val); + } } else if (!strncasecmp(var, "iostats", sizeof("iostats")-1)) { if (ftdm_true(val)) { chan_config.iostats = FTDM_TRUE; diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 2b29d4f396..443afc7fd0 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -521,6 +521,8 @@ typedef struct ftdm_channel_config { uint8_t debugdtmf; uint8_t dtmf_on_start; uint32_t dtmfdetect_ms; + uint32_t dtmf_time_on; + uint32_t dtmf_time_off; uint8_t iostats; } ftdm_channel_config_t;