<p>Friendly Automation <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11362">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
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip_options.c: Allow immediate qualifies for new contacts.<br><br>When multiple endpoints try to register close together using the same<br>AOR with qualify_frequency set, one contact would qualify immediately<br>while the other contacts would have to wait out the duration of the<br>timer before being able to qualify. Changing the conditional to check<br>the contact container count for a non-zero value allows all contacts to<br>qualify immediately.<br><br>Change-Id: I79478118ee7e0d6e76af7c354d66684220db9415<br>---<br>M res/res_pjsip/pjsip_options.c<br>1 file changed, 24 insertions(+), 23 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c</span><br><span>index a7aefaa..2c30580 100644</span><br><span>--- a/res/res_pjsip/pjsip_options.c</span><br><span>+++ b/res/res_pjsip/pjsip_options.c</span><br><span>@@ -2100,30 +2100,31 @@</span><br><span>         ao2_cleanup(contact_status);</span><br><span> </span><br><span>     if (task_data->aor_options->qualify_frequency) {</span><br><span style="color: hsl(0, 100%, 40%);">-          /* If this is the first contact we need to schedule up qualification */</span><br><span style="color: hsl(0, 100%, 40%);">-         if (ao2_container_count(task_data->aor_options->contacts) == 1) {</span><br><span style="color: hsl(0, 100%, 40%);">-                 ast_debug(3, "Starting scheduled callback on AOR '%s' for qualifying as there is now a contact on it\n",</span><br><span style="color: hsl(120, 100%, 40%);">+            /* There will always be a contact here, and we need to immediately schedule</span><br><span style="color: hsl(120, 100%, 40%);">+            * a qualify so that contacts are not waiting for the qualify_frequency</span><br><span style="color: hsl(120, 100%, 40%);">+                * timer duration before qualifying.</span><br><span style="color: hsl(120, 100%, 40%);">+           */</span><br><span style="color: hsl(120, 100%, 40%);">+           ast_debug(3, "Starting scheduled callback on AOR '%s' for qualifying as there is now a contact on it\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                    task_data->aor_options->name);</span><br><span style="color: hsl(120, 100%, 40%);">+          /*</span><br><span style="color: hsl(120, 100%, 40%);">+             * We immediately schedule the initial qualify so that we get</span><br><span style="color: hsl(120, 100%, 40%);">+          * reachable/unreachable as soon as possible.  Realistically</span><br><span style="color: hsl(120, 100%, 40%);">+           * since they pretty much just registered they should be</span><br><span style="color: hsl(120, 100%, 40%);">+               * reachable.</span><br><span style="color: hsl(120, 100%, 40%);">+          */</span><br><span style="color: hsl(120, 100%, 40%);">+           if (task_data->aor_options->sched_task) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       ast_sip_sched_task_cancel(task_data->aor_options->sched_task);</span><br><span style="color: hsl(120, 100%, 40%);">+                  ao2_ref(task_data->aor_options->sched_task, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+                        task_data->aor_options->sched_task = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+              }</span><br><span style="color: hsl(120, 100%, 40%);">+             task_data->aor_options->sched_task = ast_sip_schedule_task(</span><br><span style="color: hsl(120, 100%, 40%);">+                     task_data->aor_options->serializer, 1, sip_options_qualify_aor,</span><br><span style="color: hsl(120, 100%, 40%);">+                 ast_taskprocessor_name(task_data->aor_options->serializer),</span><br><span style="color: hsl(120, 100%, 40%);">+                     task_data->aor_options,</span><br><span style="color: hsl(120, 100%, 40%);">+                    AST_SIP_SCHED_TASK_VARIABLE | AST_SIP_SCHED_TASK_DATA_AO2);</span><br><span style="color: hsl(120, 100%, 40%);">+           if (!task_data->aor_options->sched_task) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_log(LOG_ERROR, "Unable to schedule qualify for contacts of AOR '%s'\n",</span><br><span>                                task_data->aor_options->name);</span><br><span style="color: hsl(0, 100%, 40%);">-                    /*</span><br><span style="color: hsl(0, 100%, 40%);">-                       * We immediately schedule the initial qualify so that we get</span><br><span style="color: hsl(0, 100%, 40%);">-                    * reachable/unreachable as soon as possible.  Realistically</span><br><span style="color: hsl(0, 100%, 40%);">-                     * since they pretty much just registered they should be</span><br><span style="color: hsl(0, 100%, 40%);">-                         * reachable.</span><br><span style="color: hsl(0, 100%, 40%);">-                    */</span><br><span style="color: hsl(0, 100%, 40%);">-                     if (task_data->aor_options->sched_task) {</span><br><span style="color: hsl(0, 100%, 40%);">-                         ast_sip_sched_task_cancel(task_data->aor_options->sched_task);</span><br><span style="color: hsl(0, 100%, 40%);">-                            ao2_ref(task_data->aor_options->sched_task, -1);</span><br><span style="color: hsl(0, 100%, 40%);">-                          task_data->aor_options->sched_task = NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-                        }</span><br><span style="color: hsl(0, 100%, 40%);">-                       task_data->aor_options->sched_task = ast_sip_schedule_task(</span><br><span style="color: hsl(0, 100%, 40%);">-                               task_data->aor_options->serializer, 1, sip_options_qualify_aor,</span><br><span style="color: hsl(0, 100%, 40%);">-                           ast_taskprocessor_name(task_data->aor_options->serializer),</span><br><span style="color: hsl(0, 100%, 40%);">-                               task_data->aor_options,</span><br><span style="color: hsl(0, 100%, 40%);">-                              AST_SIP_SCHED_TASK_VARIABLE | AST_SIP_SCHED_TASK_DATA_AO2);</span><br><span style="color: hsl(0, 100%, 40%);">-                     if (!task_data->aor_options->sched_task) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                ast_log(LOG_ERROR, "Unable to schedule qualify for contacts of AOR '%s'\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                                   task_data->aor_options->name);</span><br><span style="color: hsl(0, 100%, 40%);">-                    }</span><br><span>            }</span><br><span>    } else {</span><br><span>             /*</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11362">change 11362</a>. To unsubscribe, or for help writing mail filters, 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/c/asterisk/+/11362"/><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-Change-Id: I79478118ee7e0d6e76af7c354d66684220db9415 </div>
<div style="display:none"> Gerrit-Change-Number: 11362 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>