📄 queues-with-callback-members.tex
字号:
\section{Introduction}Pardon, but the dialplan in this tutorial will be expressedin AEL, the new Asterisk Extension Language. If you arenot used to its syntax, we hope you will find it to somedegree intuitive. If not, there are documents explainingits syntax and constructs.\section{Configuring Call Queues}\subsection{queues.conf}First of all, set up call queues in queue.confHere is an example:\begin{astlisting}\begin{verbatim} =========== queues.conf =========== | ; Cool Digium Queues | | [general] | | persistentmembers = yes | | | | ; General sales queue | | [sales-general] | | music=default | | context=sales | | strategy=ringall | | joinempty=strict | | leavewhenempty=strict | | | | ; Customer service queue | | [customerservice] | | music=default | | context=customerservice | | strategy=ringall | | joinempty=strict | | leavewhenempty=strict | | | | ; Support dispatch queue | | [dispatch] | | music=default | | context=dispatch | | strategy=ringall | | joinempty=strict | | leavewhenempty=strict | ===================================\end{verbatim}\end{astlisting}In the above, we have defined 3 separate calling queues:sales-general, customerservice, and dispatch.Please note that the sales-general queue specifies acontext of "sales", and that customerservice specifies thecontext of "customerservice", and the dispatchqueue specifies the context "dispatch". These threecontexts must be defined somewhere in your dialplan.We will show them after the main menu below.In the [general] section, specifying the persistentmembers=yes,will cause the agent lists to be stored in astdb, andrecalled on startup.The strategy=ringall will cause all agents to be dialedtogether, the first to answer is then assigned the incomingcall."joinempty" set to "strict" will keep incoming callers frombeing placed in queues where there are no agents to take calls.The Queue() application will return, and the dial plan candetermine what to do next.If there are calls queued, and the last agent logs out, theremaining incoming callers will immediately be removed fromthe queue, and the Queue() call will return, IF the "leavewhenempty" isset to "strict".\subsection{Routing incoming Calls to Queues}Then in extensions.ael, you can do these things:\subsubsection{The Main Menu}At Digium, incoming callers are sent to the "mainmenu" context, where theyare greeted, and directed to the numbers they choose...\begin{astlisting}\begin{verbatim}context mainmenu { includes { digium; queues-loginout; } 0 => goto dispatch,s,1; 2 => goto sales,s,1; 3 => goto customerservice,s,1; 4 => goto dispatch,s,1; s => { Ringing(); Wait(1); Set(attempts=0); Answer(); Wait(1); Background(digium/ThankYouForCallingDigium); Background(digium/YourOpenSourceTelecommunicationsSupplier); WaitExten(0.3); repeat: Set(attempts=$[${attempts} + 1]); Background(digium/IfYouKnowYourPartysExtensionYouMayDialItAtAnyTime); WaitExten(0.1); Background(digium/Otherwise); WaitExten(0.1); Background(digium/ForSalesPleasePress2); WaitExten(0.2); Background(digium/ForCustomerServicePleasePress3); WaitExten(0.2); Background(digium/ForAllOtherDepartmentsPleasePress4); WaitExten(0.2); Background(digium/ToSpeakWithAnOperatorPleasePress0AtAnyTime); if( ${attempts} < 2 ) { WaitExten(0.3); Background(digium/ToHearTheseOptionsRepeatedPleaseHold); } WaitExten(5); if( ${attempts} < 2 ) goto repeat; Background(digium/YouHaveMadeNoSelection); Background(digium/ThisCallWillBeEnded); Background(goodbye); Hangup(); }}\end{verbatim}\end{astlisting}\subsubsection{The Contexts referenced from the queues.conf file}\begin{astlisting}\begin{verbatim}context sales { 0 => goto dispatch,s,1; 8 => Voicemail(${SALESVM}); s => { Ringing(); Wait(2); Background(digium/ThankYouForContactingTheDigiumSalesDepartment); WaitExten(0.3); Background(digium/PleaseHoldAndYourCallWillBeAnsweredByOurNextAvailableSalesRepresentative); WaitExten(0.3); Background(digium/AtAnyTimeYouMayPress0ToSpeakWithAnOperatorOr8ToLeaveAMessage); Set(CALLERID(name)=Sales); Queue(sales-general,t); Set(CALLERID(name)=EmptySalQ); goto dispatch,s,1; Playback(goodbye); Hangup(); }}\end{verbatim}\end{astlisting}Please note that there is only one attempt to queue a call in the sales queue. All sales agents thatare logged in will be rung.\begin{astlisting}\begin{verbatim}context customerservice { 0 => { SetCIDName(CSVTrans); goto dispatch|s|1; } 8 => Voicemail(${CUSTSERVVM}); s => { Ringing(); Wait(2); Background(digium/ThankYouForCallingDigiumCustomerService); WaitExten(0.3); notracking: Background(digium/PleaseWaitForTheNextAvailableCustomerServiceRepresentative); WaitExten(0.3); Background(digium/AtAnyTimeYouMayPress0ToSpeakWithAnOperatorOr8ToLeaveAMessage); Set(CALLERID(name)=Cust Svc); Set(QUEUE_MAX_PENALTY=10); Queue(customerservice,t); Set(QUEUE_MAX_PENALTY=0); Queue(customerservice,t); Set(CALLERID(name)=EmptyCSVQ); goto dispatch,s,1; Background(digium/NoCustomerServiceRepresentativesAreAvailableAtThisTime); Background(digium/PleaseLeaveAMessageInTheCustomerServiceVoiceMailBox); Voicemail(${CUSTSERVVM}); Playback(goodbye); Hangup(); }}\end{verbatim}\end{astlisting}Note that calls coming into customerservice will first be try to queuecalls to those agents with a QUEUE\_MAX\_PENALTY of 10, and if none are available,then all agents are rung.\begin{astlisting}\begin{verbatim}context dispatch{ s => { Ringing(); Wait(2); Background(digium/ThankYouForCallingDigium); WaitExten(0.3); Background(digium/YourCallWillBeAnsweredByOurNextAvailableOperator); Background(digium/PleaseHold); Set(QUEUE_MAX_PENALTY=10); Queue(dispatch|t); Set(QUEUE_MAX_PENALTY=20); Queue(dispatch|t); Set(QUEUE_MAX_PENALTY=0); Queue(dispatch|t); Background(digium/NoOneIsAvailableToTakeYourCall); Background(digium/PleaseLeaveAMessageInOurGeneralVoiceMailBox); Voicemail(${DISPATCHVM}); Playback(goodbye); Hangup(); }}\end{verbatim}\end{astlisting}And in the dispatch context, first agents of priority 10 are tried, then20, and if none are available, all agents are tried.Notice that a common pattern is followed in each of the three queue contexts:First, you set QUEUE\_MAX\_PENALTY to a value, then you callQueue($<$queue-name$>$,option,...) (see the Queue application documetation for details)In the above, note that the "t" option is specified, and this allows theagent picking up the incoming call the luxury of transferring the call toother parties.The purpose of specifying the QUEUE\_MAX\_PENALTY is to develop a set of prioritiesamongst agents. By the above usage, agents with lower number priorities willbe given the calls first, and then, if no-one picks up the call, the QUEUE\_MAX\_PENALTYwill be incremented, and the queue tried again. Hopefully, along the line, someonewill pick up the call, and the Queue application will end with a hangup.The final attempt to queue in most of our examples sets the QUEUE\_MAX\_PENALTYto zero, which means to try all available agents.\subsection{Assigning agents to Queues}In this example dialplan, we want to be able to add and remove agents tohandle incoming calls, as they feel they are available. As they log in,they are added to the queue's agent list, and as they log out, they areremoved. If no agents are available, the queue command will terminate, andit is the duty of the dialplan to do something appropriate, be it sendingthe incoming caller to voicemail, or trying the queue again with a higherQUEUE\_MAX\_PENALTY.Because a single agent can make themselves available to more than one queue,the process of joining multiple queues can be handled automatically by thedialplan.\subsubsection{Agents Log In and Out}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -