forked from Mirrors/freeswitch
freetdm: Added dtmf_time_on and dtmf_time_off parameters to tweak DTMF duration in milliseconds
This commit is contained in:
parent
b80cdd45d5
commit
d65716d83a
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue