mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-06 15:39:06 +00:00
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. <extension name="8000"> <condition field="destination_number" expression="^8000$"> <action application="answer"/> <!--both * and # will stop the playback--> <action application="set" data="playback_terminators=#*"/> <action application="playback" data="/ram/swimp.raw"/> </condition> </extension> git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5888 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b50e8f5c9a
commit
1ae9e8f6b6
@ -97,6 +97,7 @@ SWITCH_BEGIN_EXTERN_C
|
|||||||
#define SWITCH_PATH_SEPARATOR "/"
|
#define SWITCH_PATH_SEPARATOR "/"
|
||||||
#endif
|
#endif
|
||||||
#define SWITCH_URL_SEPARATOR "://"
|
#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_VARIABLE "cache_speech_handles"
|
||||||
#define SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME "__cache_speech_handles_obj__"
|
#define SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME "__cache_speech_handles_obj__"
|
||||||
#define SWITCH_BYPASS_MEDIA_VARIABLE "bypass_media"
|
#define SWITCH_BYPASS_MEDIA_VARIABLE "bypass_media"
|
||||||
|
@ -901,14 +901,32 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit
|
|||||||
|
|
||||||
|
|
||||||
switch (itype) {
|
switch (itype) {
|
||||||
case SWITCH_INPUT_TYPE_DTMF:{
|
case SWITCH_INPUT_TYPE_DTMF:
|
||||||
|
{
|
||||||
char *dtmf = (char *) input;
|
char *dtmf = (char *) input;
|
||||||
|
char *terminators;
|
||||||
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
assert(channel);
|
||||||
|
|
||||||
|
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);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digits %s\n", dtmf);
|
||||||
|
|
||||||
if (*dtmf == '*') {
|
for (p = terminators; p && *p; p++) {
|
||||||
|
char *d;
|
||||||
|
for (d = dtmf; d && *d; d++) {
|
||||||
|
if (*p == *d) {
|
||||||
return SWITCH_STATUS_BREAK;
|
return SWITCH_STATUS_BREAK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user