[Home]

Summary:ASTERISK-28950: Stale code in app_queue to check untouched channel
Reporter:Walter Doekes (wdoekes)Labels:
Date Opened:2020-06-15 03:09:38Date Closed:2020-06-17 08:33:51
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:Applications/app_queue
Versions:13.34.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:
Description:Basically, when I fixed up a comment in ASTERISK-28644, I missed that code could've been removed too.

In 465a7518cc, this change was done:
{noformat}
@@ -738,10 +749,7 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri
               }
               /* Special case: If we ring everyone, go ahead and ring them, otherwise
                  just calculate their metric for the appropriate strategy */
-               if (!qe->parent->strategy)
-                       ring_entry(qe, tmp);
-               else
-                       calc_metric(qe->parent, cur, x++, qe, tmp);
+               calc_metric(qe->parent, cur, x++, qe, tmp);
               /* Put them in the list of outgoing thingies...  We're ready now.
                  XXX If we're forcibly removed, these outgoing calls won't get
                  hung up XXX */
{noformat}
In 161e762742e14, I fixed the stale comment:
{noformat}
@@ -6850,8 +6850,7 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a
               tmp->lastcall = cur->lastcall;
               tmp->lastqueue = cur->lastqueue;
               ast_copy_string(tmp->interface, cur->interface, sizeof(tmp->interface));
-               /* Special case: If we ring everyone, go ahead and ring them, otherwise
-                  just calculate their metric for the appropriate strategy */
+               /* Calculate the metric for the appropriate strategy. */
               if (!calc_metric(qe->parent, cur, x++, qe, tmp)) {
                       /* Put them in the list of outgoing thingies...  We're ready now.
                          XXX If we're forcibly removed, these outgoing calls won't get
{noformat}
But I missed the {{if}} after it:
{code}
               /* Calculate the metric for the appropriate strategy. */
               if (!calc_metric(qe->parent, cur, x++, qe, tmp)) {
                       /* Put them in the list of outgoing thingies...  We're ready now.
                          XXX If we're forcibly removed, these outgoing calls won't get
                          hung up XXX */
                       tmp->q_next = outgoing;
                       outgoing = tmp;
                       /* If this line is up, don't try anybody else */
                       if (outgoing->chan && (ast_channel_state(outgoing->chan) == AST_STATE_UP))
                               break;
               } else {
{code}
The {{outgoing->chan}} makes no sense, as {{calc_metric}} does not touch chan. This code should've been removed when {{ring_entry}} was moved.

Suggested fix:
{noformat}
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -6868,9 +6868,6 @@ static int try_calling(struct queue_ent *qe, struct ast_flags opts, char **opt_a
                          hung up XXX */
                       tmp->q_next = outgoing;
                       outgoing = tmp;
-                       /* If this line is up, don't try anybody else */
-                       if (outgoing->chan && (ast_channel_state(outgoing->chan) == AST_STATE_UP))
-                               break;
               } else {
                       callattempt_free(tmp);
               }
{noformat}
Comments:By: Asterisk Team (asteriskteam) 2020-06-15 03:09:39.757-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].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Friendly Automation (friendly-automation) 2020-06-17 08:33:53.070-0500

Change 14559 merged by Friendly Automation:
app_queue: Remove stale code in try_calling

[https://gerrit.asterisk.org/c/asterisk/+/14559|https://gerrit.asterisk.org/c/asterisk/+/14559]

By: Friendly Automation (friendly-automation) 2020-06-17 08:33:58.730-0500

Change 14561 merged by Friendly Automation:
app_queue: Remove stale code in try_calling

[https://gerrit.asterisk.org/c/asterisk/+/14561|https://gerrit.asterisk.org/c/asterisk/+/14561]

By: Friendly Automation (friendly-automation) 2020-06-17 08:38:54.199-0500

Change 14560 merged by Friendly Automation:
app_queue: Remove stale code in try_calling

[https://gerrit.asterisk.org/c/asterisk/+/14560|https://gerrit.asterisk.org/c/asterisk/+/14560]

By: Friendly Automation (friendly-automation) 2020-06-17 09:35:51.202-0500

Change 14581 merged by George Joseph:
app_queue: Remove stale code in try_calling

[https://gerrit.asterisk.org/c/asterisk/+/14581|https://gerrit.asterisk.org/c/asterisk/+/14581]