]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Allow SIP UPDATE messages without display updates
authorTravis Cross <tc@traviscross.com>
Wed, 25 Jun 2014 19:24:11 +0000 (19:24 +0000)
committerTravis Cross <tc@traviscross.com>
Wed, 25 Jun 2014 20:43:29 +0000 (20:43 +0000)
Previously if send-display-update was set to false we would also
remove UPDATE from our Allow: headers.  This is unnecessary.  The
UPDATE message is useful in SIP transactions even if we're not sending
display updates.

With this commit, we add a new boolean profile flag, allow-update.  If
set to true we'll send Allow: UPDATE.  If set to false, we will not.
If there is a conflict with another setting that requires UPDATE
support, the allow-update parameter will win and a warning will be
printed.

ref: RFC 3311

src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index 35cce381cdd73675789b3ed506ffe62d8e8c874e..fbe5bad740dfc0ccdc9bda47f00d5098f53145e5 100644 (file)
@@ -262,6 +262,7 @@ typedef enum {
        PFLAG_THREAD_PER_REG,
        PFLAG_MWI_USE_REG_CALLID,
        PFLAG_FIRE_MESSAGE_EVENTS,
+       PFLAG_ALLOW_UPDATE,
        PFLAG_SEND_DISPLAY_UPDATE,
        PFLAG_RUNNING_TRANS,
        PFLAG_SOCKET_TCP_KEEPALIVE,
index 82c7e4f8ba30b087b2ec95ae8f6bc262cfb0e8eb..2beff77a3d7ed4be9e6779641e8e22e4b44dbb72 100644 (file)
@@ -2805,7 +2805,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
                                   NUTAG_AUTOALERT(0),
                                   NUTAG_ENABLEMESSENGER(1),
                                   NTATAG_EXTRA_100(0),
-                                  TAG_IF(sofia_test_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE), NUTAG_ALLOW("UPDATE")),
+                                  TAG_IF(sofia_test_pflag(profile, PFLAG_ALLOW_UPDATE), NUTAG_ALLOW("UPDATE")),
                                   TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
                                   TAG_IF((profile->mflags & MFLAG_REFER), NUTAG_ALLOW("REFER")),
                                   TAG_IF(!sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_ALLOW("PRACK")),
@@ -4001,6 +4001,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                        sofia_set_media_flag(profile, SCMF_RTP_AUTOFLUSH_DURING_BRIDGE);
                                        profile->contact_user = SOFIA_DEFAULT_CONTACT_USER;
                                        sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
+                                       sofia_set_pflag(profile, PFLAG_ALLOW_UPDATE);
                                        sofia_set_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE);
                                        sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER);
                                        //sofia_set_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER);
@@ -4150,6 +4151,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                                } else {
                                                        sofia_clear_pflag(profile, PFLAG_CONFIRM_BLIND_TRANSFER);
                                                }
+                                       } else if (!strcasecmp(var, "allow-update")) {
+                                               if (switch_true(val)) {
+                                                       sofia_set_pflag(profile, PFLAG_ALLOW_UPDATE);
+                                               } else {
+                                                       sofia_clear_pflag(profile, PFLAG_ALLOW_UPDATE);
+                                               }
                                        } else if (!strcasecmp(var, "send-display-update")) {
                                                if (switch_true(val)) {
                                                        sofia_set_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE);
@@ -5124,6 +5131,11 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                        sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION);
                                }
 
+                               if (sofia_test_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE) && !sofia_test_pflag(profile, PFLAG_ALLOW_UPDATE)) {
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "send-display-update=true is set, but we can't comply because allow-update=false\n");
+                                       sofia_clear_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE);
+                               }
+
                                if ((!profile->cng_pt) && (!sofia_test_media_flag(profile, SCMF_SUPPRESS_CNG))) {
                                        profile->cng_pt = SWITCH_RTP_CNG_PAYLOAD;
                                }