1720,1765d1719 < /*! \brief Calculate the number of availabe queue members < * < * A member is available if it's not inuse (ringing). If the strategy set to < * QUEUE_STRATEGY_RINGALL, then return 1. < * < * Note: Duplicated code from is_our_turn(). < * < * By GC. 08/08/2008 < */ < static int get_available_members(struct call_queue *q) < { < struct member *mem; < int avl = 0; < < /* This needs a lock. How many members are available to be served? */ < ast_mutex_lock(&q->lock); < < if (q->strategy == QUEUE_STRATEGY_RINGALL) { < if (option_debug) < ast_log(LOG_DEBUG, "Even though there may be multiple members available, the strategy is ringall so only the head call is allowed in\n"); < avl = 1; < } else { < struct ao2_iterator mem_iter = ao2_iterator_init(q->members, 0); < while ((mem = ao2_iterator_next(&mem_iter))) { < switch (mem->status) { < case AST_DEVICE_INUSE: < if (!q->ringinuse) < break; < /* else fall through */ < case AST_DEVICE_NOT_INUSE: < case AST_DEVICE_UNKNOWN: < if (!mem->paused) < avl++; < break; < } < ao2_ref(mem, -1); < } < } < < if (option_debug) < ast_log(LOG_DEBUG, "There are %d available members.\n", avl); < < ast_mutex_unlock(&q->lock); < < return avl; < } 1784,1786c1738 < // changed by GC, 07/08/2008, use autofill logic to be able to send low priority call to agents while all high-priority calls are presented < //if ( q->weight > rq->weight) { < if ( (q->weight > rq->weight) && ( q->count >= get_available_members(q) ) ) { --- > if (q->weight > rq->weight) {