--- asterisk-13.1.0-__patchlist1421832993/apps/app_queue.c 2015-01-21 10:36:33.032771187 +0100 +++ apps/app_queue.c 2015-01-30 18:22:55.138367421 +0100 @@ -1470,6 +1470,7 @@ AST_LIST_HEAD_NOLOCK(,penalty_rule) qe_rules; /*!< Local copy of the queue's penalty rules */ struct penalty_rule *pr; /*!< Pointer to the next penalty rule to implement */ struct queue_ent *next; /*!< The next queue entry */ + time_t time_when_became_head_caller; }; struct member { @@ -5267,7 +5268,7 @@ break; /* see if we need to move to the next penalty level for this queue */ - while (qe->pr && ((time(NULL) - qe->start) >= qe->pr->time)) { + while (qe->pr && (qe->time_when_became_head_caller != 0) && ((time(NULL) - qe->time_when_became_head_caller) > qe->pr->time)) { update_qe_rule(qe); } @@ -5292,7 +5293,10 @@ break; } } - + if (!res) { + qe->time_when_became_head_caller=time(NULL); + ast_verb(3,"queue: my turn qe->time %d\n",qe->start); + } return res; } @@ -7892,7 +7896,7 @@ } /* see if we need to move to the next penalty level for this queue */ - while (qe.pr && ((time(NULL) - qe.start) > qe.pr->time)) { + while (qe.pr && (qe.time_when_became_head_caller != 0) && ((time(NULL) - qe.time_when_became_head_caller) > qe.pr->time)) { update_qe_rule(&qe); }