<p>Kevin Harwell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7479">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip_options: wrongly applied "UNKNOWN" status<br><br>A couple of places were setting the status to "UNKNOWN" when qualifies were<br>being disabeled. Instead this should be set to the "CREATED" status that<br>represents when a contact is given (uri available), but the qualify frequency<br>is set to zero so we don't know the status.<br><br>ASTERISK-27467<br><br>Change-Id: Id67509d25df92a72eb3683720ad2a95a27b50c89<br>---<br>M include/asterisk/res_pjsip.h<br>M res/res_pjsip/pjsip_options.c<br>2 files changed, 12 insertions(+), 20 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/79/7479/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h<br>index ac1267d..5246317 100644<br>--- a/include/asterisk/res_pjsip.h<br>+++ b/include/asterisk/res_pjsip.h<br>@@ -289,9 +289,13 @@<br> * \brief Status type for a contact.<br> */<br> enum ast_sip_contact_status_type {<br>+ /*! Frequency > 0, but no response from remote uri */<br> UNAVAILABLE,<br>+ /*! Frequency > 0, and got response from remote uri */<br> AVAILABLE,<br>+ /*! Default last status, and when a contact status object is not found */<br> UNKNOWN,<br>+ /*! Frequency == 0, has a contact, but don't know status */<br> CREATED,<br> REMOVED,<br> };<br>diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c<br>index d4ea911..0a96c71 100644<br>--- a/res/res_pjsip/pjsip_options.c<br>+++ b/res/res_pjsip/pjsip_options.c<br>@@ -208,24 +208,12 @@<br> return;<br> }<br> <br>- if (is_contact_refresh<br>- && status->status == CREATED) {<br>- /*<br>- * The contact status hasn't been updated since creation<br>- * and we don't want to re-send a created status.<br>- */<br>- if (contact->qualify_frequency<br>- || status->rtt_start.tv_sec > 0) {<br>- /* Ignore, the status will change soon. */<br>- return;<br>- }<br>-<br>- /*<br>- * Convert to a regular contact status update<br>- * because the status may never change.<br>- */<br>- is_contact_refresh = 0;<br>- value = UNKNOWN;<br>+ /*<br>+ * If the current status is CREATED, and it's a refresh or the given value is<br>+ * also CREATED then there is nothing to update as nothing needs to change.<br>+ */<br>+ if (status->status == CREATED && (is_contact_refresh || status->status == value)) {<br>+ return;<br> }<br> <br> update = ast_sorcery_alloc(ast_sip_get_sorcery(), CONTACT_STATUS,<br>@@ -605,7 +593,7 @@<br> <br> schedule_qualify(contact, contact->qualify_frequency * 1000);<br> } else {<br>- update_contact_status(contact, UNKNOWN, 0);<br>+ update_contact_status(contact, CREATED, 0);<br> }<br> }<br> <br>@@ -1137,7 +1125,7 @@<br> if (contact->qualify_frequency) {<br> schedule_qualify(contact, initial_interval);<br> } else {<br>- update_contact_status(contact, UNKNOWN, 0);<br>+ update_contact_status(contact, CREATED, 0);<br> }<br> }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7479">change 7479</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/7479"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: certified/13.18 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Id67509d25df92a72eb3683720ad2a95a27b50c89 </div>
<div style="display:none"> Gerrit-Change-Number: 7479 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>