mirror of
https://github.com/asterisk/asterisk.git
synced 2026-07-19 18:01:39 -07:00
app_queue: Add 'prio' setting to the 'force_longest_waiting_caller' option
This adds a 'prio' setting to ensure that call priority is respected across multiple queues. Using 'yes' could cause high-priority callers to be skipped if a caller in another queue had a longer wait time, regardless of priority. Resolves: #1637 UserNote: The 'force_longest_waiting_caller' option now supports a 'prio' setting. When set to 'prio', calls are offered by priority first, then by wait time.
This commit is contained in:
+20
-2
@@ -1986,6 +1986,10 @@ struct penalty_rule {
|
||||
#define ANNOUNCEPOSITION_MORE_THAN 3 /*!< We say "Currently there are more than <limit>" */
|
||||
#define ANNOUNCEPOSITION_LIMIT 4 /*!< We not announce position more than \<limit\> */
|
||||
|
||||
#define FORCELONGESTWAITINGCALLER_NO 0
|
||||
#define FORCELONGESTWAITINGCALLER_YES 1
|
||||
#define FORCELONGESTWAITINGCALLER_PRIO 2 /*!< Account for call priorities when forcing longest waiting caller */
|
||||
|
||||
struct call_queue {
|
||||
AST_DECLARE_STRING_FIELDS(
|
||||
/*! Queue name */
|
||||
@@ -4822,7 +4826,13 @@ static int is_longest_waiting_caller(struct queue_ent *caller, struct member *me
|
||||
* will be unused until the first caller is picked up.
|
||||
*/
|
||||
if (!ch->pending) {
|
||||
if (ch->start < caller->start) {
|
||||
if (ch->prio != caller->prio && force_longest_waiting_caller == FORCELONGESTWAITINGCALLER_PRIO) {
|
||||
if (ch->prio > caller->prio) { /* This queue has a caller with higher priority. */
|
||||
ast_debug(1, "Queue %s has a call at position %i that's higher priority (%d vs %d)\n",
|
||||
q->name, ch->pos, ch->prio, caller->prio);
|
||||
is_longest_waiting = 0;
|
||||
}
|
||||
} else if (ch->start < caller->start) {
|
||||
ast_debug(1, "Queue %s has a call at position %i that's been waiting longer (%li vs %li)\n",
|
||||
q->name, ch->pos, ch->start, caller->start);
|
||||
is_longest_waiting = 0;
|
||||
@@ -4831,6 +4841,8 @@ static int is_longest_waiting_caller(struct queue_ent *caller, struct member *me
|
||||
}
|
||||
ch = ch->next;
|
||||
}
|
||||
|
||||
ao2_ref(mem, -1);
|
||||
}
|
||||
}
|
||||
ao2_unlock(q);
|
||||
@@ -9936,7 +9948,13 @@ static void queue_set_global_params(struct ast_config *cfg)
|
||||
log_membername_as_agent = ast_true(general_val);
|
||||
}
|
||||
if ((general_val = ast_variable_retrieve(cfg, "general", "force_longest_waiting_caller"))) {
|
||||
force_longest_waiting_caller = ast_true(general_val);
|
||||
if (!strcasecmp(general_val, "prio")) {
|
||||
force_longest_waiting_caller = FORCELONGESTWAITINGCALLER_PRIO;
|
||||
} else if (ast_true(general_val)) {
|
||||
force_longest_waiting_caller = FORCELONGESTWAITINGCALLER_YES;
|
||||
} else {
|
||||
force_longest_waiting_caller = FORCELONGESTWAITINGCALLER_NO;
|
||||
}
|
||||
}
|
||||
if ((general_val = ast_variable_retrieve(cfg, "general", "log_unpause_on_reason_change"))) {
|
||||
log_unpause_on_reason_change = ast_true(general_val);
|
||||
|
||||
@@ -73,6 +73,8 @@ monitor-type = MixMonitor
|
||||
; is a member of another queue with a call that's been waiting longer. If so, the current
|
||||
; call is not offered to the agent. The default value is 'no'.
|
||||
;
|
||||
; Setting this to 'prio' performs the same check but also accounts for call priority.
|
||||
;
|
||||
;force_longest_waiting_caller = no
|
||||
;
|
||||
; Add unpause event to queue log in case of pause send twice with different reason code.
|
||||
|
||||
Reference in New Issue
Block a user