diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 20fc8fce6c..f8b1e91f37 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -427,6 +427,7 @@ SWITCH_DECLARE(switch_size_t) switch_channel_has_dtmf(switch_channel_t *channel) \return SWITCH_STATUS_SUCCESS if successful */ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *channel, const switch_dtmf_t *dtmf); +SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(switch_channel_t *channel, const char *dtmf_string); /*! \brief Retrieve DTMF digits from a given channel diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 4f6ad612bd..0040ddc67d 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -845,6 +845,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_waitfor_write(_In_ switch_co \return SWITCH_STATUS_SUCCESS if the dtmf was written */ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(_In_ switch_core_session_t *session, const switch_dtmf_t *dtmf); +SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core_session_t *session, const char *dtmf_string); /*! \brief RECV DTMF on a session diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index d6c7d4b166..56711cae75 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2647,20 +2647,6 @@ static switch_status_t conf_api_sub_dtmf(conference_member_t * member, switch_st { switch_event_t *event; char *dtmf = (char *) data; - char *p; - switch_dtmf_t _dtmf = { 0, SWITCH_DEFAULT_DTMF_DURATION }; - int tmp; - - if ((p = strchr(dtmf, '+'))) { - tmp = atoi(p); - if (tmp > 0) { - if (member->orig_read_codec && member->orig_read_codec->implementation) { - _dtmf.duration = tmp * (member->orig_read_codec->implementation->samples_per_second / 1000); - } else { - _dtmf.duration = tmp * (member->conference->rate / 1000); - } - } - } if (member == NULL) { stream->write_function(stream, "Invalid member!\n"); @@ -2676,12 +2662,7 @@ static switch_status_t conf_api_sub_dtmf(conference_member_t * member, switch_st switch_mutex_lock(member->flag_mutex); switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK); - p = dtmf; - while(p && *p && is_dtmf(*p)) { - _dtmf.digit = *p; - switch_core_session_send_dtmf(member->session, &_dtmf); - p++; - } + switch_core_session_send_dtmf_string(member->session, (char *)data); switch_mutex_unlock(member->flag_mutex); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 63408d29f3..cba33e39f2 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -181,17 +181,15 @@ SWITCH_STANDARD_APP(break_function) SWITCH_STANDARD_APP(queue_dtmf_function) { switch_channel_t *channel; - char *p; - switch_dtmf_t dtmf = {0, SWITCH_DEFAULT_DTMF_DURATION}; + channel = switch_core_session_get_channel(session); + switch_channel_queue_dtmf_string(channel, (const char *) data); + +} - if (!switch_strlen_zero(data)) { - channel = switch_core_session_get_channel(session); - switch_assert(channel != NULL); - for (p = (char *)data; p && *p; p++) { - dtmf.digit = *p; - switch_channel_queue_dtmf(channel, &dtmf); - } - } + +SWITCH_STANDARD_APP(send_dtmf_function) +{ + switch_core_session_send_dtmf_string(session, (const char *) data); } SWITCH_STANDARD_APP(transfer_function) @@ -1583,6 +1581,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "reject", "Send session reject (depricated)", "Send a respond message to a session.", respond_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "sched_hangup", SCHED_HANGUP_DESCR, SCHED_HANGUP_DESCR, sched_hangup_function, "[+]