]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixing autofill to be more accurate. Specifically, if calls ahead of the current
authorMark Michelson <mmichelson@digium.com>
Tue, 11 Dec 2007 17:42:25 +0000 (17:42 +0000)
committerMark Michelson <mmichelson@digium.com>
Tue, 11 Dec 2007 17:42:25 +0000 (17:42 +0000)
caller were ringing members (but not yet bridged) there could be available members
and waiting callers who would not get matched up. The member availability checker
was correctly determining the number of available members in this scenario, but
the queue itself did not parallelly reflect this status on the pending calls. This
commit corrects the issue.

(closes issue #11459, reported by equissoftware, patched by me)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@92323 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c

index d40237f75c1b83a310a50d85933fe6b1176d2cd4..e1e3374a83446692288cd9dffda61c0cd5199c97 100644 (file)
@@ -308,6 +308,7 @@ struct queue_ent {
        time_t last_pos;                    /*!< Last time we told the user their position */
        int opos;                           /*!< Where we started in the queue */
        int handled;                        /*!< Whether our call was handled */
+       int pending;                        /*!< Non-zero if we are attempting to call a member */
        int max_penalty;                    /*!< Limit the members that can take this call to this penalty or lower */
        time_t start;                       /*!< When we started holding */
        time_t expire;                      /*!< When this entry should expire (time out of queue) */
@@ -2320,7 +2321,7 @@ static int is_our_turn(struct queue_ent *qe)
                if (option_debug)
                        ast_log(LOG_DEBUG, "There are %d available members.\n", avl);
        
-               while ((idx < avl) && (ch) && (ch != qe)) {
+               while ((idx < avl) && (ch) &&  !ch->pending && (ch != qe)) {
                        idx++;
                        ch = ch->next;                  
                }
@@ -2658,6 +2659,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                to = (qe->expire - now) * 1000;
        else
                to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1;
+       ++qe->pending;
        ring_one(qe, outgoing, &numbusies);
        ast_mutex_unlock(&qe->parent->lock);
        if (use_weight)
@@ -2674,6 +2676,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
        ast_mutex_unlock(&qe->parent->lock);
        peer = lpeer ? lpeer->chan : NULL;
        if (!peer) {
+               qe->pending = 0;
                if (to) {
                        /* Must gotten hung up */
                        res = -1;