Author Topic: Outbound on Realtime Page  (Read 2416 times)

ryan82

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
Outbound on Realtime Page
« on: November 16, 2017, 01:07:48 »
Apologies in advance, but I've read several posts here in the forums as well as every guide I could find in the support section, and I still can't get outbound call reporting to work correctly. I'm also a complete novice to Asterisk and don't really understand the dialplan code very well.

We don't use the QM agent web interface, agents use hard phones to manually log in and out of queue, use pause, etc. Making calls isn't an issue, showing report in QM of those calls is. Outbound queue has been created in freepbx, outbound trunk and routes are setup as described in the guide. Below is the dialplan from extensions_queuemetrics.conf. I think that's the problem.

My goal is to show outbound calls on the QM realtime page as well as in QM historical reporting. Agents may dial the following prefixes when making calls outgoing: 8, 9, 91, as well as a couple 5-digit dialing combinations (3xxxx or 6xxxx). Any help with how I would create a dialplan to accomplish this would be much appreciated. If any additional information is needed, please let me know.

Code: [Select]
[queuedial]
; this piece of dialplan is just a calling hook into the [qm-queuedial] context that actually does the
; outbound dialing - replace as needed - just fill in the same variables.
exten => _XXX.,1,Set(QDIALER_QUEUE=q-350{EXTEN:0:3})
exten => _XXX.,n,Set(QDIALER_NUMBER=${EXTEN:3})
exten => _XXX.,n,Set(QDIALER_AGENT=Agent/${CALLERID(num)})
exten => _XXX.,n,Set(QDIALER_CHANNEL=DAHDI/g0/${QDIALER_NUMBER})
exten => _XXX.,n,Set(QueueName=${QDIALER_QUEUE})
exten => _XXX.,n,MixMonitor(Q-${QDIALER_QUEUE}-${UNIQUEID}.WAV,b,)
exten => _XXX.,n,Goto(qm-queuedial,s,1)

[qm-queuedial]
; We use a global variable to pass values back from the answer-detect macro.
; STATUS = U unanswered
;        = A answered    (plus CAUSECOMPLETE=C when callee hung up)
; The 'g' dial parameter must be used in order to track callee disconnecting.
; Note that we'll be using the 'h' hook in any case to do the logging when channels go down.
; We set the CDR(accountcode) for live monitoring by QM.
;
exten => s,1,NoOp( "Outbound call - A:${QDIALER_AGENT} N:${QDIALER_NUMBER} Q:${QDIALER_QUEUE} Ch:${QDIALER_CHANNEL}" )
exten => s,n,Set(CDR(accountcode)=QDIALAGI)
exten => s,n,Set(ST=${EPOCH})
exten => s,n,Set(GM=QDV-${QDIALER_AGENT})
exten => s,n,Set(GLOBAL(${GM})=U)
exten => s,n,Set(GLOBAL(${GM}ans)=0)
exten => s,n,Macro(queuelog,${ST},${UNIQUEID},${QDIALER_QUEUE},${QDIALER_AGENT},CALLOUTBOUND,,${QDIALER_NUMBER})
exten => s,n,Dial(${QDIALER_CHANNEL},300,gM(queuedial-answer^${UNIQUEID}^${GM}^${QDIALER_QUEUE}^${QDIALER_AGENT}^${ST}))
exten => s,n,Set(CAUSECOMPLETE=${IF($["${DIALSTATUS}" = "ANSWER"]?C)})

; Trapping call termination here
exten => h,1,NoOp( "Call exiting: status ${GLOBAL(${GM})} answered at: ${GLOBAL(${GM}ans)} DS: ${DIALSTATUS}"  )
exten => h,n,Goto(case-${GLOBAL(${GM})})
exten => h,n,Hangup()

; Call unanswered
exten => h,n(case-U),Set(WT=$[${EPOCH} - ${ST}])
exten => h,n,Macro(queuelog,${EPOCH},${UNIQUEID},${QDIALER_QUEUE},${QDIALER_AGENT},ABANDON,1,1,${WT})
exten => h,n,Hangup()

; call answered: agent/callee hung
exten => h,n(case-A)i,Set(COMPLETE=${IF($["${CAUSECOMPLETE}" = "C"]?COMPLETECALLER:COMPLETEAGENT)})
exten => h,n,Set(WT=$[${GLOBAL(${GM}ans)} - ${ST}])
exten => h,n,Set(CT=$[${EPOCH} - ${GLOBAL(${GM}ans)}])
exten => h,n,Macro(queuelog,${EPOCH},${UNIQUEID},${QDIALER_QUEUE},${QDIALER_AGENT},${COMPLETE},${WT},${CT})
exten => h,n,Hangup()


mirkox

  • Full Member
  • ***
  • Posts: 231
  • Karma: 4
    • View Profile
Re: Outbound on Realtime Page
« Reply #1 on: November 16, 2017, 09:16:54 »
Hi Ryan,

there's a better and easier way to track outbound calls now; are you already using Uniloader to load the queue_log into QueueMetrics? If yes, which version?

Mirko

ryan82

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
    • View Profile
Re: Outbound on Realtime Page
« Reply #2 on: November 17, 2017, 00:24:25 »
No, I'm not familiar with Uniloader.

mirkox

  • Full Member
  • ***
  • Posts: 231
  • Karma: 4
    • View Profile
Re: Outbound on Realtime Page
« Reply #3 on: November 17, 2017, 09:16:07 »
Ok I imagine you have Qloader installed then, on your Asterisk machine. Follow these steps:

1) stop qloaderd temporarily: service qloaderd stop
2)install uniloader with: yum install uniloader
3) stop uniloader: service uniloader stop
4) open /etc/sysconfig/uniloader and check the settings, you can refer to qloader's file (/etc/sysconfig/qloaderd) for IP, usernames, passwords. Don't uncomment the "QueueMetrics-Live" section
5) open /etc/sysconfig/unitracker, check that the AMI credentials are ok and make sure to enable the outbound tracking by setting it to 1
6) restart uniloader: service uniloader restart
7) make unitracker a service: chkconfig --add unitracker
8) restart unitracker: service unitracker restart
9) all the outbound calls will be tracked under the 'q-outbound' queue, so you need to define this queue in QueueMetrics if you don't have it already
10) test that everything works and shows up in QM
11) if you are sure that everything is working fine you can remove qloaderd: yum remove qloaderd