78 #define MENU_EVENT_ENTER "menu::enter" 79 #define MENU_EVENT_EXIT "menu::exit" 95 for (ret = stack; ret; ret = ret->
next) {
96 if (!name || !strcmp(ret->
name, name))
106 for (ptr = *top; ptr && ptr->
next; ptr = ptr->
next);
154 if (!confirm_attempts) {
155 confirm_attempts = 3;
158 if (!inter_timeout) {
159 inter_timeout = timeout / 2;
166 if (!
zstr(greeting_sound)) {
170 if (!
zstr(short_greeting_sound)) {
174 if (!
zstr(invalid_sound)) {
178 if (!
zstr(transfer_sound)) {
182 if (!
zstr(exit_sound)) {
186 if (!
zstr(confirm_key)) {
190 if (!
zstr(confirm_macro)) {
194 if (!
zstr(tts_engine)) {
198 if (!
zstr(tts_voice)) {
206 if (max_failures > 0) {
212 if (max_timeouts > 0) {
253 if (*action->
bind ==
'/') {
256 len = (uint32_t) strlen(action->
bind);
257 if (len > menu->
inlen) {
286 if (*action->
bind ==
'/') {
289 len = (uint32_t) strlen(action->
bind);
290 if (len > menu->
inlen) {
314 if (stack != NULL && stack->
pool != NULL) {
335 char *sound_expanded = sound;
337 const char *terminator_str =
"#";
339 if (!session || !menu ||
zstr(sound)) {
347 terminator_str = tmp;
358 len = (uint32_t) menu->
inlen + 1;
366 if (sound_expanded != sound) {
374 menu_buf_len = strlen(menu->
buf);
376 menu->
ptr += menu_buf_len;
377 if (menu_buf_len < need) {
409 "approving digits '%s' via confirm key %s\n", menu->
buf, menu->
confirm_key);
434 char *data = strchr(app,
' ');
435 char *expanded = NULL;
445 if (expanded && expanded != data) {
453 int reps = 0, errs = 0, timeouts = 0, match = 0,
running = 1;
469 if (!session ||
zstr(name)) {
492 char digit_buffer[128] =
"";
533 memset(arg, 0,
sizeof(arg));
542 if (*menu->
buf !=
'\0') {
546 char substituted[1024];
547 char *use_arg = ap->
arg;
560 use_arg = substituted;
566 ok = !strcmp(menu->
buf, ap->
bind);
574 "IVR function on menu '%s' matched '%s' param '%s'\n", menu->
name, menu->
buf, use_arg);
575 todo = ap->
function(menu, use_arg, arg,
sizeof(arg), obj);
581 "IVR action on menu '%s' matched '%s' param '%s'\n", menu->
name, menu->
buf, aptr);
594 if (!strcmp(aptr, menu->
name)) {
607 char *app_arg = NULL;
613 if ((app_arg = strchr(app_name,
' '))) {
713 while (map != NULL && (rc = strcasecmp(map->
name, name)) != 0) {
717 return (rc == 0 ? map : NULL);
734 if (map->
name != NULL) {
772 if (!
zstr(action_name)) {
778 if (!strcasecmp(
iam[i].name, action_name)) {
798 if (!strcmp(
iam[i].name, action)) {
819 if (xml_menu_ctx != NULL && pool != NULL) {
821 if (*xml_menu_ctx != NULL) {
822 (*xml_menu_ctx)->pool =
pool;
823 (*xml_menu_ctx)->autocreated = autocreated;
824 (*xml_menu_ctx)->map = NULL;
854 if (xml_menu_ctx != NULL && menu_stack != NULL && xml_menu != NULL) {
879 if (
zstr(max_timeouts)) {
897 atoi(confirm_attempts),
901 strlen(max_failures) ? atoi(max_failures) : 0, strlen(max_timeouts) ? atoi(max_timeouts) : 0, xml_menu_ctx->
pool);
905 if (!
zstr(exec_on_max_fail)) {
909 if (!
zstr(exec_on_max_timeout)) {
914 if (
zstr(prompt_pin_file)) {
915 prompt_pin_file =
"ivr/ivr-please_enter_pin_followed_by_pound.wav";
917 if (
zstr(bad_pin_file)) {
918 bad_pin_file =
"conference/conf-bad-pin.wav";
948 while (xml_map != NULL && !found) {
949 if (!(found = (strcasecmp(xml_map->
name, action) == 0))) {
950 xml_map = xml_map->
next;
954 if (found && xml_map != NULL) {
965 "binding menu caller control '%s'/'%s' to '%s'\n", xml_map->
name, param, digits);
#define switch_event_fire(event)
Fire an event filling in most of the arguements with obvious values.
#define switch_regex_safe_free(re)
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
A module interface to implement an application.
const char * switch_xml_attr_soft(_In_ switch_xml_t xml, _In_z_ const char *attr)
returns the value of the requested tag attribute, or "" if not found
char * switch_core_session_sprintf(_In_ switch_core_session_t *session, _In_z_ _Printf_format_string_ const char *fmt,...)
printf-style style printing routine. The data is output to a string allocated from the session ...
#define SWITCH_CHANNEL_SESSION_LOG(x)
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
#define SWITCH_CHANNEL_LOG
switch_xml_t switch_xml_find_child(_In_ switch_xml_t node, _In_z_ const char *childname, _In_opt_z_ const char *attrname, _In_opt_z_ const char *value)
find a child tag in a node called 'childname' with an attribute 'attrname' which equals 'value' ...
const char * switch_xml_attr(_In_opt_ switch_xml_t xml, _In_opt_z_ const char *attr)
returns the value of the requested tag attribute, or NULL if not found
switch_status_t switch_play_and_get_digits(switch_core_session_t *session, uint32_t min_digits, uint32_t max_digits, uint32_t max_tries, uint32_t timeout, const char *valid_terminators, const char *audio_file, const char *bad_input_audio_file, const char *var_name, char *digit_buffer, uint32_t digit_buffer_length, const char *digits_regex, uint32_t digit_timeout, const char *transfer_on_failure)
Play a sound and gather digits with the number of retries specified if the user doesn't give digits i...
#define SWITCH_STATUS_IS_BREAK(x)
void switch_perform_substitution(switch_regex_t *re, int match_count, const char *data, const char *field_data, char *substituted, switch_size_t len, int *ovector)
void switch_channel_event_set_data(_In_ switch_channel_t *channel, _In_ switch_event_t *event)
Add information about a given channel to an event object.
#define switch_core_strdup(_pool, _todup)
Copy a string using memory allocation from a given pool.
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
Representation of an event.
#define switch_channel_ready(_channel)
switch_status_t switch_core_session_exec(_In_ switch_core_session_t *session, _In_ const switch_application_interface_t *application_interface, _In_opt_z_ const char *arg)
Execute an application on a session.
switch_status_t switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file, switch_input_args_t *args)
play a file from the disk to the session
A representation of an XML tree.
struct real_pcre switch_regex_t
#define switch_event_create_subclass(_e, _eid, _sn)
#define switch_core_session_execute_application(_a, _b, _c)
Execute an application on a session.
_Ret_ switch_channel_t * switch_core_session_get_channel(_In_ switch_core_session_t *session)
Retrieve a pointer to the channel object associated with a given session.
#define UNPROTECT_INTERFACE(_it)
#define switch_clear_flag(obj, flag)
Clear a flag on an arbitrary object while locked.
int main(int argc, char *argv[])
switch_status_t switch_ivr_collect_digits_count(switch_core_session_t *session, char *buf, switch_size_t buflen, switch_size_t maxdigits, const char *terminators, char *terminator, uint32_t first_timeout, uint32_t digit_timeout, uint32_t abs_timeout)
Wait for specified number of DTMF digits, untile terminator is received or until the channel hangs up...
switch_application_interface_t * switch_loadable_module_get_application_interface(const char *name)
Retrieve the application interface by it's registered name.
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
#define switch_channel_get_variable(_c, _v)
switch_status_t switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
Add a string header to an event.
#define switch_safe_free(it)
Free a pointer and set it to NULL unless it already is NULL.
switch_ivr_action_t action
int switch_regex_perform(const char *field, const char *expression, switch_regex_t **new_re, int *ovector, uint32_t olen)
#define switch_str_nil(s)
Make a null string a blank string instead.
#define switch_channel_expand_variables(_channel, _in)
switch_status_t
Common return values.
#define switch_goto_status(_status, _label)
switch_xml_t switch_xml_child(_In_ switch_xml_t xml, _In_z_ const char *name)
returns the first child tag (one level deeper) with the given name or NULL \ if not found ...
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
struct fspr_pool_t switch_memory_pool_t
#define switch_core_session_strdup(_session, _todup)
Copy a string using memory allocation from a session's pool.
#define switch_channel_set_variable(_channel, _var, _val)