From 74e8db736f95088d7cf38b4c424647f5ebfa2783 Mon Sep 17 00:00:00 2001 From: Spencer Thomason Date: Thu, 19 Feb 2015 16:53:46 -0800 Subject: [PATCH] FS-7309: [mod_sofia] Allow removal of User-Agent header In certain deployments it might be desirable to remove the User-Agent header from the SIP message. Set the sofia profile parameter "user-agent-string" to "none" to suppress this header. --- conf/insideout/sip_profiles/internal-ipv6.xml | 1 + conf/insideout/sip_profiles/internal.xml | 2 ++ conf/softphone/freeswitch.xml | 2 ++ conf/vanilla/sip_profiles/internal-ipv6.xml | 1 + conf/vanilla/sip_profiles/internal.xml | 3 +++ src/mod/endpoints/mod_sofia/conf/sofia.conf.xml | 3 +++ src/mod/endpoints/mod_sofia/sofia.c | 10 ++++++++-- 7 files changed, 20 insertions(+), 2 deletions(-) diff --git a/conf/insideout/sip_profiles/internal-ipv6.xml b/conf/insideout/sip_profiles/internal-ipv6.xml index 525554f4b8..0ae93cfc82 100644 --- a/conf/insideout/sip_profiles/internal-ipv6.xml +++ b/conf/insideout/sip_profiles/internal-ipv6.xml @@ -5,6 +5,7 @@ + diff --git a/conf/insideout/sip_profiles/internal.xml b/conf/insideout/sip_profiles/internal.xml index 666f7de5ab..158d5974a7 100644 --- a/conf/insideout/sip_profiles/internal.xml +++ b/conf/insideout/sip_profiles/internal.xml @@ -36,6 +36,8 @@ bypass media after an attended transfer. --> + + diff --git a/conf/softphone/freeswitch.xml b/conf/softphone/freeswitch.xml index 3d5faa240c..311ba4fcc2 100644 --- a/conf/softphone/freeswitch.xml +++ b/conf/softphone/freeswitch.xml @@ -129,6 +129,8 @@ + + diff --git a/conf/vanilla/sip_profiles/internal-ipv6.xml b/conf/vanilla/sip_profiles/internal-ipv6.xml index 62b9708e8b..98efa2ffbb 100644 --- a/conf/vanilla/sip_profiles/internal-ipv6.xml +++ b/conf/vanilla/sip_profiles/internal-ipv6.xml @@ -5,6 +5,7 @@ + diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml index a848cb9583..1788780601 100644 --- a/conf/vanilla/sip_profiles/internal.xml +++ b/conf/vanilla/sip_profiles/internal.xml @@ -42,7 +42,10 @@ bypass media after an attended transfer. --> + + + diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 52fb8faefb..2e1a849e41 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -80,7 +80,10 @@ + + + diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b97a1c9804..803e1cb357 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2872,6 +2872,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void nua_set_params(profile->nua, SIPTAG_ALLOW_STR("INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO"), + SIPTAG_USER_AGENT(SIP_NONE), NUTAG_AUTOANSWER(0), NUTAG_AUTOACK(0), NUTAG_AUTOALERT(0), @@ -2911,7 +2912,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence.winfo")), TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("message-summary")), TAG_IF(profile->pres_type == PRES_TYPE_PNP, NUTAG_ALLOW_EVENTS("ua-profile")), - NUTAG_ALLOW_EVENTS("refer"), SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END()); + NUTAG_ALLOW_EVENTS("refer"), SIPTAG_SUPPORTED_STR(supported), + TAG_IF(strcasecmp(profile->user_agent, "_undef_"), SIPTAG_USER_AGENT_STR(profile->user_agent)), + TAG_END()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set params for %s\n", profile->name); @@ -2943,6 +2946,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void NTATAG_SERVER_RPORT(profile->server_rport_level), NUTAG_URL(node->url), TAG_END()); /* Last tag should always finish the sequence */ nua_set_params(node->nua, + SIPTAG_USER_AGENT(SIP_NONE), NUTAG_APPL_METHOD("OPTIONS"), NUTAG_APPL_METHOD("REFER"), NUTAG_APPL_METHOD("SUBSCRIBE"), @@ -2954,7 +2958,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void NUTAG_ALLOW("INFO"), TAG_IF(profile->pres_type, NUTAG_ALLOW("PUBLISH")), TAG_IF(profile->pres_type, NUTAG_ENABLEMESSAGE(1)), - SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END()); + SIPTAG_SUPPORTED_STR(supported), + TAG_IF(strcasecmp(profile->user_agent, "_undef_"), SIPTAG_USER_AGENT_STR(profile->user_agent)), + TAG_END()); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activated db for %s\n", profile->name);