<p>Walter Doekes has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13844">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_queue: Refactor odd placement of if's around say_position<br><br>Change-Id: Icba97905e331812f129e5966e91a59b104c7a748<br>---<br>M apps/app_queue.c<br>1 file changed, 20 insertions(+), 38 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/44/13844/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_queue.c b/apps/app_queue.c</span><br><span>index fb489a5..a9630c9 100644</span><br><span>--- a/apps/app_queue.c</span><br><span>+++ b/apps/app_queue.c</span><br><span>@@ -1485,7 +1485,7 @@</span><br><span>        int linwrapped;                        /*!< Is the linpos wrapped? */</span><br><span>     time_t start;                          /*!< When we started holding */</span><br><span>    time_t expire;                         /*!< When this entry should expire (time out of queue) */</span><br><span style="color: hsl(0, 100%, 40%);">-     int cancel_answered_elsewhere;         /*!< Whether we should force the CAE flag on this call (C) option*/</span><br><span style="color: hsl(120, 100%, 40%);">+ int cancel_answered_elsewhere;         /*!< Whether we should force the CAE flag on this call (C) option */</span><br><span>       struct ast_channel *chan;              /*!< Our channel */</span><br><span>        AST_LIST_HEAD_NOLOCK(,penalty_rule) qe_rules; /*!< Local copy of the queue's penalty rules */</span><br><span>         struct penalty_rule *pr;               /*!< Pointer to the next penalty rule to implement */</span><br><span>@@ -1510,7 +1510,7 @@</span><br><span>      int callcompletedinsl;               /*!< Whether the current call was completed within service level */</span><br><span>  time_t starttime;                    /*!< The time at which the member answered the current caller. */</span><br><span>    time_t lastcall;                     /*!< When last successful call was hungup */</span><br><span style="color: hsl(0, 100%, 40%);">-    struct call_queue *lastqueue;        /*!< Last queue we received a call */</span><br><span style="color: hsl(120, 100%, 40%);">+ struct call_queue *lastqueue;        /*!< Last queue we received a call */</span><br><span>        unsigned int dead:1;                 /*!< Used to detect members deleted in realtime */</span><br><span>   unsigned int delme:1;                /*!< Flag to delete entry on reload */</span><br><span>       char rt_uniqueid[80];                /*!< Unique id of realtime member entry */</span><br><span>@@ -3867,44 +3867,26 @@</span><br><span>                 /* Say we're next, if we are */</span><br><span>          if (qe->pos == 1) {</span><br><span>                       res = play_file(qe->chan, qe->parent->sound_next);</span><br><span style="color: hsl(0, 100%, 40%);">-                     if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                              goto playout;</span><br><span style="color: hsl(120, 100%, 40%);">+                 if (!res) {</span><br><span style="color: hsl(120, 100%, 40%);">+                           goto posout;</span><br><span>                         }</span><br><span style="color: hsl(0, 100%, 40%);">-                       goto posout;</span><br><span style="color: hsl(120, 100%, 40%);">+          /* Say there are more than N callers */</span><br><span style="color: hsl(120, 100%, 40%);">+               } else if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit) {</span><br><span style="color: hsl(120, 100%, 40%);">+                     res = (</span><br><span style="color: hsl(120, 100%, 40%);">+                               play_file(qe->chan, qe->parent->queue_quantity1) ||</span><br><span style="color: hsl(120, 100%, 40%);">+                          ast_say_number(qe->chan, qe->parent->announcepositionlimit, AST_DIGIT_ANY,</span><br><span style="color: hsl(120, 100%, 40%);">+                                           ast_channel_language(qe->chan), NULL) || /* Needs gender */</span><br><span style="color: hsl(120, 100%, 40%);">+                                play_file(qe->chan, qe->parent->queue_quantity2));</span><br><span style="color: hsl(120, 100%, 40%);">+           /* Say there are currently N callers waiting */</span><br><span>              } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                        if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit){</span><br><span style="color: hsl(0, 100%, 40%);">-                               /* More than Case*/</span><br><span style="color: hsl(0, 100%, 40%);">-                             res = play_file(qe->chan, qe->parent->queue_quantity1);</span><br><span style="color: hsl(0, 100%, 40%);">-                                if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                               res = ast_say_number(qe->chan, qe->parent->announcepositionlimit, AST_DIGIT_ANY, ast_channel_language(qe->chan), NULL); /* Needs gender */</span><br><span style="color: hsl(0, 100%, 40%);">-                          if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                       } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                                /* Normal Case */</span><br><span style="color: hsl(0, 100%, 40%);">-                               res = play_file(qe->chan, qe->parent->sound_thereare);</span><br><span style="color: hsl(0, 100%, 40%);">-                         if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                               res = ast_say_number(qe->chan, qe->pos, AST_DIGIT_ANY, ast_channel_language(qe->chan), NULL); /* Needs gender */</span><br><span style="color: hsl(0, 100%, 40%);">-                               if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                       }</span><br><span style="color: hsl(0, 100%, 40%);">-                       if (qe->parent->announceposition == ANNOUNCEPOSITION_MORE_THAN && qe->pos > qe->parent->announcepositionlimit){</span><br><span style="color: hsl(0, 100%, 40%);">-                               /* More than Case*/</span><br><span style="color: hsl(0, 100%, 40%);">-                             res = play_file(qe->chan, qe->parent->queue_quantity2);</span><br><span style="color: hsl(0, 100%, 40%);">-                                if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                       } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                                res = play_file(qe->chan, qe->parent->sound_calls);</span><br><span style="color: hsl(0, 100%, 40%);">-                            if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                      goto playout;</span><br><span style="color: hsl(0, 100%, 40%);">-                           }</span><br><span style="color: hsl(0, 100%, 40%);">-                       }</span><br><span style="color: hsl(120, 100%, 40%);">+                     res = (</span><br><span style="color: hsl(120, 100%, 40%);">+                               play_file(qe->chan, qe->parent->sound_thereare) ||</span><br><span style="color: hsl(120, 100%, 40%);">+                           ast_say_number(qe->chan, qe->pos, AST_DIGIT_ANY,</span><br><span style="color: hsl(120, 100%, 40%);">+                                                ast_channel_language(qe->chan), NULL) || /* Needs gender */</span><br><span style="color: hsl(120, 100%, 40%);">+                                play_file(qe->chan, qe->parent->sound_calls));</span><br><span style="color: hsl(120, 100%, 40%);">+               }</span><br><span style="color: hsl(120, 100%, 40%);">+             if (res) {</span><br><span style="color: hsl(120, 100%, 40%);">+                    goto playout;</span><br><span>                }</span><br><span>    }</span><br><span>    /* Round hold time to nearest minute */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13844">change 13844</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/+/13844"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: Icba97905e331812f129e5966e91a59b104c7a748 </div>
<div style="display:none"> Gerrit-Change-Number: 13844 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Walter Doekes <walter+asterisk@wjd.nu> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>