<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7481">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit

</div><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 disabled. 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>This patch updates the relevant places with "CREATED". It also updates the<br>"CREATED" status description (value shown in CLI/AMI/ARI output) to a value<br>of "NonQualified"/"NonQual" as this description is hopefully less confusing.<br><br>ASTERISK-27467<br><br>Change-Id: Id67509d25df92a72eb3683720ad2a95a27b50c89<br>---<br>M CHANGES<br>M UPGRADE.txt<br>M include/asterisk/res_pjsip.h<br>M main/stasis_endpoints.c<br>M res/res_pjsip.c<br>M res/res_pjsip/pjsip_options.c<br>M rest-api/api-docs/events.json<br>7 files changed, 37 insertions(+), 24 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/CHANGES b/CHANGES<br>index b2b7409..f367f46 100644<br>--- a/CHANGES<br>+++ b/CHANGES<br>@@ -26,6 +26,17 @@<br>    headers be retrieved from the REFER message and made accessible to the<br>    dialplan in the hash TRANSFER_DATA.<br> <br>+AMI<br>+------------------<br>+ * The ContactStatus and Status fields for the manager events ContactStatus<br>+   and ContactStatusDetail are now set to "NonQualified" when a contact exists<br>+   but has not been qualified.<br>+<br>+ARI<br>+------------------<br>+ * The ContactInfo event's contact_status field is now set to "NonQualified"<br>+   when a contact exists but has not been qualified.<br>+<br> ------------------------------------------------------------------------------<br> --- Functionality changes from Asterisk 15.1.0 to Asterisk 15.2.0 ------------<br> ------------------------------------------------------------------------------<br>diff --git a/UPGRADE.txt b/UPGRADE.txt<br>index 39c0f8c..dd37b25 100644<br>--- a/UPGRADE.txt<br>+++ b/UPGRADE.txt<br>@@ -31,6 +31,15 @@<br>    built.  Users should migrate to app_stack (Gosub).  A warning is logged<br>    the first time any Macro is used.<br> <br>+AMI:<br>+ - The ContactStatus and Status fields for the manager events ContactStatus<br>+   and ContactStatusDetail are now set to "NonQualified" when a contact exists<br>+   but has not been qualified.<br>+<br>+ARI:<br>+ - The ContactInfo event's contact_status field is now set to "NonQualified"<br>+   when a contact exists but has not been qualified.<br>+<br> New in 15.0.0:<br> <br> Build System:<br>diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h<br>index e71eb98..6c48d2e 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 (non-qualified) */<br>       CREATED,<br>      REMOVED,<br> };<br>diff --git a/main/stasis_endpoints.c b/main/stasis_endpoints.c<br>index 161fdfa..5cee22e 100644<br>--- a/main/stasis_endpoints.c<br>+++ b/main/stasis_endpoints.c<br>@@ -82,7 +82,7 @@<br>                                                 <enum name="Unknown"/><br>                                                <enum name="Unreachable"/><br>                                            <enum name="Reachable"/><br>-                                             <enum name="Created"/><br>+                                               <enum name="Unqualified"/><br>                                            <enum name="Removed"/><br>                                                <enum name="Updated"/><br>                                        </enumlist><br>diff --git a/res/res_pjsip.c b/res/res_pjsip.c<br>index 21e43f0..b50ee5f 100644<br>--- a/res/res_pjsip.c<br>+++ b/res/res_pjsip.c<br>@@ -2282,6 +2282,7 @@<br>                                         <enumlist><br>                                              <enum name="Reachable"/><br>                                              <enum name="Unreachable"/><br>+                                           <enum name="NonQualified"/><br>                                   </enumlist><br>                             </parameter><br>                            <parameter name="RoundtripUsec"><br>diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c<br>index 662166c..63e5ef6 100644<br>--- a/res/res_pjsip/pjsip_options.c<br>+++ b/res/res_pjsip/pjsip_options.c<br>@@ -41,7 +41,7 @@<br>      [UNAVAILABLE] = "Unreachable",<br>      [AVAILABLE] = "Reachable",<br>  [UNKNOWN] = "Unknown",<br>-     [CREATED] = "Created",<br>+     [CREATED] = "NonQualified",<br>         [REMOVED] = "Removed",<br> };<br> <br>@@ -49,7 +49,7 @@<br>   [UNAVAILABLE] = "Unavail",<br>  [AVAILABLE] = "Avail",<br>      [UNKNOWN] = "Unknown",<br>-     [CREATED] = "Created",<br>+     [CREATED] = "NonQual",<br>      [REMOVED] = "Removed",<br> };<br> <br>@@ -205,24 +205,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>@@ -595,7 +583,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>@@ -1127,7 +1115,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>diff --git a/rest-api/api-docs/events.json b/rest-api/api-docs/events.json<br>index 9ebbac0..e1b31bb 100644<br>--- a/rest-api/api-docs/events.json<br>+++ b/rest-api/api-docs/events.json<br>@@ -207,7 +207,7 @@<br>                                                    "Unreachable",<br>                                                      "Reachable",<br>                                                        "Unknown",<br>-                                                 "Created",<br>+                                                 "NonQualified",<br>                                                     "Removed"<br>                                           ]<br>                                     }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7481">change 7481</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/7481"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Id67509d25df92a72eb3683720ad2a95a27b50c89 </div>
<div style="display:none"> Gerrit-Change-Number: 7481 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>