📄 queues-with-callback-members.tex
字号:
\begin{astlisting}\begin{verbatim}context queues-loginout{ 6092 => { Answer(); Read(AGENT_NUMBER,agent-enternum); VMAuthenticate(${AGENT_NUMBER}@default,s); Set(queue-announce-success=1); goto queues-manip,I${AGENT_NUMBER},1; } 6093 => { Answer(); Read(AGENT_NUMBER,agent-enternum); Set(queue-announce-success=1); goto queues-manip,O${AGENT_NUMBER},1; }}\end{verbatim}\end{astlisting}In the above contexts, the agents dial 6092 to log into their queues,and they dial 6093 to log out of their queues. The agent is promptedfor their agent number, and if they are logging in, their passcode,and then they are transferred to the proper extension in thequeues-manip context. The queues-manip context does all theactual work:\begin{astlisting}\begin{verbatim}context queues-manip { // Raquel Squelch _[IO]6121 => { &queue-addremove(dispatch,10,${EXTEN}); &queue-success(${EXTEN}); } // Brittanica Spears _[IO]6165 => { &queue-addremove(dispatch,20,${EXTEN}); &queue-success(${EXTEN}); } // Rock Hudson _[IO]6170 => { &queue-addremove(sales-general,10,${EXTEN}); &queue-addremove(customerservice,20,${EXTEN}); &queue-addremove(dispatch,30,${EXTEN}); &queue-success(${EXTEN}); } // Saline Dye-on _[IO]6070 => { &queue-addremove(sales-general,20,${EXTEN}); &queue-addremove(customerservice,30,${EXTEN}); &queue-addremove(dispatch,30,${EXTEN}); &queue-success(${EXTEN}); }}\end{verbatim}\end{astlisting}In the above extensions, note that the queue-addremove macro is usedto actually add or remove the agent from the applicable queue,with the applicable priority level. Note that agents with apriority level of 10 will be called before agents with levelsof 20 or 30.In the above example, Raquel will be dialed first in the dispatchqueue, if she has logged in. If she is not, then the second call ofQueue() with priority of 20 will dial Brittanica if she is present,otherwise the third call of Queue() with MAX\_PENALTY of 0 willdial Rock and Saline simultaneously.Also note that Rock will be among the first to be called in the sales-generalqueue, and among the last in the dispatch queue. As you can see inmain menu, the callerID is set in the main menu so they can tellwhich queue incoming calls are coming from.The call to queue-success() gives some feedback to the agentas they log in and out, that the process has completed.\begin{astlisting}\begin{verbatim}macro queue-success(exten){ if( ${queue-announce-success} > 0 ) { switch(${exten:0:1}) { case I: Playback(agent-loginok); Hangup(); break; case O: Playback(agent-loggedoff); Hangup(); break; } }}\end{verbatim}\end{astlisting}The queue-addremove macro is defined in this manner:\begin{astlisting}\begin{verbatim}macro queue-addremove(queuename,penalty,exten){ switch(${exten:0:1}) { case I: // Login AddQueueMember(${queuename},Local/${exten:1}@agents,${penalty}); break; case O: // Logout RemoveQueueMember(${queuename},Local/${exten:1}@agents); break; case P: // Pause PauseQueueMember(${queuename},Local/${exten:1}@agents); break; case U: // Unpause UnpauseQueueMember(${queuename},Local/${exten:1}@agents); break; default: // Invalid Playback(invalid); break; }}\end{verbatim}\end{astlisting}Basically, it uses the first character of the exten variable, to determine theproper actions to take. In the above dial plan code, only the cases I or O are used,which correspond to the Login and Logout actions.\subsection{Controlling The Way Queues Call the Agents}Notice in the above, that the commands to manipulate agents in queues have"@agents" in their arguments. This is a reference to the agents context:\begin{astlisting}\begin{verbatim}context agents{ // General sales queue 8010 => { Set(QUEUE_MAX_PENALTY=10); Queue(sales-general,t); Set(QUEUE_MAX_PENALTY=0); Queue(sales-general,t); Set(CALLERID(name)=EmptySalQ); goto dispatch,s,1; } // Customer Service queue 8011 => { Set(QUEUE_MAX_PENALTY=10); Queue(customerservice,t); Set(QUEUE_MAX_PENALTY=0); Queue(customerservice,t); Set(CALLERID(name)=EMptyCSVQ); goto dispatch,s,1; } 8013 => { Dial(iax2/sweatshop/9456@from-ecstacy); Set(CALLERID(name)=EmptySupQ); Set(QUEUE_MAX_PENALTY=10); Queue(support-dispatch,t); Set(QUEUE_MAX_PENALTY=20); Queue(support-dispatch,t); Set(QUEUE_MAX_PENALTY=0); // means no max Queue(support-dispatch,t); goto dispatch,s,1; } 6121 => &callagent(${RAQUEL},${EXTEN}); 6165 => &callagent(${SPEARS},${EXTEN}); 6170 => &callagent(${ROCK},${EXTEN}); 6070 => &callagent(${SALINE},${EXTEN});}\end{verbatim}\end{astlisting}In the above, the variables \$\{RAQUEL\}, etc stand foractual devices to ring that person'sphone (like DAHDI/37).The 8010, 8011, and 8013 extensions are purely for transferringincoming callers to queues. For instance, a customer serviceagent might want to transfer the caller to talk to sales. Theagent only has to transfer to extension 8010, in this case.Here is the callagent macro, note that if a person in thequeue is called, but does not answer, then they are automaticallyremoved from the queue.\begin{astlisting}\begin{verbatim}macro callagent(device,exten){ if( ${GROUP_COUNT(${exten}@agents)}=0 ) { Set(OUTBOUND_GROUP=${exten}@agents); Dial(${device},300,t); switch(${DIALSTATUS}) { case BUSY: Busy(); break; case NOANSWER: Set(queue-announce-success=0); goto queues-manip,O${exten},1; default: Hangup(); break; } } else { Busy(); }}\end{verbatim}\end{astlisting}In the callagent macro above, the \$\{exten\} willbe 6121, or 6165, etc, which is the extension of the agent.The use of the GROUP\_COUNT, and OUTBOUND\_GROUP follow this lineof thinking. Incoming calls can be queued to ring all agents in thecurrent priority. If some of those agents are already talking, theywould get bothersome call-waiting tones. To avoid this inconvenience,when an agent gets a call, the OUTBOUND\_GROUP assigns thatconversation to the group specified, for instance 6171@agents.The \$\{GROUP\_COUNT()\} variable on a subsequent call should return"1" for that group. If GROUP\_COUNT returns 1, then the busy()is returned without actually trying to dial the agent.\subsection{Pre Acknowledgement Message}If you would like to have a pre acknowledge message with option to reject the messageyou can use the following dialplan Macro as a base with the 'M' dial argument.\begin{astlisting}\begin{verbatim}[macro-screen]exten=>s,1,Wait(.25)exten=>s,2,Read(ACCEPT,screen-callee-options,1)exten=>s,3,Gotoif($[${ACCEPT} = 1] ?50)exten=>s,4,Gotoif($[${ACCEPT} = 2] ?30)exten=>s,5,Gotoif($[${ACCEPT} = 3] ?40)exten=>s,6,Gotoif($[${ACCEPT} = 4] ?30:30)exten=>s,30,Set(MACRO_RESULT=CONTINUE)exten=>s,40,Read(TEXTEN,custom/screen-exten,)exten=>s,41,Gotoif($[${LEN(${TEXTEN})} = 3]?42:45)exten=>s,42,Set(MACRO_RESULT=GOTO:from-internal^${TEXTEN}^1)exten=>s,45,Gotoif($[${TEXTEN} = 0] ?46:4)exten=>s,46,Set(MACRO_RESULT=CONTINUE)exten=>s,50,Playback(after-the-tone)exten=>s,51,Playback(connected)exten=>s,52,Playback(beep)\end{verbatim}\end{astlisting}\subsection{Caveats}In the above examples, some of the possible error checking has been omitted,to reduce clutter and make the examples clearer.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -