switch_channel_set_cap(tech_pvt->channel, CC_PROXY_MEDIA);
switch_channel_set_cap(tech_pvt->channel, CC_JITTERBUFFER);
switch_channel_set_cap(tech_pvt->channel, CC_FS_RTP);
+ switch_channel_set_cap(tech_pvt->channel, CC_QUEUEABLE_DTMF_DELAY);
switch_core_session_set_private(session, tech_pvt);
}
if (session->endpoint_interface->io_routines->send_dtmf) {
- if (dtmf->digit == 'w') {
- switch_yield(500000);
- } else if (dtmf->digit == 'W') {
- switch_yield(1000000);
+ int send = 0;
+ status = SWITCH_STATUS_SUCCESS;
+
+ if (switch_channel_test_cap(session->channel, CC_QUEUEABLE_DTMF_DELAY) && (dtmf->digit == 'w' || dtmf->digit == 'W')) {
+ send = 1;
} else {
+ if (dtmf->digit == 'w') {
+ switch_yield(500000);
+ } else if (dtmf->digit == 'W') {
+ switch_yield(1000000);
+ } else {
+ send = 1;
+ }
+ }
+
+ if (send) {
status = session->endpoint_interface->io_routines->send_dtmf(session, &new_dtmf);
}
}
}
}
+static void set_dtmf_delay(switch_rtp_t *rtp_session, uint32_t ms)
+{
+ int mspp = 20;
+
+ if (rtp_session->ms_per_packet) {
+ if (!(mspp = (int) (rtp_session->ms_per_packet / 1000))) {
+ mspp = 20;
+ }
+ }
+
+ rtp_session->dtmf_data.out_digit_delay += (ms / mspp);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Queue digit delay of %dms\n", ms);
+
+}
+
static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session)
{
switch_frame_flag_t flags = 0;
switch_dtmf_t *rdigit = pop;
int64_t offset;
switch_size_t wrote;
+
+ if (rdigit->digit == 'w') {
+ set_dtmf_delay(rtp_session, 500);
+ free(rdigit);
+ return;
+ }
+
+ if (rdigit->digit == 'W') {
+ set_dtmf_delay(rtp_session, 1000);
+ free(rdigit);
+ return;
+ }
+
rtp_session->sending_dtmf = 1;
memset(rtp_session->dtmf_data.out_digit_packet, 0, 4);