[asterisk-users] Fwd: add a new queue strategy: SBR

Jim Dickenson dickenson at cfmc.com
Tue Mar 17 16:52:22 CDT 2009


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.

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?

This is what I am using.

; This is used to log on and off agents
exten => *20,1,Answer()
exten => *20,n,wait(.0.5)
exten => *20,n,Read(AgentNumber,agent-user)
exten => *20,n,Set(UserID=${DB(ExtenToUser/${AgentNumber})})
exten => *20,n,GotoIf($["${UserID}"=""]?NOUSER)
exten => *20,n,Set(AgentStatus=${DB(users/${UserID}/AgentStatus)})
exten => *20,n,GotoIf($["${AgentStatus}"="1"]?VERIFY)
exten => *20,n,GotoIf($["${AgentStatus}"="2"]?VERIFY)
exten => *20,n(NOUSER),Playback(cfmc/bad-agent)
exten => *20,n,Hangup()
exten => *20,n(VERIFY),VMAuthenticate(${AgentNumber}@ourvm)
exten => *20,n,GotoIf($["${AgentStatus}"="2"]?AGENTOFF)
exten => *20,n,Set(DB(users/${UserID}/AgentStatus)=2)
exten => *20,n,Set(DB(users/${UserID}/AgentDevice)=${CUT(CHANNEL,-,1)})
exten => 
*20,n,AddQueueMember(support,Local/Queue${AgentNumber}@ansqueue,,,,${CUT(CHA
NNEL,-,1)})
exten => *20,n,Playback(agent-loginok)
exten => *20,n,HangUp()
exten => *20,n(AGENTOFF),Set(DB(users/${UserID}/AgentStatus)=1)
exten => *20,n,Set(OldVal=${DB_DELETE(users/${UserID}/AgentDevice)})
exten => *20,n,RemoveQueueMember(support,Local/Queue${AgentNumber}@ansqueue)
exten => *20,n,Playback(agent-loggedoff)
exten => *20,n,HangUp()

; This is used to call an agent from the queue
exten => _Queue.,1,Set(AgentNumber=${EXTEN:5})
exten => _Queue.,n,Set(UserID=${DB(ExtenToUser/${AgentNumber})})
exten => 
_Queue.,n,GotoIf($["${DEVICE_STATE(${DB(users/${UserID}/AgentDevice)})}"="BU
SY"]?ISBUSY)
exten => 
_Queue.,n,GotoIf($["${GROUP_COUNT(${UserID}@phoneinfo)}"="0"]?DIALIT)
exten => _Queue.,n(ISBUSY),Busy()
exten => _Queue.,n(DIALIT),Set(OUTBOUND_GROUP=${UserID}@phoneinfo)
exten => _Queue.,n,Dial(${DB(users/${UserID}/AgentDevice)},,g)
exten => _Queue.,n,HangUp()

; This is the extension call to get a support agent
exten => 201,1,Answer()
exten => 201,n,Wait(0.5)
exten => 201,n,Set(qac=${QUEUE_MEMBER(support,free)})
exten => 201,n,GotoIf($[${qac} > 0]?HAVEAGNT)
exten => 201,n,Playback(cfmc/support-no-agent)
exten => 201,n,Voicemail(201 at ourvm,u)
exten => 201,n,Playback(goodbye)
exten => 201,n,Hangup()
exten => 201,n(HAVEAGNT),Playback(cfmc/support-intro)
exten => 201,n,Queue(support,nrt,,,120)
exten => 201,n,Voicemail(201 at ourvm,b)
exten => 201,n,Playback(goodbye)
exten => 201,n,Hangup()

-- 
Jim Dickenson
mailto:dickenson at cfmc.com

CfMC
http://www.cfmc.com/



> From: Mark Michelson <mmichelson at digium.com>
> Reply-To: Asterisk Users Mailing List - Non-Commercial Discussion
> <asterisk-users at lists.digium.com>
> Date: Mon, 09 Mar 2009 14:39:58 -0500
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> <asterisk-users at lists.digium.com>
> Subject: Re: [asterisk-users] Fwd: add a new queue strategy: SBR
> 
> nik600 wrote:
>> On Mon, Mar 9, 2009 at 3:16 PM, James Sneeringer <jsneerin at gmail.com> wrote:
>> 
>>> If you are using dynamic queues with Local channels (as described in
>>> doc/queues-with-callback-members.txt in the Asterisk source), you can
>>> also optionally implement this functionality directly in the dialplan.
>>> This has the added benefit of allowing you to choose on a per-agent
>>> basis who is eligible for autopause.
>>> 
>>> -James
>> 
>> thanks for your reply, infact i've implemented the agents in the
>> dialplan as explained in queues-with-callback-members.txt but this
>> approach doesn't manage the status of the agent!
>> I can add / remove / pause / unpause the member interface but what
>> about the "in use" status?
>> The extension in the context will be every time "Not in use" or shall
>> i implement hints?
>> 
>> Here there is a piece of my extensions.conf:
>> 
>> [default]
>> ; login procedure for queue 001
>> exten => _001XXXX,1,Answer
>> exten => _001XXXX,n,AddQueueMember(001,Local/${EXTEN:3}@agents)
>> exten => _001XXXX,n,Set(DB(agents/${EXTEN:3})=SIP/${CALLERID(num)})
>> 
>> [agents]
>> exten => _XXXX,hint,${DB(agents/${EXTEN})}
>> exten => _XXXX,1,Dial(${DB(agents/${EXTEN})})
>> 
>> and there isn't an "agent" but only an extension on a queue.
>> 
>> What do you think about that?
>> 
>> maybe i should open a new post but i think that this kind of approach
>> isn't much better than the callback functionality, what do you think
>> about that?
>> 
> 
> The reason that the member always appears to be "not in use" is that local
> channels are optimized away once they are bridged to their real destination.
> The 
> result of this is that since the channel does not exist anymore, the device
> state engine interprets the interface to be "not in use" anymore. One way to
> handle this issue is to change your AddQueueMember call to use
> Local/${EXTEN:3}@agents/n (notice the /n at the end). The /n tells the local
> channel driver to not attempt to optimize the local channel away.
> 
> If you are using Asterisk version 1.6.0 or above, an even better method would
> be 
> to specify a second interface to poll for device state when adding the queue
> member. Assuming that the member at Local/${EXTEN:3}@agents will always call
> SIP/${EXTEN:3}, then what you are really interested in when receiving device
> state notifications is the SIP channel, not the local channel. You can specify
> this second state interface in AddQueueMember like so:
> 
> AddQueueMember(001,Local/${EXTEN:3}@agents,,,,SIP/${EXTEN:3})
> 
> Doing this will tell app_queue to use the SIP channel's device state to
> determine if the member is available, but when it comes time to call the
> agent, 
> it will actually place the call to the local channel provided.
> 
> Mark Michelson
> 
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090317/e88cde3f/attachment.htm 


More information about the asterisk-users mailing list