Asterisk tips Queue Member ackcall

The problem


Asterisk call queues can be answered by either agents or members.
Asterisk cmd Queue allows agents to acknowledge the acceptance of a call by pressing "#".
This is done by setting ackcall to yes.
Unfortunately there is no equivalent option for members.

First workaround


1) add the following to extensions.conf:

[macro-ackcall]
exten => s,1,Wait(1)
exten => s,2,Read(ACK,press_one_to_accept,1,,,5); play press_one_to_accept.wav and wait max 5 secs for the user to press a digit
exten => s,3,GotoIf($["${ACK}" = "1"]?s,7:s,5)  ; check if user pressed "1"
exten => s,4,Set(MACRO_RESULT=CONGESTION); this is where the magic happens! We must exit with CONGESTION otherwise the user would be dropped off the queue.
exten => s,5,Hangup; user didn't press "1" or didn't answer, hangup 
exten => s,6,NoOp(MACRO_RESULT = ${MACRO_RESULT}); user pressed "1", go on

[members]
exten => _600XXXX,1,Dial(SIP/${EXTEN:3},30,M(ackcall)); call extension XXXX and run the ackcall macro on it


2) add the following to queues.conf:

[your-queue]
... parameters of your queue ...
member => Local/6001234@members,1,User1234


Here is a short explanation:

whenever the queue chooses to call Local/6001234@members, Asterisk looks up 6001234 in the [members] context of the dialplan. Then it removes the first 3 digits from the $EXTEN variable and runs Dial(SIP/1234,30,M(ackcall)). It rings SIP account 1234 for max 30 secs and runs macro ackcall on the channel.

Second workaround


First, setup a queue, then have a context for your queue members. In this case, I used members as the context. This is also using AEL. Sorry, but it works best for me.

The problem was that every time the macro would run to acknowledge, if the callee hung up, it aborted the call, forcing it to hangup on the person in the queue.
This lets you acknowledge or hangup, thus leaving the person in the queue for the next person.

In default context:

611 => { Answer(); Queue(NewQueue,n,180); Hangup();}

context members {
_XXXXX => {  Dial(SIP/${EXTEN}@${SIPHOST},25,M(ackcall|${EXTEN})); }
}


The magical macro:

macro ackcall(extension) {
__MACRO_RESULT=CONGESTION; //This is what leaves the caller in the queue if the person that receives the call just hangs up.
Read(ACK,ackcall,1); //ackcall.gsm: You are receiving a call from the queue. Press 1 to accept it, 3 to pause or logout of the queue.
switch (${ACK}){
case 1: __MACRO_RESULT=ANSWERED; break;
case 3: PauseQueueMember(|Local/${extension}@members); // This assumes that asterisk can execute the PauseQueueMember
           Playback(youarepaused); // You have been paused in the queue. Remember to log back in
           break;
default: __MACRO_RESULT=BUSY;
            break;
};
}

The problem


Asterisk call queues can be answered by either agents or members.
Asterisk cmd Queue allows agents to acknowledge the acceptance of a call by pressing "#".
This is done by setting ackcall to yes.
Unfortunately there is no equivalent option for members.

First workaround


1) add the following to extensions.conf:

[macro-ackcall]
exten => s,1,Wait(1)
exten => s,2,Read(ACK,press_one_to_accept,1,,,5); play press_one_to_accept.wav and wait max 5 secs for the user to press a digit
exten => s,3,GotoIf($["${ACK}" = "1"]?s,7:s,5)  ; check if user pressed "1"
exten => s,4,Set(MACRO_RESULT=CONGESTION); this is where the magic happens! We must exit with CONGESTION otherwise the user would be dropped off the queue.
exten => s,5,Hangup; user didn't press "1" or didn't answer, hangup 
exten => s,6,NoOp(MACRO_RESULT = ${MACRO_RESULT}); user pressed "1", go on

[members]
exten => _600XXXX,1,Dial(SIP/${EXTEN:3},30,M(ackcall)); call extension XXXX and run the ackcall macro on it


2) add the following to queues.conf:

[your-queue]
... parameters of your queue ...
member => Local/6001234@members,1,User1234


Here is a short explanation:

whenever the queue chooses to call Local/6001234@members, Asterisk looks up 6001234 in the [members] context of the dialplan. Then it removes the first 3 digits from the $EXTEN variable and runs Dial(SIP/1234,30,M(ackcall)). It rings SIP account 1234 for max 30 secs and runs macro ackcall on the channel.

Second workaround


First, setup a queue, then have a context for your queue members. In this case, I used members as the context. This is also using AEL. Sorry, but it works best for me.

The problem was that every time the macro would run to acknowledge, if the callee hung up, it aborted the call, forcing it to hangup on the person in the queue.
This lets you acknowledge or hangup, thus leaving the person in the queue for the next person.

In default context:

611 => { Answer(); Queue(NewQueue,n,180); Hangup();}

context members {
_XXXXX => {  Dial(SIP/${EXTEN}@${SIPHOST},25,M(ackcall|${EXTEN})); }
}


The magical macro:

macro ackcall(extension) {
__MACRO_RESULT=CONGESTION; //This is what leaves the caller in the queue if the person that receives the call just hangs up.
Read(ACK,ackcall,1); //ackcall.gsm: You are receiving a call from the queue. Press 1 to accept it, 3 to pause or logout of the queue.
switch (${ACK}){
case 1: __MACRO_RESULT=ANSWERED; break;
case 3: PauseQueueMember(|Local/${extension}@members); // This assumes that asterisk can execute the PauseQueueMember
           Playback(youarepaused); // You have been paused in the queue. Remember to log back in
           break;
default: __MACRO_RESULT=BUSY;
            break;
};
}

Created by: dalbaech, Last modification: Mon 08 of Oct, 2012 (08:55 UTC) by nervous
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+