<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6901">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_sip: Fix SUBSCRIBE with missing "Expires" header.<br><br>When chan_sip receives a SUBSCRIBE request with no "Expires" header it<br>processes the request as an unsubscribe.  This is incorrect, per RFC3264<br>when the "Expires" header is missing a default expiry should be used.<br><br>ASTERISK-18140<br><br>Change-Id: Ibf6dcd4fdd07a32c2bc38be1dd557981f08188b5<br>---<br>M channels/chan_sip.c<br>1 file changed, 7 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/01/6901/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/channels/chan_sip.c b/channels/chan_sip.c<br>index 8833e71..cdd78fd 100644<br>--- a/channels/chan_sip.c<br>+++ b/channels/chan_sip.c<br>@@ -28511,7 +28511,13 @@<br>                 p->lastinvite = seqno;<br>     }<br>     if (!p->needdestroy) {<br>-            p->expiry = atoi(sip_get_header(req, "Expires"));<br>+               const char *expires_str = sip_get_header(req, "Expires");<br>+<br>+               if (ast_strlen_zero(expires_str)) {<br>+                  p->expiry = default_expiry;<br>+               } else {<br>+                     p->expiry = atoi(expires_str);<br>+            }<br> <br>          /* check if the requested expiry-time is within the approved limits from sip.conf */<br>          if (p->expiry > max_subexpiry) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6901">change 6901</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6901"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ibf6dcd4fdd07a32c2bc38be1dd557981f08188b5 </div>
<div style="display:none"> Gerrit-Change-Number: 6901 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>