From ae7e4d2eaf30048ab63b74b4430440fda2185d02 Mon Sep 17 00:00:00 2001 From: Luis Azedo Date: Tue, 3 Oct 2017 04:28:20 +0100 Subject: [PATCH 1/2] FS-10704 [core] allow event-uuid (app_uuid) to be used in application --- src/switch_core_session.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index b57e239f92..e6da6b7a63 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -2765,7 +2765,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * if ((app_uuid_var = switch_channel_get_variable(channel, "app_uuid"))) { app_uuid = (char *)app_uuid_var; - switch_channel_set_variable(channel, "app_uuid", NULL); } else { switch_uuid_str(uuid_str, sizeof(uuid_str)); } @@ -2881,6 +2880,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * switch_event_fire(&event); } + if(app_uuid != uuid_str) { + switch_channel_set_variable(channel, "app_uuid", NULL); + }; + msg.message_id = SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE; switch_core_session_receive_message(session, &msg); From 96ae6ef4dd22297c803f821ee615ad86993c95a0 Mon Sep 17 00:00:00 2001 From: lazedo Date: Mon, 4 Jun 2018 11:01:52 +0000 Subject: [PATCH 2/2] FS-10704 [core] add event-uuid-name this allows for external call control to provide a app name --- src/switch_core_session.c | 13 ++++++++----- src/switch_ivr.c | 4 ++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index e6da6b7a63..2877751d24 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -2756,7 +2756,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * const char *var; switch_channel_t *channel = switch_core_session_get_channel(session); char *expanded = NULL; - const char *app, *app_uuid_var; + const char *app, *app_uuid_var, *app_uuid_name; switch_core_session_message_t msg = { 0 }; char delim = ','; int scope = 0; @@ -2765,10 +2765,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * if ((app_uuid_var = switch_channel_get_variable(channel, "app_uuid"))) { app_uuid = (char *)app_uuid_var; + switch_channel_set_variable(channel, "app_uuid", NULL); } else { switch_uuid_str(uuid_str, sizeof(uuid_str)); } + if((app_uuid_name = switch_channel_get_variable(channel, "app_uuid_name"))) { + switch_channel_set_variable(channel, "app_uuid_name", NULL); + } + switch_assert(application_interface); app = application_interface->interface_name; @@ -2853,6 +2858,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", application_interface->interface_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", expanded); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-UUID", app_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-UUID-Name", app_uuid_name); switch_event_fire(&event); } @@ -2877,13 +2883,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t * switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", expanded); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Response", resp ? resp : "_none_"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-UUID", app_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-UUID-Name", app_uuid_name); switch_event_fire(&event); } - if(app_uuid != uuid_str) { - switch_channel_set_variable(channel, "app_uuid", NULL); - }; - msg.message_id = SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE; switch_core_session_receive_message(session, &msg); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 770c3bb81f..f3ff3d5fbe 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -550,6 +550,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se if (cmd_hash == CMD_EXECUTE) { char *app_name = switch_event_get_header(event, "execute-app-name"); char *event_uuid = switch_event_get_header(event, "event-uuid"); + char *event_uuid_name = switch_event_get_header(event, "event-uuid-name"); char *app_arg = switch_event_get_header(event, "execute-app-arg"); char *content_type = switch_event_get_header(event, "content-type"); char *loop_h = switch_event_get_header(event, "loops"); @@ -628,6 +629,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se if (event_uuid) { switch_channel_set_variable(channel, "app_uuid", event_uuid); } + if (event_uuid_name) { + switch_channel_set_variable(channel, "app_uuid_name", event_uuid_name); + } switch_channel_set_variable_printf(channel, "current_loop", "%d", x + 1); switch_channel_set_variable_printf(channel, "total_loops", "%d", loops);