<HTML>
<HEAD>
<TITLE>Re: [asterisk-users] Fwd: add a new queue strategy: SBR</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>I finally got around to updating my dialplan to use the new way of doing callback queues. It seems to me that if one used something like ${CUT(CHANNEL,-,1)} instead of SIP/${EXTEN:3} in the AddQueueMemeber then the device state of the device the agent logged in from, likely where you want to call them back at, will be used.<BR>
<BR>
Wouldn’t this do a better job then assuming the agent logged in from a SIP user that is the same number as the agent number?<BR>
<BR>
This is what I am using.<BR>
<BR>
; This is used to log on and off agents<BR>
exten => *20,1,Answer()<BR>
exten => *20,n,wait(.0.5)<BR>
exten => *20,n,Read(AgentNumber,agent-user)<BR>
exten => *20,n,Set(UserID=${DB(ExtenToUser/${AgentNumber})})<BR>
exten => *20,n,GotoIf($["${UserID}"=""]?NOUSER)<BR>
exten => *20,n,Set(AgentStatus=${DB(users/${UserID}/AgentStatus)})<BR>
exten => *20,n,GotoIf($["${AgentStatus}"="1"]?VERIFY)<BR>
exten => *20,n,GotoIf($["${AgentStatus}"="2"]?VERIFY)<BR>
exten => *20,n(NOUSER),Playback(cfmc/bad-agent)<BR>
exten => *20,n,Hangup()<BR>
exten => *20,n(VERIFY),VMAuthenticate(${AgentNumber}@ourvm)<BR>
exten => *20,n,GotoIf($["${AgentStatus}"="2"]?AGENTOFF)<BR>
exten => *20,n,Set(DB(users/${UserID}/AgentStatus)=2)<BR>
exten => *20,n,Set(DB(users/${UserID}/AgentDevice)=${CUT(CHANNEL,-,1)})<BR>
exten => *20,n,AddQueueMember(support,Local/Queue${AgentNumber}@ansqueue,,,,${CUT(CHANNEL,-,1)})<BR>
exten => *20,n,Playback(agent-loginok)<BR>
exten => *20,n,HangUp()<BR>
exten => *20,n(AGENTOFF),Set(DB(users/${UserID}/AgentStatus)=1)<BR>
exten => *20,n,Set(OldVal=${DB_DELETE(users/${UserID}/AgentDevice)})<BR>
exten => *20,n,RemoveQueueMember(support,Local/Queue${AgentNumber}@ansqueue)<BR>
exten => *20,n,Playback(agent-loggedoff)<BR>
exten => *20,n,HangUp()<BR>
<BR>
; This is used to call an agent from the queue<BR>
exten => _Queue.,1,Set(AgentNumber=${EXTEN:5})<BR>
exten => _Queue.,n,Set(UserID=${DB(ExtenToUser/${AgentNumber})})<BR>
exten => _Queue.,n,GotoIf($["${DEVICE_STATE(${DB(users/${UserID}/AgentDevice)})}"="BUSY"]?ISBUSY)<BR>
exten => _Queue.,n,GotoIf($["${GROUP_COUNT(${UserID}@phoneinfo)}"="0"]?DIALIT)<BR>
exten => _Queue.,n(ISBUSY),Busy()<BR>
exten => _Queue.,n(DIALIT),Set(OUTBOUND_GROUP=${UserID}@phoneinfo)<BR>
exten => _Queue.,n,Dial(${DB(users/${UserID}/AgentDevice)},,g)<BR>
exten => _Queue.,n,HangUp()<BR>
<BR>
; This is the extension call to get a support agent<BR>
exten => 201,1,Answer()<BR>
exten => 201,n,Wait(0.5)<BR>
exten => 201,n,Set(qac=${QUEUE_MEMBER(support,free)})<BR>
exten => 201,n,GotoIf($[${qac} > 0]?HAVEAGNT)<BR>
exten => 201,n,Playback(cfmc/support-no-agent) <BR>
exten => 201,n,Voicemail(201@ourvm,u)<BR>
exten => 201,n,Playback(goodbye)<BR>
exten => 201,n,Hangup()<BR>
exten => 201,n(HAVEAGNT),Playback(cfmc/support-intro)<BR>
exten => 201,n,Queue(support,nrt,,,120)<BR>
exten => 201,n,Voicemail(201@ourvm,b)<BR>
exten => 201,n,Playback(goodbye)<BR>
exten => 201,n,Hangup()<BR>
<BR>
-- <BR>
Jim Dickenson<BR>
<a href="mailto:dickenson@cfmc.com">mailto:dickenson@cfmc.com</a><BR>
<BR>
CfMC<BR>
<a href="http://www.cfmc.com/">http://www.cfmc.com/</a><BR>
<BR>
<BR>
<BR>
<FONT COLOR="#0000FF">> From: Mark Michelson <mmichelson@digium.com><BR>
> Reply-To: Asterisk Users Mailing List - Non-Commercial Discussion <BR>
> <asterisk-users@lists.digium.com><BR>
> Date: Mon, 09 Mar 2009 14:39:58 -0500<BR>
> To: Asterisk Users Mailing List - Non-Commercial Discussion <BR>
> <asterisk-users@lists.digium.com><BR>
> Subject: Re: [asterisk-users] Fwd: add a new queue strategy: SBR<BR>
> <BR>
> nik600 wrote:<BR>
</FONT><FONT COLOR="#008000">>> On Mon, Mar 9, 2009 at 3:16 PM, James Sneeringer <jsneerin@gmail.com> wrote:<BR>
>> <BR>
</FONT><FONT COLOR="#FF0000">>>> If you are using dynamic queues with Local channels (as described in<BR>
>>> doc/queues-with-callback-members.txt in the Asterisk source), you can<BR>
>>> also optionally implement this functionality directly in the dialplan.<BR>
>>> This has the added benefit of allowing you to choose on a per-agent<BR>
>>> basis who is eligible for autopause.<BR>
>>> <BR>
>>> -James<BR>
</FONT><FONT COLOR="#008000">>> <BR>
>> thanks for your reply, infact i've implemented the agents in the<BR>
>> dialplan as explained in queues-with-callback-members.txt but this<BR>
>> approach doesn't manage the status of the agent!<BR>
>> I can add / remove / pause / unpause the member interface but what<BR>
>> about the "in use" status?<BR>
>> The extension in the context will be every time "Not in use" or shall<BR>
>> i implement hints?<BR>
>> <BR>
>> Here there is a piece of my extensions.conf:<BR>
>> <BR>
>> [default]<BR>
>> ; login procedure for queue 001<BR>
>> exten => _001XXXX,1,Answer<BR>
>> exten => _001XXXX,n,AddQueueMember(001,Local/${EXTEN:3}@agents)<BR>
>> exten => _001XXXX,n,Set(DB(agents/${EXTEN:3})=SIP/${CALLERID(num)})<BR>
>> <BR>
>> [agents]<BR>
>> exten => _XXXX,hint,${DB(agents/${EXTEN})}<BR>
>> exten => _XXXX,1,Dial(${DB(agents/${EXTEN})})<BR>
>> <BR>
>> and there isn't an "agent" but only an extension on a queue.<BR>
>> <BR>
>> What do you think about that?<BR>
>> <BR>
>> maybe i should open a new post but i think that this kind of approach<BR>
>> isn't much better than the callback functionality, what do you think<BR>
>> about that?<BR>
>> <BR>
</FONT><FONT COLOR="#0000FF">> <BR>
> The reason that the member always appears to be "not in use" is that local <BR>
> channels are optimized away once they are bridged to their real destination. <BR>
> The <BR>
> result of this is that since the channel does not exist anymore, the device <BR>
> state engine interprets the interface to be "not in use" anymore. One way to <BR>
> handle this issue is to change your AddQueueMember call to use <BR>
> Local/${EXTEN:3}@agents/n (notice the /n at the end). The /n tells the local <BR>
> channel driver to not attempt to optimize the local channel away.<BR>
> <BR>
> If you are using Asterisk version 1.6.0 or above, an even better method would <BR>
> be <BR>
> to specify a second interface to poll for device state when adding the queue <BR>
> member. Assuming that the member at Local/${EXTEN:3}@agents will always call <BR>
> SIP/${EXTEN:3}, then what you are really interested in when receiving device <BR>
> state notifications is the SIP channel, not the local channel. You can specify <BR>
> this second state interface in AddQueueMember like so:<BR>
> <BR>
> AddQueueMember(001,Local/${EXTEN:3}@agents,,,,SIP/${EXTEN:3})<BR>
> <BR>
> Doing this will tell app_queue to use the SIP channel's device state to <BR>
> determine if the member is available, but when it comes time to call the <BR>
> agent, <BR>
> it will actually place the call to the local channel provided.<BR>
> <BR>
> Mark Michelson<BR>
> <BR>
> _______________________________________________<BR>
> -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com">http://www.api-digital.com</a> --<BR>
> <BR>
> asterisk-users mailing list<BR>
> To UNSUBSCRIBE or update options visit:<BR>
> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a><BR>
</FONT></SPAN></FONT>
</BODY>
</HTML>