]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6462 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 16 Apr 2014 23:26:43 +0000 (04:26 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 16 Apr 2014 23:26:43 +0000 (04:26 +0500)
I found a problem here but it may not completely match your expectations.
I reviewed the RFC 4028 and checked against the code and I discovered we should not be putting a Min-SE in any response at all besides a 422:

section 5:

   The Min-SE header field MUST NOT be used in responses except for
   those with a 422 response code.  It indicates the minimum value of
   the session interval that the server is willing to accept.

I corrected this problem and implemented the 422 response so if you request a value lower than the minimum specified for the profile.
If the value is equal or higher to the minimum, it will be reflected in the Session-Expires header in the response and no Min-SE will be present.

libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
src/mod/endpoints/mod_sofia/sofia.c

index c9736387be1f0af47685ef9c275cc76d9ed7c7ea..c6751f55500d835b74b523184195d929cf6011a8 100644 (file)
@@ -4502,9 +4502,9 @@ session_timer_add_headers(struct session_timer *t,
 
   sip_add_tl(msg, sip,
                         TAG_IF(expires != 0, SIPTAG_SESSION_EXPIRES(x)),
-                        TAG_IF(min != 0
+                        TAG_IF((!uas || sip->sip_status->st_status == 422) && (min != 0
                                        /* Min-SE: 0 is optional with initial INVITE */
-                                       || !initial,
+                                        || !initial),
                                        SIPTAG_MIN_SE(min_se)),
                         TAG_IF(autorequire && refresher == nua_remote_refresher && expires != 0, SIPTAG_REQUIRE_STR("timer")),
                         TAG_END());
index 79d39072e0582334c35046590b0d8b814398debc..31bdfaf575e14b274dfead8785693f8c2fa47ab2 100644 (file)
@@ -2061,6 +2061,16 @@ void sofia_event_callback(nua_event_t event,
        case nua_i_notify:
        case nua_i_info:
 
+               
+               if (event == nua_i_invite) {
+                       if (sip->sip_min_se && profile->minimum_session_expires) {
+                               if (sip->sip_min_se->min_delta < profile->minimum_session_expires) {
+                                       nua_respond(nh, SIP_422_SESSION_TIMER_TOO_SMALL, NUTAG_MIN_SE(profile->minimum_session_expires), TAG_END());
+                                       goto end;
+                               }
+                       }
+               }
+
                if (!sofia_private) {
                        if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING) || !switch_core_ready_inbound()) {
                                nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), NUTAG_WITH_THIS(nua), TAG_END());
@@ -2801,6 +2811,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
 #endif
                                   NUTAG_APPL_METHOD("MESSAGE"),
 
+                                  TAG_IF(profile->session_timeout && profile->minimum_session_expires, NUTAG_MIN_SE(profile->minimum_session_expires)),
                                   NUTAG_SESSION_TIMER(profile->session_timeout),
                                   NTATAG_MAX_PROCEEDING(profile->max_proceeding),
                                   TAG_IF(profile->pres_type, NUTAG_ALLOW("PUBLISH")),