Index: apps/app_queue.c =================================================================== --- apps/app_queue.c (revision 278019) +++ apps/app_queue.c (working copy) @@ -879,6 +879,7 @@ int status; /*!< Status of queue member */ int paused; /*!< Are we paused (not accepting calls)? */ time_t lastcall; /*!< When last successful call was hungup */ + time_t lastpause; /*!< When started last pause */ 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 */ @@ -910,10 +911,10 @@ AST_LIST_ENTRY(penalty_rule) list; /*!< Next penalty_rule */ }; -#define ANNOUNCEPOSITION_YES 1 /*!< We announce position */ -#define ANNOUNCEPOSITION_NO 2 /*!< We don't announce position */ -#define ANNOUNCEPOSITION_MORE_THAN 3 /*!< We say "Currently there are more than " */ -#define ANNOUNCEPOSITION_LIMIT 4 /*!< We not announce position more than */ +#define ANNOUNCEPOSITION_YES 1 /*!< We announce position */ +#define ANNOUNCEPOSITION_NO 2 /*!< We don't announce position */ +#define ANNOUNCEPOSITION_MORE_THAN 3 /*!< We say "Currently there are more than " */ +#define ANNOUNCEPOSITION_LIMIT 4 /*!< We not announce position more than */ struct call_queue { AST_DECLARE_STRING_FIELDS( @@ -1273,10 +1274,11 @@ "Penalty: %d\r\n" "CallsTaken: %d\r\n" "LastCall: %d\r\n" + "LastPause: %d\r\n" "Status: %d\r\n" "Paused: %d\r\n", q->name, m->interface, m->membername, m->dynamic ? "dynamic" : m->realtime ? "realtime" : "static", - m->penalty, m->calls, (int)m->lastcall, m->status, m->paused + m->penalty, m->calls, (int)m->lastcall, (int)m->lastpause, m->status, m->paused ); return 0; @@ -1577,7 +1579,9 @@ struct ao2_iterator mem_iter = ao2_iterator_init(q->members, 0); while ((mem = ao2_iterator_next(&mem_iter))) { mem->calls = 0; + mem->paused = 0; mem->lastcall = 0; + mem->lastpause = 0; ao2_ref(mem, -1); } ao2_iterator_destroy(&mem_iter); @@ -3854,6 +3858,11 @@ q->callscompleted++; if (callcompletedinsl) q->callscompletedinsl++; + + /* Update LastPause field if the member is paused on the last update (hangup call) */ + if (member->paused) + time(&member->lastpause); + /* Calculate talktime using the same exponential average as holdtime code*/ oldtalktime = q->talktime; q->talktime = (((oldtalktime << 2) - oldtalktime) + newtalktime) >> 2; @@ -5054,12 +5063,13 @@ "Penalty: %d\r\n" "CallsTaken: %d\r\n" "LastCall: %d\r\n" + "LastPause: %d\r\n" "Status: %d\r\n" "Paused: %d\r\n", q->name, new_member->interface, new_member->membername, "dynamic", new_member->penalty, new_member->calls, (int) new_member->lastcall, - new_member->status, new_member->paused); + (int) new_member->lastpause, new_member->status, new_member->paused); ao2_ref(new_member, -1); new_member = NULL; @@ -5139,6 +5149,12 @@ "Paused: %d\r\n", q->name, mem->interface, mem->membername, paused); } + + /* Update LastPause Field */ + if (paused && mem->status == AST_DEVICE_NOT_INUSE) { + time(&mem->lastpause); + } + ao2_ref(mem, -1); } } @@ -7047,12 +7063,13 @@ "Penalty: %d\r\n" "CallsTaken: %d\r\n" "LastCall: %d\r\n" + "LastPause: %d\r\n" "Status: %d\r\n" "Paused: %d\r\n" "%s" "\r\n", q->name, mem->membername, mem->interface, mem->dynamic ? "dynamic" : "static", - mem->penalty, mem->calls, (int)mem->lastcall, mem->status, mem->paused, idText); + mem->penalty, mem->calls, (int)mem->lastcall, (int)mem->lastpause, mem->status, mem->paused, idText); } ao2_ref(mem, -1); }