elastix
Information
Community
Developers
What We Sell
Forums
Addons
Download
Information
Community
Social Networks
For Developers
Manufacturer Support
Appliances
Training & Certification

queue toggle.

Place to share your AGI, AMI scripts to improve your dial plan

queue toggle.

Postby rphenix » Wed Jun 13, 2012 12:32 am

Here you go. This is what I use. Basically I have a button on everyone's phone, so that they can tell if they are logged in by the colour of the LED light for the relative phone.

For anyone searching the forums, this goes into extensions_custom.conf (bottom of the file is fine).
Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
; create a custom hint for each agent extension e.g. for extensions 332, and 333:
exten => *41332,hint,Custom:332
exten => *41333,hint,Custom:333

;queue login/logout take two.
exten => _*413XX,1,Set(action=${IF($[${DEVICE_STATE(Custom:${EXTEN:5})}=INUSE]?logout:login)})
exten => _*413XX,n,NoOp(Variable: ${action})
exten => _*413XX,n,Set(QEXT1=${EXTEN:3}
exten => _*413XX,n,Set(QCOUNT=0)
exten => _*413XX,n,MYSQL(Connect connid localhost asteriskuser yourelastixpassword asterisk)
exten => _*413XX,n,MYSQL(Query resultid ${connid} SELECT DISTINCT id FROM queues_details)
exten => _*413XX,n(query),MYSQL(Fetch foundRow ${resultid} id)
exten => _*413XX,n,GotoIf($["${foundRow}" = "0"]?finish)
exten => _*413XX,n,GotoIf($[${DB_EXISTS(QPENALTY/${id}/agents/${QEXT1})} != 1]?query)
exten => _*413XX,n,Macro(addremovequeueagent,${id},${QEXT1},${action})
exten => _*413XX,n,Set(QCOUNT=$[${QCOUNT} + 1])
exten => _*413XX,n,Goto(query)

exten => _*413XX,n(finish),GotoIf($[${QCOUNT} = 0]?invalid)

exten => _*413XX,n,MYSQL(Clear ${resultid})
exten => _*413XX,n,MYSQL(Disconnect ${connid})
exten => _*413XX,n,Macro(agentqueuedevstate,${QEXT1},${action})
exten => _*413XX,n,Hangup

exten => _*413XX,n(invalid),NoOp(Invalid State)
exten => _*413XX,n,MYSQL(Clear ${resultid})
exten => _*413XX,n,MYSQL(Disconnect ${connid})
exten => _*413XX,n,Playback(pbx-invalid)
exten => _*413XX,n,Hangup

; catch invalid calls and release all mysql resources used in the above queries.
exten => i,1,Playback(pbx-invalid)
exten => i,2,Hangup
exten => h,1,MYSQL(Clear ${resultid})
exten => h,2,MYSQL(Disconnect ${connid})


[macro-addremovequeueagent]
; Adds or removes an Agent from a queue as appropriate.
; ${ARG1} - queue number.
; ${ARG2} - Agent/Extension.
; ${ARG3} - logout or login.
exten => s,1,GotoIf($["${ARG3}" = "login"]?2:4)
exten => s,2,AddQueueMember(${ARG1},Local/${ARG2}@from-internal/n,${DB(QPENALTY/${ARG1}/agents/${ARG2})})
exten => s,3,MacroExit()
exten => s,4,RemoveQueueMember(${ARG1},Local/${ARG2}@from-internal/n)
[macro-agentqueuedevstate]
; Sets custom devstate to inuse if agent is logged into a queue for BLF on phones and plays logged/logged out message.
; ${ARG1} - Agent/Extension.
; ${ARG2} - logout or login.
exten => s,1,GotoIf($["${ARG2}" = "login"]?2:6)
exten => s,2,Set(DEVICE_STATE(Custom:${ARG1})=INUSE)
exten => s,3,Playback(agent-loginok&with&extension)
exten => s,4,SayDigits(${QEXT1})
exten => s,5,MacroExit()
exten => s,6,Set(DEVICE_STATE(Custom:${ARG1})=NOT_INUSE)
exten => s,7,Playback(agent-loggedoff)
exten => s,8,Playback(goodbye)
GeSHi ©
rphenix
Fresh Boarder
Fresh Boarder
 
Posts: 24
Joined: Wed Feb 25, 2009 3:28 pm
Karma: 2

Re: queue toggle.

Postby rphenix » Wed Jun 13, 2012 12:38 am

In the example above, An Agent with an extension of 332 would have a BLF button monitoring *41332 so when they login/logout the button will change colour or flash etc.. depending on the phone handset.

A supervisor could also have a reception console, and monitor all agent extensions by having a blf for each one e.g.
*41333
*41334
*41335
etc..
The supervisor (or any other staff member) can also log an agent out of their phone if they have forgotten simply by dialing *41 followed by the persons extension from any office phone.

Lastly edit the line accordingly
exten => _*413XX,n,Set(QEXT1=${EXTEN:3}
this should trim off everything but the extension. So in this example *41 (3 chars) is being trimmed.
rphenix
Fresh Boarder
Fresh Boarder
 
Posts: 24
Joined: Wed Feb 25, 2009 3:28 pm
Karma: 2

Re:queue toggle.

Postby EliteTech » Wed Jun 13, 2012 8:22 am

Thank you very much rphenix.
EliteTech
Junior Boarder
Junior Boarder
 
Posts: 53
Joined: Fri May 18, 2012 12:07 pm
Karma: 2


Return to Asterisk & Programming

Who is online

Users browsing this forum: No registered users and 2 guests