mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-03 20:01:57 +00:00
add ivr_menu_terminator variable you can set to none or the dtmf chars you want to terminate input
This commit is contained in:
parent
e25a90a04b
commit
0a3e5d2f74
@ -304,13 +304,18 @@ static switch_status_t play_and_collect(switch_core_session_t *session, switch_i
|
|||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
char *sound_expanded = sound;
|
char *sound_expanded = sound;
|
||||||
switch_size_t menu_buf_len = 0;
|
switch_size_t menu_buf_len = 0;
|
||||||
|
const char *terminator_str = "#";
|
||||||
|
|
||||||
if (!session || !menu || zstr(sound)) {
|
if (!session || !menu || zstr(sound)) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((channel = switch_core_session_get_channel(session))) {
|
if ((channel = switch_core_session_get_channel(session))) {
|
||||||
|
const char *tmp;
|
||||||
sound_expanded = switch_channel_expand_variables(channel, sound);
|
sound_expanded = switch_channel_expand_variables(channel, sound);
|
||||||
|
if ((tmp = switch_channel_get_variable(channel, "ivr_menu_terminator")) && !zstr(tmp)) {
|
||||||
|
terminator_str = tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(menu->buf, 0, menu->inlen + 1);
|
memset(menu->buf, 0, menu->inlen + 1);
|
||||||
@ -343,7 +348,7 @@ static switch_status_t play_and_collect(switch_core_session_t *session, switch_i
|
|||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "waiting for %u/%u digits t/o %d\n",
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "waiting for %u/%u digits t/o %d\n",
|
||||||
(uint32_t) (menu->inlen - strlen(menu->buf)), (uint32_t) need, menu->inter_timeout);
|
(uint32_t) (menu->inlen - strlen(menu->buf)), (uint32_t) need, menu->inter_timeout);
|
||||||
status = switch_ivr_collect_digits_count(session, menu->ptr, menu->inlen - strlen(menu->buf),
|
status = switch_ivr_collect_digits_count(session, menu->ptr, menu->inlen - strlen(menu->buf),
|
||||||
need, "#", &terminator, menu_buf_len ? menu->inter_timeout : menu->timeout,
|
need, terminator_str, &terminator, menu_buf_len ? menu->inter_timeout : menu->timeout,
|
||||||
menu->inter_timeout, menu->timeout);
|
menu->inter_timeout, menu->timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +370,7 @@ static switch_status_t play_and_collect(switch_core_session_t *session, switch_i
|
|||||||
switch_ivr_phrase_macro(session, menu->confirm_macro, menu->buf, NULL, ap);
|
switch_ivr_phrase_macro(session, menu->confirm_macro, menu->buf, NULL, ap);
|
||||||
|
|
||||||
if (menu->confirm_key && *buf == '\0') {
|
if (menu->confirm_key && *buf == '\0') {
|
||||||
switch_ivr_collect_digits_count(session, buf, sizeof(buf), 1, "#", &terminator_key, menu->timeout, 0, 0);
|
switch_ivr_collect_digits_count(session, buf, sizeof(buf), 1, terminator_str, &terminator_key, menu->timeout, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu->confirm_key && *buf != '\0') {
|
if (menu->confirm_key && *buf != '\0') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user