Author Topic: QMetrics - Asterisk with FreePBX and Trixbox  (Read 11245 times)

mnail

  • Newbie
  • *
  • Posts: 9
  • Karma: 1
    • View Profile
QMetrics - Asterisk with FreePBX and Trixbox
« on: March 15, 2007, 16:48:00 »
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:8)   ; 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!
« Last Edit: March 16, 2007, 20:08:48 by mnail »

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: QMetrics - Asterisk with FreePBX and Trixbox
« Reply #1 on: March 15, 2007, 17:25:40 »
That's great - thanks for posting. I would add as a suggestion to set the configuration.properties property rewriteLocalChannels to true, because each call will be logged on the queue_log as Local/XXX@from-internal, and QueueMetrics will read them as if they were Agent/XXX instead.

+1 karma from me :)

mnail

  • Newbie
  • *
  • Posts: 9
  • Karma: 1
    • View Profile
Re: QMetrics - Asterisk with FreePBX and Trixbox
« Reply #2 on: March 16, 2007, 05:45:34 »
Edited original post to reflect the rewrite statement - Thx for the catch

Another note, I noticed the "default.rewriteLocalWithQueue=true" did not work well - or I did not do it correctly during initial test) maybe I misunderstood what it did but was used in conjunction with the original work around for Freepbx installation(s) due to the way it handles the dial plan (aka, no AgentLogin() ) anyways this app has some serious potential within orgs just hard to have time (unless multiple people test and post back) works arounds etc.. Again I have time to play and if I can get it to work for our org I have no problem posting work arounds that are efficient and hopefully get feedback (constructive :-) but none the less wider platform usage.
« Last Edit: March 16, 2007, 20:10:30 by mnail »

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: QMetrics - Asterisk with FreePBX and Trixbox
« Reply #3 on: March 17, 2007, 15:40:19 »
The rewriteLocalWithQueue is used only when you have only Local calls and you want to separate calls by agent - it's pretty exotic stuff, rewiting Local/XXX calls to Agent/XXX-queuename, so you may prefer not to use it at all unless that is your exact piece of cake :)

tbelanger

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
    • View Profile
Re: QMetrics - Asterisk with FreePBX and Trixbox
« Reply #4 on: March 21, 2007, 19:26:57 »
You are my FREAKING hero!

tbelanger

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
    • View Profile
Re: QMetrics - Asterisk with FreePBX and Trixbox
« Reply #5 on: April 04, 2007, 17:23:17 »
will this work with the agent callback option

ie....

exten => 299,1,AgentCallBackLogin(|@from-internal)

admin

  • Administrator
  • Newbie
  • *****
  • Posts: 12
  • Karma: 0
    • View Profile
Re: QMetrics - Asterisk with FreePBX and Trixbox
« Reply #6 on: April 04, 2007, 17:35:58 »
Thi is not needed when using AgentCallbackLogin(), as agentcallback writes the log correcly by itself.