Queues And Penalties

Home » Asterisk Users » Queues And Penalties
Asterisk Users 5 Comments

Hi All

I have been looking at this problem for a few days/weeks now and after some advice please.

I currently have a customer on 11.25.3 and I am in the process of upgrading versions and OS (Debian) and all things that involves mysql -> PDO etc

The problem I have is the customer want a simple call distribution like this

Extn 1001, 1002, 1003 to be called on an incoming call – if they don’t answer after 20 seconds then 2001, 2002, 2003 to be added to the ringing extensions and if no one answers after another 20 seconds the add in 3001,
3002, 3003.

Seems a simple queue application to me

1001, 1002 and 1003 in the queue with a penalty of 1 strategy ringall
2001, 2002 and 2003 in the queue with a penalty of 2 strategy ringall
3001, 3002 and 3003 in the queue with a penalty of 3 strategy ringall

and rules

increasing the maxpenalty 1->2 after 20 seconds and increasing maxpenalty 2->3 after another 20 seconds.

But this doesn’t work if users don’t answer!!

if user 1002 or (2001 etc) just lets his phone ring – he forgot to logoff or DND then the penalty is ignored.

There seems to have been a patch for FreePBX on V13 – LazyMembers – but that is all I can find and later versions have no mention of this

I guess I can use autopause and some AMI / Script but this stops phones ringing because of the timeout so the user has a ringing phone and then it stops and then it starts again whereas the penalty just adds handsets into the ringing group.

This seems to be a real shortcoming in app_queue.

Any ideas, suggestions, anyone want to work with me to sort this ?

Paddy Grice

