From 03e3e5176ba095d450cb2845ff202c1802ba2484 Mon Sep 17 00:00:00 2001 From: agree Date: Fri, 25 Mar 2022 12:08:47 -0400 Subject: [PATCH] [mod_sofia] add ability to skip chat global process --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 6 ++++++ src/mod/endpoints/mod_sofia/sofia_presence.c | 3 +++ 3 files changed, 10 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 3408b7ca0b..f2e70975ec 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -292,6 +292,7 @@ typedef enum { PFLAG_TLS_ALWAYS_NAT, PFLAG_TCP_ALWAYS_NAT, PFLAG_ENABLE_CHAT, + PFLAG_CHAT_SKIP_GLOBAL_PROCESS, PFLAG_AUTH_SUBSCRIPTIONS, PFLAG_PROXY_REFER, PFLAG_CHANNEL_XML_FETCH_ON_NIGHTMARE_TRANSFER, diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 5066a13ef8..fcac8c4f0f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4917,6 +4917,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_ENABLE_CHAT); } + } else if (!strcasecmp(var, "chat-skip-global-process")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_CHAT_SKIP_GLOBAL_PROCESS); + } else { + sofia_clear_pflag(profile, PFLAG_CHAT_SKIP_GLOBAL_PROCESS); + } } else if (!strcasecmp(var, "fire-bye-response-events")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_FIRE_BYE_RESPONSE_EVENTS); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index ce04b2b46f..1c2918cae6 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -4914,6 +4914,9 @@ void sofia_presence_handle_sip_i_message(int status, switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", full_from); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sip_profile", profile->name); + if (sofia_test_pflag(profile, PFLAG_CHAT_SKIP_GLOBAL_PROCESS)) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "skip_global_process", "true"); + } if (sip->sip_call_info) { sip_call_info_t *call_info = sip->sip_call_info;