From 1ae9e8f6b654b2629c4506bdefc7559982e409e3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 16 Oct 2007 14:36:39 +0000 Subject: [PATCH] add playback_terminators variable This is valid for playback, gentones, record and speak value may be a string of valid terminator characters, or the word 'none' the default of * will always work unless overridden by 'none'. This is for backward compat. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5888 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_types.h | 1 + .../applications/mod_dptools/mod_dptools.c | 28 +++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index cb1fc6f86d..9cb8a09623 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -97,6 +97,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_PATH_SEPARATOR "/" #endif #define SWITCH_URL_SEPARATOR "://" +#define SWITCH_PLAYBACK_TERMINATORS_VARIABLE "playback_terminators" #define SWITCH_CACHE_SPEECH_HANDLES_VARIABLE "cache_speech_handles" #define SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME "__cache_speech_handles_obj__" #define SWITCH_BYPASS_MEDIA_VARIABLE "bypass_media" diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 97813137dc..efea476fcb 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -898,15 +898,33 @@ SWITCH_STANDARD_APP(park_function) */ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen) { - + switch (itype) { - case SWITCH_INPUT_TYPE_DTMF:{ + case SWITCH_INPUT_TYPE_DTMF: + { char *dtmf = (char *) input; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digits %s\n", dtmf); + char *terminators; + switch_channel_t *channel = switch_core_session_get_channel(session); + char *p; + + assert(channel); - if (*dtmf == '*') { - return SWITCH_STATUS_BREAK; + if (!(terminators = switch_channel_get_variable(channel, SWITCH_PLAYBACK_TERMINATORS_VARIABLE))) { + terminators = "*"; + } + if (!strcasecmp(terminators, "none")) { + terminators = NULL; + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digits %s\n", dtmf); + + for (p = terminators; p && *p; p++) { + char *d; + for (d = dtmf; d && *d; d++) { + if (*p == *d) { + return SWITCH_STATUS_BREAK; + } + } } } break;