}
span->channels[chan_index]->dtmfdetect.duration_ms = chan_config->dtmfdetect_ms;
+ if (chan_config->dtmf_on_start) {
+ span->channels[chan_index]->dtmfdetect.trigger_on_start = 1;
+ }
}
return FTDM_SUCCESS;
chan_config.debugdtmf = ftdm_true(val);
ftdm_log(FTDM_LOG_DEBUG, "Setting debugdtmf to '%s'\n", chan_config.debugdtmf ? "yes" : "no");
} else if (!strncasecmp(var, "dtmfdetect_ms", sizeof("dtmfdetect_ms")-1)) {
+ if (chan_config.dtmf_on_start == FTDM_TRUE) {
+ chan_config.dtmf_on_start = FTDM_FALSE;
+ ftdm_log(FTDM_LOG_WARNING, "dtmf_on_start parameter disabled because dtmfdetect_ms specified\n");
+ }
if (sscanf(val, "%d", &(chan_config.dtmfdetect_ms)) != 1) {
ftdm_log(FTDM_LOG_ERROR, "invalid dtmfdetect_ms: '%s'\n", val);
}
+ } else if (!strncasecmp(var, "dtmf_on_start", sizeof("dtmf_on_start")-1)) {
+ if (chan_config.dtmfdetect_ms) {
+ ftdm_log(FTDM_LOG_WARNING, "dtmf_on_start parameter ignored because dtmf_detect_ms specified\n");
+ } else {
+ if (ftdm_true(val)) {
+ chan_config.dtmf_on_start = FTDM_TRUE;
+ } else {
+ chan_config.dtmf_on_start = FTDM_FALSE;
+ }
+ }
} else if (!strncasecmp(var, "iostats", sizeof("iostats")-1)) {
if (ftdm_true(val)) {
chan_config.iostats = FTDM_TRUE;
if (tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) {
ftdm_set_flag(fchan, FTDM_CHANNEL_MUTE);
- //fchan->dtmfdetect.start_time = ftdm_current_time_in_ms();
+ if (fchan->dtmfdetect.duration_ms) {
+ fchan->dtmfdetect.start_time = ftdm_current_time_in_ms();
+ } else if (fchan->dtmfdetect.trigger_on_start) {
+ ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]);
+ ftdm_channel_queue_dtmf(fchan, tmp_dtmf);
+ }
}
if (tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_STOP) {
ftdm_clear_flag(fchan, FTDM_CHANNEL_MUTE);
if (ftdm_test_flag(fchan, FTDM_CHANNEL_INUSE)) {
- //ftdm_time_t diff = ftdm_current_time_in_ms() - fchan->dtmfdetect.start_time;
- //if (diff > fchan->dtmfdetect.duration_ms) {
- //ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c (duration:%d min:%d)\n", tmp_dtmf[0], diff, fchan->dtmfdetect.duration_ms);
- ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]);
+ if (fchan->dtmfdetect.duration_ms) {
+ ftdm_time_t diff = ftdm_current_time_in_ms() - fchan->dtmfdetect.start_time;
+ if (diff > fchan->dtmfdetect.duration_ms) {
+ ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c (duration:%d min:%d)\n", tmp_dtmf[0], diff, fchan->dtmfdetect.duration_ms);
+ ftdm_channel_queue_dtmf(fchan, tmp_dtmf);
+ } else {
+ ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c (duration:%d min:%d)\n", tmp_dtmf[0], diff, fchan->dtmfdetect.duration_ms);
+ }
+ } else if (!fchan->dtmfdetect.trigger_on_start) {
+ ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]);
ftdm_channel_queue_dtmf(fchan, tmp_dtmf);
- //} else {
- //ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c (duration:%d min:%d)\n", tmp_dtmf[0], diff, fchan->dtmfdetect.duration_ms);
- //}
+ }
}
}
}