diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index a8e8f284ca..4544c51e60 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -747,6 +747,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session, uint32_t timeout, const char *valid_terminators); +SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key, const char *app); +SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session); + + /** @} */ SWITCH_END_EXTERN_C diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 31ab5a2101..9e9337200d 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -79,6 +79,26 @@ SWITCH_STANDARD_APP(exe_function) } } +#define BIND_SYNTAX " " +SWITCH_STANDARD_APP(dtmf_bind_function) +{ + char *argv[2] = { 0 }; + int argc; + char *lbuf = NULL; + + if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data)) + && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 2) { + int kval = atoi(argv[0]); + if (switch_ivr_bind_dtmf_meta_session(session, kval, argv[1]) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound: %s %s\n", argv[0], argv[1]); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bind Error!\n"); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", BIND_SYNTAX); + } +} + #define INTERCEPT_SYNTAX "" SWITCH_STANDARD_APP(intercept_function) { @@ -1609,6 +1629,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "sched_broadcast", SCHED_BROADCAST_DESCR, SCHED_BROADCAST_DESCR, sched_broadcast_function, "[+]