From 2d4d6ea756491c0dc70bb5a92e7ac06ea0dabd9c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 29 Jan 2007 20:11:26 +0000 Subject: [PATCH] make send_dtmf parse w and W for 500 and 1000 ms pause git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4086 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_core.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/switch_core.c b/src/switch_core.c index 98a2e17258..16dd598247 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -2469,13 +2469,35 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio switch_status_t status = SWITCH_STATUS_FALSE; if (session->endpoint_interface->io_routines->send_dtmf) { - if ((status = session->endpoint_interface->io_routines->send_dtmf(session, dtmf)) == SWITCH_STATUS_SUCCESS) { - for (ptr = session->event_hooks.send_dtmf; ptr; ptr = ptr->next) { - if ((status = ptr->send_dtmf(session, dtmf)) != SWITCH_STATUS_SUCCESS) { - break; - } - } - } + if (strchr(dtmf, 'w') || strchr(dtmf, 'W')) { + char *d; + for (d = dtmf; d && *d; d++) { + char digit[2] = ""; + + if (*d == 'w') { + switch_yield(500000); + continue; + } else if (*d == 'W') { + switch_yield(1000000); + continue; + } + + digit[0] = *d; + if ((status = session->endpoint_interface->io_routines->send_dtmf(session, digit)) != SWITCH_STATUS_SUCCESS) { + return status; + } + } + } else { + status = session->endpoint_interface->io_routines->send_dtmf(session, dtmf); + } + + if (status == SWITCH_STATUS_SUCCESS) { + for (ptr = session->event_hooks.send_dtmf; ptr; ptr = ptr->next) { + if ((status = ptr->send_dtmf(session, dtmf)) != SWITCH_STATUS_SUCCESS) { + break; + } + } + } } return status;