Merge pull request #1802 in FS/freeswitch from ~ITALOROSSI/freeswitch:feature/FS-12022 to master

* commit '759783532dc7c34b4f8ab27e63438a350bfbc256':
  FS-12022: [mod_event_socket] Add Job-Owner-UUID with session uuid when using bgapi inside outbound socket
This commit is contained in:
Andrey Volk 2019-08-27 12:30:43 -05:00
commit eee07bd95f
1 changed files with 6 additions and 0 deletions

View File

@ -375,6 +375,9 @@ static void event_handler(switch_event_t *event)
if (!uuid || (l->session && strcmp(uuid, switch_core_session_get_uuid(l->session)))) {
send = 0;
}
if (!strcmp(switch_core_session_get_uuid(l->session), switch_event_get_header_nil(event, "Job-Owner-UUID"))) {
send = 1;
}
}
if (send) {
@ -1499,6 +1502,7 @@ struct api_command_struct {
listener_t *listener;
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
int bg;
char bg_owner_uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
int ack;
int console_execute;
switch_memory_pool_t *pool;
@ -1557,6 +1561,7 @@ static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj)
if (switch_event_create(&event, SWITCH_EVENT_BACKGROUND_JOB) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-UUID", acs->uuid_str);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Owner-UUID", acs->bg_owner_uuid_str);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Command", acs->api_cmd);
if (acs->arg) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Job-Command-Arg", acs->arg);
@ -2357,6 +2362,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
switch_uuid_get(&uuid);
switch_uuid_format(acs->uuid_str, &uuid);
}
switch_copy_string(acs->bg_owner_uuid_str, switch_core_session_get_uuid(listener->session), sizeof(acs->bg_owner_uuid_str));
switch_snprintf(reply, reply_len, "~Reply-Text: +OK Job-UUID: %s\nJob-UUID: %s\n\n", acs->uuid_str, acs->uuid_str);
switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool);
sanity = 2000;