]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_verto] Add context into msg event header 1554/head
authorAntónio Silva <asilva@wirelessmundi.com>
Tue, 22 Feb 2022 10:11:38 +0000 (13:11 +0300)
committerAndrey Volk <andywolk@gmail.com>
Fri, 11 Aug 2023 15:36:47 +0000 (18:36 +0300)
src/mod/endpoints/mod_verto/mod_verto.c

index 9423d03c287c8dd05130accdabd2b9a866ebb935..ac042fe626d6f40fd455789638e13053e456939b 100644 (file)
@@ -3865,6 +3865,15 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
                cJSON *i, *indialog =  cJSON_GetObjectItem(msg, "inDialog");
                const char *body = cJSON_GetObjectCstr(msg, "body");
                switch_bool_t is_dialog = indialog && (indialog->type == cJSON_True || (indialog->type == cJSON_String && switch_true(indialog->valuestring)));
+               const char *context = NULL;
+
+               switch_mutex_lock(jsock->flag_mutex);
+
+               if (!(context = switch_event_get_header(jsock->vars, "user_context"))) {
+                       context = switch_either(jsock->context, jsock->profile->context);
+               }
+
+               switch_mutex_unlock(jsock->flag_mutex);
 
                if (!zstr(to)) {
                        if (strchr(to, '+')) {
@@ -3901,6 +3910,8 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call_id", call_id);
                        }
 
+                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "context", context);
+
                        switch_event_add_body(event, "%s", body);
 
                        if (strcasecmp(proto, VERTO_CHAT_PROTO)) {