mirror of https://github.com/sipwise/asterisk.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
3.6 KiB
110 lines
3.6 KiB
Index: app_queue.c
|
|
===================================================================
|
|
--- apps/app_queue.c (revisión: 232)
|
|
+++ apps/app_queue.c (copia de trabajo)
|
|
@@ -289,6 +289,8 @@
|
|
/*! \brief queues.conf [general] option */
|
|
static int montype_default = 0;
|
|
|
|
+/*! \brief queues.conf [general] option */
|
|
+static int shared_lastcall = 0;
|
|
|
|
|
|
enum queue_result {
|
|
@@ -334,6 +336,7 @@
|
|
int metric;
|
|
int oldstatus;
|
|
time_t lastcall;
|
|
+ struct call_queue *lastqueue;
|
|
struct member *member;
|
|
};
|
|
|
|
@@ -374,6 +377,7 @@
|
|
int status; /*!< Status of queue member */
|
|
int paused; /*!< Are we paused (not accepting calls)? */
|
|
time_t lastcall; /*!< When last successful call was hungup */
|
|
+ struct call_queue *lastqueue; /*!< Last queue we received a call */
|
|
unsigned int dead:1; /*!< Used to detect members deleted in realtime */
|
|
unsigned int delme:1; /*!< Flag to delete entry on reload */
|
|
};
|
|
@@ -1942,9 +1946,10 @@
|
|
const char *macrocontext, *macroexten;
|
|
|
|
/* on entry here, we know that tmp->chan == NULL */
|
|
- if (qe->parent->wrapuptime && (time(NULL) - tmp->lastcall < qe->parent->wrapuptime)) {
|
|
+ if ((tmp->lastqueue && tmp->lastqueue->wrapuptime && (time(NULL) - tmp->lastcall < tmp->lastqueue->wrapuptime)) ||
|
|
+ (!tmp->lastqueue && qe->parent->wrapuptime && (time(NULL) - tmp->lastcall < qe->parent->wrapuptime))) {
|
|
if (option_debug)
|
|
- ast_log(LOG_DEBUG, "Wrapuptime not yet expired for %s\n", tmp->interface);
|
|
+ ast_log(LOG_DEBUG, "Wrapuptime not yet expired on queue %s for %s\n", (tmp->lastqueue? tmp->lastqueue->name : qe->parent->name), tmp->interface);
|
|
if (qe->chan->cdr)
|
|
ast_cdr_busy(qe->chan->cdr);
|
|
tmp->stillgoing = 0;
|
|
@@ -2669,12 +2674,37 @@
|
|
|
|
static int update_queue(struct call_queue *q, struct member *member, int callcompletedinsl)
|
|
{
|
|
+ struct member *mem;
|
|
+ struct call_queue *qtmp;
|
|
+
|
|
+ if (shared_lastcall) {
|
|
+ AST_LIST_LOCK(&queues);
|
|
+ AST_LIST_TRAVERSE(&queues, qtmp, list) {
|
|
+ ao2_lock(qtmp);
|
|
+ if ((mem = ao2_find(qtmp->members, member, OBJ_POINTER))) {
|
|
+ time(&mem->lastcall);
|
|
+ mem->calls++;
|
|
+ mem->lastqueue = q;
|
|
+ ao2_ref(mem, -1);
|
|
+ }
|
|
+ ao2_unlock(qtmp);
|
|
+ }
|
|
+ AST_LIST_UNLOCK(&queues);
|
|
+ }
|
|
+
|
|
+
|
|
ao2_lock(q);
|
|
- time(&member->lastcall);
|
|
- member->calls++;
|
|
+
|
|
q->callscompleted++;
|
|
if (callcompletedinsl)
|
|
q->callscompletedinsl++;
|
|
+
|
|
+ if (!shared_lastcall) {
|
|
+ time(&member->lastcall);
|
|
+ member->calls++;
|
|
+ member->lastqueue = q;
|
|
+ }
|
|
+
|
|
ao2_unlock(q);
|
|
return 0;
|
|
}
|
|
@@ -3057,6 +3087,7 @@
|
|
tmp->member = cur;
|
|
tmp->oldstatus = cur->status;
|
|
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 */
|
|
@@ -3209,7 +3240,7 @@
|
|
pbx_builtin_setvar_helper(qe->chan, "MEMBERINTERFACE", member->interface);
|
|
|
|
/* Begin Monitoring */
|
|
- if (qe->parent->monfmt && *qe->parent->monfmt) {
|
|
+ if (qe->parent->monfmt && strlen(qe->parent->monfmt) > 2){
|
|
if (!qe->parent->montype) {
|
|
if (option_debug)
|
|
ast_log(LOG_DEBUG, "Starting Monitor as requested.\n");
|
|
@@ -4532,6 +4563,9 @@
|
|
if ((general_val = ast_variable_retrieve(cfg, "general", "monitor-type")))
|
|
if (!strcasecmp(general_val, "mixmonitor"))
|
|
montype_default = 1;
|
|
+ shared_lastcall = 0;
|
|
+ if ((general_val = ast_variable_retrieve(cfg, "general", "shared_lastcall")))
|
|
+ shared_lastcall = ast_true(general_val);
|
|
} else { /* Define queue */
|
|
/* Look for an existing one */
|
|
AST_LIST_TRAVERSE(&queues, q, list) {
|