[Home]

Summary:ASTERISK-25469: chan_sip enabled unnegotiated session-timers after reINVITE if session-minse is non-default.
Reporter:Walter Doekes (wdoekes)Labels:
Date Opened:2015-10-16 04:14:54Date Closed:
Priority:MajorRegression?No
Status:Open/NewComponents:Channels/chan_sip/Interoperability
Versions:11.20.0 13.18.4 Frequency of
Occurrence
Related
Issues:
is related toASTERISK-19942 SIP Session Timers do not honour refresher
Environment:Attachments:( 0) iinv-o200-oinv-i200-oinv-i200-wait-obye.xml
Description:If I give Alice these two sip.conf settings:
{noformat}
session-minse=91
session-expires=92
{noformat}

If Alice then gets called, and Alice initiates one or more reINVITEs, Asterisk enables session timers. In the 200 to the reINVITEs, Asterisk will add this:
{noformat}
Session-Expires: 92;refresher=uac
{noformat}
and then it expects reinvites from Alice.

It seems plausible that the cause should be found here:
{code}
       /* Add Session-Timers related headers */
       if (st_get_mode(p, 0) == SESSION_TIMER_MODE_ORIGINATE
               || (st_get_mode(p, 0) == SESSION_TIMER_MODE_ACCEPT
                       && st_get_se(p, FALSE) != DEFAULT_MIN_SE)) {
               char i2astr[10];

               if (!p->stimer->st_interval) {
                       p->stimer->st_interval = st_get_se(p, TRUE);
               }

               p->stimer->st_active = TRUE;
               if (st_get_mode(p, 0) == SESSION_TIMER_MODE_ORIGINATE) {
                       snprintf(i2astr, sizeof(i2astr), "%d", p->stimer->st_interval);
                       add_header(&req, "Session-Expires", i2astr);
               }

               snprintf(i2astr, sizeof(i2astr), "%d", st_get_se(p, FALSE));
               add_header(&req, "Min-SE", i2astr);
       }
{code}

Default mode is SESSION_TIMER_MODE_ACCEPT and the get_mins_se is non-standard, so Asterisk enables session timers.

When the reINVITE is seen, we get here:
{noformat}
       /* If this is an invite, add Session-Timers related headers if the feature is active for this session */
       if (p->method == SIP_INVITE && p->stimer && p->stimer->st_active == TRUE) {
               char se_hdr[256];
               snprintf(se_hdr, sizeof(se_hdr), "%d;refresher=%s", p->stimer->st_interval,
                       p->stimer->st_ref == SESSION_TIMER_REFRESHER_US ? "uas" : "uac");
               add_header(resp, "Session-Expires", se_hdr);
...
{noformat}

The headers get added, and somewhere along the road, the timers get activated too.

See attached SIPp scenario that trips on the bug.
Comments:By: Asterisk Team (asteriskteam) 2015-10-16 04:14:55.874-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].