When users have the Freepbx front end (aka amp) and you make a Q, no longer is there the Agentlogin() to hear music all the time - it remedies a couple of things - if agents are logged in and listening to music, the Moh will take bandwidth from the local network and the Moh will also create an additional load on the asterisk server - - with that in mind the Q's are made (within Freepbx) to have static or dynamic agents - but when they call the switch it will not keep them on the line and will hang up until a inbound call comes in.
Now the problem created by this is the Agents will not show up in the Queuemetrics realtime monitor or the wall panel monitor (without hacking the dial plan and then having agents do a dual logging) No good we say.
(We rely on scripts from Andrews old dial plan off AAH/Trixbox, so this reflects partial dial plan from there as well.)
First things first Edit: the "rewriteLocalChannels=true" is a must - for those that may wonder where it is (version 1.3.3 configuration.properties located (rpm based install) /usr/local/queuematrics/webapps/queumatrics-1.3.3/WEB-INF (linux installation of course) (line 109).Easy fix for this - Works on Freepbx Version(s) 2.x.x (currently from 2.0 to 2.2.1 - latest)
In the dial plan
Edit Extensions.Conf
[macro-agent-add]
exten => s,1,Wait(1)
exten => s,2,Macro(user-callerid,SKIPTTL)
exten => s,3,Read(CALLBACKNUM,agent-user) ; get callback number from user
exten => s,4,GotoIf($["${CALLBACKNUM}" = ""]?5:7) ; if user just pressed # or timed out, use cidnum
exten => s,5,Set(CALLBACKNUM=${CALLERID(number)})
exten => s,6,GotoIf($["${CALLBACKNUM}" = ""]?2) ; if still no number, start over
exten => s,7,GotoIf($["${ARG2}" = ""]?9:
; arg2 is queue password
exten => s,8,Authenticate(${ARG2})
exten => s,9,AddQueueMember(${ARG1}|Local/${CALLBACKNUM}@from-internal/n) ; using chan_local allows us to have agents over trunks
exten => s,10,UserEvent(Agentlogin|Agent: ${CALLBACKNUM})
exten => s,11,System( echo "${EPOCH}|${UNIQUEID}|NONE|Agent/${CALLBACKNUM}|AGENTLOGIN|-" >> /var/log/asterisk/queue_log )exten => s,12,Wait(1)
exten => s,13,Playback(agent-loginok)
exten => s,14,Hangup()
_________________Modified/added line in bold above____________________
To remove the agent(s) upon logout here is the change for that as well.
Edit Extensions.Conf
[macro-agent-del]
exten => s,1,Wait(1)
exten => s,2,Macro(user-callerid,SKIPTTL)
exten => s,3,Read(CALLBACKNUM,agent-user) ; get callback number from user
exten => s,4,GotoIf($["${CALLBACKNUM}" = ""]?5:7) ; if user just pressed # or timed out, use cidnum
exten => s,5,Set(CALLBACKNUM=${CALLERID(number)})
exten => s,6,GotoIf($["${CALLBACKNUM}" = ""]?2) ; if still no number, start over
exten => s,7,RemoveQueueMember(${ARG1}|Local/${CALLBACKNUM}@from-internal/n)
exten => s,8,System( echo "${EPOCH}|${UNIQUEID}|NONE|Agent/${CALLBACKNUM}|AGENTLOGOFF|-|${RV}" >> /var/log/asterisk/queue_log )exten => s,9,UserEvent(RefreshQueue)
exten => s,10,Wait(1)
exten => s,11,Playback(agent-loggedoff)
exten => s,12,Hangup()
______________________________Modified/Added line in bold_______________________________
Now when Agents login and Out they are correctly moved from the Database and no additional work arounds for the Agents.
After the change above - make a Q give it what ever # you want (with out with out PIN#) (lets say 123)
Agent snow call the switch and dial "123*" (without quotes) and they are asked to login with their agent # - they enter their extension and the system shows immediately with Qmetrics that they did and managers are happy, Agents are happy and we take the rest of the day off to do something else! Not really to much stuff to get into :-)
Admins must still add agents to the front end of QueueMetrics (i.e. Agent/7200 with the persons name) The script change above will add the Agent/ (and dynamically grab the extension based on callerID) injecting it into the queue_log for asterisk.
Just now tinkering with the Qmetrics stuff but looks promising and as we go will post solutions as we use multiple systems and dial plans and it will prevent dual agent logins or funky dial plan hacks.
Enjoy!