--- asterisk-11.5.0.o/apps/app_queue.c 2013-06-10 16:25:23.000000000 +0200 +++ asterisk-11.5.0/apps/app_queue.c 2013-11-25 22:34:20.644604203 +0200 @@ -1148,6 +1148,7 @@ char membername[80]; /*!< Member name to use in queue logs */ int penalty; /*!< Are we a last resort? */ int calls; /*!< Number of calls serviced by this member */ + int missedcalls; /*!< Number of calls that we attempted to connect but didn't get answered */ int dynamic; /*!< Are we dynamically added? */ int realtime; /*!< Is this member realtime? */ int status; /*!< Status of queue member */ @@ -1694,11 +1695,12 @@ "Membership: %s\r\n" "Penalty: %d\r\n" "CallsTaken: %d\r\n" + "CallsMissed: %d\r\n" "LastCall: %d\r\n" "Status: %d\r\n" "Paused: %d\r\n", q->name, m->interface, m->membername, m->state_interface, m->dynamic ? "dynamic" : m->realtime ? "realtime" : "static", - m->penalty, m->calls, (int)m->lastcall, m->status, m->paused + m->penalty, m->calls, m->missedcalls, (int)m->lastcall, m->status, m->paused ); return 0; @@ -2095,6 +2097,7 @@ struct ao2_iterator mem_iter = ao2_iterator_init(q->members, 0); while ((mem = ao2_iterator_next(&mem_iter))) { mem->calls = 0; + mem->missedcalls = 0; mem->lastcall = 0; ao2_ref(mem, -1); } @@ -3997,6 +4000,8 @@ /*! \brief RNA == Ring No Answer. Common code that is executed when we try a queue member and they don't answer. */ static void rna(int rnatime, struct queue_ent *qe, char *interface, char *membername, int autopause) { + struct member *mem; + ast_verb(3, "Nobody picked up in %d ms\n", rnatime); /* Stop ringing, and resume MOH if specified */ @@ -4043,9 +4048,16 @@ qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : ""); } ast_queue_log(qe->parent->name, ast_channel_uniqueid(qe->chan), membername, "RINGNOANSWER", "%d", rnatime); + + ao2_lock(qe->parent); + if ((mem = interface_exists(qe->parent, interface))) { + mem->missedcalls++; + ao2_ref(mem, -1); + } + ao2_unlock(qe->parent); + if (qe->parent->autopause != QUEUE_AUTOPAUSE_OFF && autopause) { if (qe->parent->autopausedelay > 0) { - struct member *mem; ao2_lock(qe->parent); if ((mem = interface_exists(qe->parent, interface))) { time_t idletime = time(&idletime)-mem->lastcall; @@ -6161,12 +6173,13 @@ "Membership: %s\r\n" "Penalty: %d\r\n" "CallsTaken: %d\r\n" + "CallsMissed: %d\r\n" "LastCall: %d\r\n" "Status: %d\r\n" "Paused: %d\r\n", q->name, new_member->interface, new_member->membername, state_interface, "dynamic", - new_member->penalty, new_member->calls, (int) new_member->lastcall, + new_member->penalty, new_member->calls, new_member->missedcalls, (int) new_member->lastcall, new_member->status, new_member->paused); if (is_member_available(new_member)) { @@ -8662,13 +8675,14 @@ "Membership: %s\r\n" "Penalty: %d\r\n" "CallsTaken: %d\r\n" + "CallsMissed: %d\r\n" "LastCall: %d\r\n" "Status: %d\r\n" "Paused: %d\r\n" "%s" "\r\n", q->name, mem->membername, mem->interface, mem->state_interface, mem->dynamic ? "dynamic" : "static", - mem->penalty, mem->calls, (int)mem->lastcall, mem->status, mem->paused, idText); + mem->penalty, mem->calls, mem->missedcalls, (int)mem->lastcall, mem->status, mem->paused, idText); } ao2_ref(mem, -1); }