5 thoughts on - Queues And Penalties

  • This should work, How are you defining your timeouts in the queues.conf ?

    And to verify, in your extensions.conf you are calling Queue with the queue name and the ruleset to apply from queuerules.conf?

  • Hi John

    This works fine providing extensions 1001,1002 and 1003 are “Incall” or
    “Paused” – the problem appears to be that is a handset say 1002 is “ringing”
    then the 2xxx then the penalty is not honoured.

    This is well described in the History section of the following link https://wiki.freepbx.org/display/PPS/lazymembers+patch+to+app_queue

    As I say this seems to be a real shortcoming in app_queue.

    Any ideas, suggestions, anyone want to work with me to sort this ?

    Paddy

    _____

    From: John Kiniston [mailto:johnkiniston@gmail.com]
    Sent: 28 November 2018 21:17
    To: paddy@wizaner.com; Asterisk Users Mailing List – Non-Commercial Discussion Subject: Re: [asterisk-users] Queues and penalties

    This should work, How are you defining your timeouts in the queues.conf ?

    And to verify, in your extensions.conf you are calling Queue with the queue name and the ruleset to apply from queuerules.conf?

    Hi All

    I have been looking at this problem for a few days/weeks now and after some advice please.

    I currently have a customer on 11.25.3 and I am in the process of upgrading versions and OS (Debian) and all things that involves mysql -> PDO etc

    The problem I have is the customer want a simple call distribution like this

    Extn 1001, 1002, 1003 to be called on an incoming call – if they don’t answer after 20 seconds then 2001, 2002, 2003 to be added to the ringing extensions and if no one answers after another 20 seconds the add in 3001,
    3002, 3003.

    Seems a simple queue application to me

    1001, 1002 and 1003 in the queue with a penalty of 1 strategy ringall

    2001, 2002 and 2003 in the queue with a penalty of 2 strategy ringall

    3001, 3002 and 3003 in the queue with a penalty of 3 strategy ringall

    and rules

    increasing the maxpenalty 1->2 after 20 seconds and increasing maxpenalty 2->3 after another 20 seconds.

    But this doesn’t work if users don’t answer!!

    if user 1002 or (2001 etc) just lets his phone ring – he forgot to logoff or DND then the penalty is ignored.

    There seems to have been a patch for FreePBX on V13 – LazyMembers – but that is all I can find and later versions have no mention of this

    I guess I can use autopause and some AMI / Script but this stops phones ringing because of the timeout so the user has a ringing phone and then it stops and then it starts again whereas the penalty just adds handsets into the ringing group.

    This seems to be a real shortcoming in app_queue.

    Any ideas, suggestions, anyone want to work with me to sort this ?

    Paddy Grice

  • Paddy,

    This appears to be how the queue app works. I ended up patching the queue app:

    diff –git a/apps/app_queue.c b/apps/app_queue.c index e3a4e22..72072d0 100644
    — a/apps/app_queue.c
    +++ b/apps/app_queue.c
    @@ -4571,7 +4571,7 @@ static int ring_one(struct queue_ent *qe, struct callattempt *outgoing, int *bus
    struct callattempt *cur;
    /* Ring everyone who shares this best metric (for ringall) */
    for (cur = outgoing; cur; cur = cur->q_next) {
    – if (cur->stillgoing && !cur->chan &&
    cur->metric <= best->metric) {
    + if (cur->stillgoing && !cur->chan &&
    cur->metric >= qe->min_penalty * 1000000 && cur->metric <= qe->max_penalty
    * 1000000) {
    ast_debug(1, “(Parallel) Trying
    ‘%s’ with metric %d\n”, cur->interface, cur->metric);
    ret |= ring_entry(qe, cur, busies);
    }

    So the penalties get calculated during the ‘ringall’ strategy and allowing the queue app to exit, looping and raising the max penalty and calling the queue app again.

    Leon

  • Thanks Leon

    I will implement and test but I knew there would be a fix for what I believe is a short coming in app_queue. How do I suggest this as a option to the base code?

    Paddy

    _____

    From: Leon Wright [mailto:lwright@corpcloud.com.au]
    Sent: 30 November 2018 02:17
    To: paddy@wizaner.com; asterisk-users@lists.digium.com Cc: johnkiniston@gmail.com Subject: Re: [asterisk-users] Queues and penalties

    Paddy,

    This appears to be how the queue app works. I ended up patching the queue app:

    diff –git a/apps/app_queue.c b/apps/app_queue.c index e3a4e22..72072d0 100644
    — a/apps/app_queue.c
    +++ b/apps/app_queue.c
    @@ -4571,7 +4571,7 @@ static int ring_one(struct queue_ent *qe, struct callattempt *outgoing, int *bus
    struct callattempt *cur;
    /* Ring everyone who shares this best metric (for ringall) */
    for (cur = outgoing; cur; cur = cur->q_next) {
    – if (cur->stillgoing && !cur->chan &&
    cur->metric <= best->metric) {
    + if (cur->stillgoing && !cur->chan &&
    cur->metric >= qe->min_penalty * 1000000 && cur->metric <= qe->max_penalty *
    1000000) {
    ast_debug(1, “(Parallel) Trying ‘%s’
    with metric %d\n”, cur->interface, cur->metric);
    ret |= ring_entry(qe, cur, busies);
    }

    So the penalties get calculated during the ‘ringall’ strategy and allowing the queue app to exit, looping and raising the max penalty and calling the queue app again.

    Leon

    Hi All

    I have been looking at this problem for a few days/weeks now and after some advice please.

    I currently have a customer on 11.25.3 and I am in the process of upgrading versions and OS (Debian) and all things that involves mysql -> PDO etc

    The problem I have is the customer want a simple call distribution like this

    Extn 1001, 1002, 1003 to be called on an incoming call – if they don’t answer after 20 seconds then 2001, 2002, 2003 to be added to the ringing extensions and if no one answers after another 20 seconds the add in 3001,
    3002, 3003.

    Seems a simple queue application to me

    1001, 1002 and 1003 in the queue with a penalty of 1 strategy ringall

    2001, 2002 and 2003 in the queue with a penalty of 2 strategy ringall

    3001, 3002 and 3003 in the queue with a penalty of 3 strategy ringall

    and rules

    increasing the maxpenalty 1->2 after 20 seconds and increasing maxpenalty 2->3 after another 20 seconds.

    But this doesn’t work if users don’t answer!!

    if user 1002 or (2001 etc) just lets his phone ring – he forgot to logoff or DND then the penalty is ignored.

    There seems to have been a patch for FreePBX on V13 – LazyMembers – but that is all I can find and later versions have no mention of this

    I guess I can use autopause and some AMI / Script but this stops phones ringing because of the timeout so the user has a ringing phone and then it stops and then it starts again whereas the penalty just adds handsets into the ringing group.

    This seems to be a real shortcoming in app_queue.

    Any ideas, suggestions, anyone want to work with me to sort this ?

    Paddy Grice

  • I’m fairly sure the patch to App Queue that was added to Asterisk 13+
    should do the job… It causes agent priorities to “float up” over time so that new agents are included without excluding old agents.

    I can’t find it right now but there can’t be that many app_queue patches to ast 13 in the last 18 months

    Steve