]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixed failing test from r380696.
authorDavid M. Lee <dlee@digium.com>
Wed, 6 Feb 2013 20:14:32 +0000 (20:14 +0000)
committerDavid M. Lee <dlee@digium.com>
Wed, 6 Feb 2013 20:14:32 +0000 (20:14 +0000)
When I added my extensive suite of session timer unit tests, apparently one of
them was failing and I never noticed. If neither Min-SE nor Session-Expires is
set in the header, it was responding with a Session-Expires of the global
maxmimum instead of the configured max for the endpoint.

(issue ASTERISK-20787)
........

Merged revisions 380973 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@380974 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index dda113045b0d9959353843f588791a7619fe38f6..4a95ef93d58eee37ed6f480c6b416f06312f6595 100644 (file)
@@ -24766,6 +24766,7 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, str
        int st_interval = 0;            /* Session-Timer negotiated refresh interval                */
        enum st_refresher tmp_st_ref = SESSION_TIMER_REFRESHER_AUTO; /* Session-Timer refresher     */
        int dlg_min_se = -1;
+       int dlg_max_se = global_max_se;
        struct {
                char exten[AST_MAX_EXTENSION];
                char context[AST_MAX_CONTEXT];
@@ -25368,19 +25369,17 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, str
                                tmp_st_ref = st_get_refresher(p);
                        }
 
+                       dlg_max_se = st_get_se(p, TRUE);
                        if (uac_max_se > 0) {
-                               int dlg_max_se = st_get_se(p, TRUE);
                                if (dlg_max_se >= uac_min_se) {
                                        st_interval = (uac_max_se < dlg_max_se) ? uac_max_se : dlg_max_se;
                                } else {
                                        st_interval = uac_max_se;
                                }
                        } else if (uac_min_se > 0) {
-                               int dlg_max_se = st_get_se(p, TRUE);
                                st_interval = MAX(dlg_max_se, uac_min_se);
                        } else {
-                               /* Set to default max value */
-                               st_interval = global_max_se;
+                               st_interval = dlg_max_se;
                        }
                        break;