]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7309: [mod_sofia] Allow removal of User-Agent header
authorSpencer Thomason <spencer@whiteskycommunications.com>
Fri, 20 Feb 2015 00:53:46 +0000 (16:53 -0800)
committerSpencer Thomason <spencer@whiteskycommunications.com>
Fri, 20 Feb 2015 16:36:44 +0000 (08:36 -0800)
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
conf/insideout/sip_profiles/internal.xml
conf/softphone/freeswitch.xml
conf/vanilla/sip_profiles/internal-ipv6.xml
conf/vanilla/sip_profiles/internal.xml
src/mod/endpoints/mod_sofia/conf/sofia.conf.xml
src/mod/endpoints/mod_sofia/sofia.c

index 525554f4b8b20df9367e651360f934aec08c1ead..0ae93cfc823d07d7ed53dc0aa6c677eb2b79c963 100644 (file)
@@ -5,6 +5,7 @@
 <profile name="internal-ipv6">
   <!--aliases are other names that will work as a valid profile name for this profile-->
   <settings>
+    <!-- Can be set to "_undef_" to remove the User-Agent header -->
     <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
     <param name="debug" value="0"/>
     <param name="sip-trace" value="no"/>
index 666f7de5ab960e8385b45d06a370253b47f31962..158d5974a7b60765a72fa0d131e18982b2908e69 100644 (file)
@@ -36,6 +36,8 @@
         bypass media after an attended transfer.
     -->
     <!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->
+
+    <!-- Can be set to "_undef_" to remove the User-Agent header -->
     <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
     <param name="debug" value="0"/>
     <param name="sip-trace" value="no"/>
index 3d5faa240c8942d4fca93e2fa5e4bd5862007e9f..311ba4fcc21f01e36a720543671df7aef1264fec 100644 (file)
          </gateways>
          <settings>
            <!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->
+
+            <!-- Can be set to "_undef_" to remove the User-Agent header -->
            <param name="user-agent-string" value="FreeSWITCH/SoftPhone"/>
            <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
            <param name="debug" value="0"/>
index 62b9708e8bc1987b3f7749f08705d08c193512b9..98efa2ffbbe86bd2e403b81fedc7ceae49a6ea96 100644 (file)
@@ -5,6 +5,7 @@
   <!-- http://wiki.freeswitch.org/wiki/Sofia_Configuration_Files -->
   <!--aliases are other names that will work as a valid profile name for this profile-->
   <settings>
+    <!-- Can be set to "_undef_" to remove the User-Agent header -->
     <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
     <param name="debug" value="0"/>
     <param name="sip-trace" value="no"/>
index a848cb9583f2e4a02e5bf59756906b78965d371c..17887806011bd5645d3812d4c0d71c1680adcabc 100644 (file)
         bypass media after an attended transfer.
     -->
     <!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->
+
+    <!-- Can be set to "_undef_" to remove the User-Agent header -->
     <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
+
     <param name="debug" value="0"/>
     <!-- If you want FreeSWITCH to shutdown if this profile fails to load, uncomment the next line. -->
     <!-- <param name="shutdown-on-fail" value="true"/> -->
index 52fb8faefb10c823eb1691d67c6d62b637cafaaa..2e1a849e41329f5602dbe24a7c0c0861425e8ce6 100644 (file)
         <!-- <param name="media-option" value="bypass-media-after-att-xfer"/> -->
         <!-- bypass again when hold is complete -->
         <!-- <param name="media-option" value="bypass-media-after-hold"/> -->
+
+        <!-- Can be set to "_undef_" to remove the User-Agent header -->
         <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
+
         <param name="debug" value="0"/>
         <!-- If you want FreeSWITCH to shutdown if this profile fails to load,
              uncomment the next line. -->
index b97a1c980480f841f3d4dd16eeccc4b13f66b9ad..803e1cb3572cde57c71b2a4e32c23025dd53da8b 100644 (file)
@@ -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);