Author Topic: The "Dial Button"  (Read 4186 times)

Zerabox

  • Newbie
  • *
  • Posts: 27
  • Karma: 0
    • View Profile
    • Email
The "Dial Button"
« on: June 23, 2010, 16:47:52 »
I am having a problem with the Dial Button when logged in as an Agent through the Queuemtrics GUI. When i click the Dial button it brings up which outbound Queue to dial out with, in my case this customer only has one outbound Queue. I enter the extension choose the queue and enter the telephone number, when I click the "Run" button it rings the Agents telephone and then just says goodbye.

I know this is a dial plan issue if someone could please point me in the right direction on how the Dial button works and where it plays a part in the dial plan of PIAF.
See below

[queuemetrics]
; extension 0 is a dummy end point
exten => 10,1,Answer
exten => 10,2,Wait(10)
exten => 10,3,Hangup

; extension 11 makes remote monitoring possible
exten => 11,1,Answer
exten => 11,2,NoOp( "QM_AGENT_CODE: ${QM_AGENT_CODE}" )
exten => 11,3,NoOp( "QM_EXT_MONITOR: ${QM_EXT_MONITOR}" )
exten => 11,4,NoOp( "QM_AGENT_EXT: ${QM_AGENT_EXT}" )
exten => 11,5,NoOp( "QM_LOGIN: ${QM_LOGIN}" )
exten => 11,6,ChanSpy(Local/${QM_AGENT_CODE:6}@from-internal)
exten => 11,7,Hangup

; extension 12: set call status code
exten => 12,1,Answer
exten => 12,2,NoOp( "QM: Setting call status '${CALLSTATUS}' on call '${CALLID}' for agent '${AGENTCODE}' made by '${QM_LOGIN}'" )
exten => 12,3,System( echo "${EPOCH}|${CALLID}|NONE|Agent/${AGENTCODE}|CALLSTATUS|${CALLSTATUS}" >> /var/log/asterisk/queue_log )
exten => 12,4,Hangup

; extension 20: agent callback login
;               For this to work, there must be no password on the agent.
exten => 20,1,Answer
exten => 20,2,NoOp( "QM: Logging on Agent/${AGENTCODE} to extension ${AGENT_EXT}@from-internal made by '${QM_LOGIN}'" )
exten => 20,3,AgentCallBackLogin(${AGENTCODE}||${AGENT_EXT}@from-internal)
exten => 20,4,Hangup

; extension 21: agent callback logoff
exten => 21,1,Answer
exten => 21,2,NoOp( "QM: Logging off Agent/${AGENTCODE} made by '${QM_LOGIN}'" )
exten => 21,3,System(asterisk -rx "agent logoff Agent/${AGENTCODE}")
exten => 21,4,Hangup

; extension 22: agent pause (with pause code)
exten => 22,1,Answer
exten => 22,2,NoOp( "QM: Pausing Agent/${AGENTCODE} with pause reason '${PAUSEREASON}' made by '${QM_LOGIN}' " )
exten => 22,3,PauseQueueMember(|Local/${AGENTCODE}@from-internal)
exten => 22,4,System( echo "${EPOCH}|${UNIQUEID}|NONE|Agent/${AGENTCODE}|PAUSEREASON|${PAUSEREASON}" >> /var/log/asterisk/queue_log )
exten => 22,5,Hangup

; extension 23: agent unpause
exten => 23,1,Answer
exten => 23,2,NoOp( "QM: Unpausing Agent/${AGENTCODE} made by '${QM_LOGIN}' " )
exten => 23,3,UnpauseQueueMember(|Local/${AGENTCODE}@from-internal)
exten => 23,4,Hangup

; extension 24: agent addqueuemember (for asterisk v1.2)
exten => 24,1,Answer
exten => 24,2,NoOp( "QM: AddQueueMember (asterisk v1.2) Agent/${AGENTCODE} on queue ${QUEUENAME} made by '${QM_LOGIN}'" )
exten => 24,3,System( echo "${EPOCH}|${UNIQUEID}|${QUEUENAME}|Local/${AGENTCODE}@from-internal|ADDMEMBER|" >> /var/log/asterisk/queue_log )
exten => 24,4,Hangup

; extension 25: agent addqueuemember (for asterisk v1.4+)
exten => 25,1,Answer
exten => 25,2,NoOp( "QM: AddQueueMember (asterisk v1.4+) Agent/${AGENTCODE} on queue ${QUEUENAME} made by '${QM_LOGIN}'" )
exten => 25,3,AddQueueMember(${QUEUENAME}|Local/${AGENTCODE}@from-internal)
exten => 25,4,Hangup

; extension 26: agent removequeuemember
exten => 26,1,Answer
exten => 26,2,NoOp( "QM: RemoveQueueMember (asterisk v1.2) Agent/${AGENTCODE} on queue ${QUEUENAME} made by '${QM_LOGIN}'" )
exten => 26,3,System( echo "${EPOCH}|${UNIQUEID}|${QUEUENAME}|Local/${AGENTCODE}@from-internal|REMOVEMEMBER|" >> /var/log/asterisk/queue_log )
exten => 26,4,Hangup

; extension 27: agent removequeuemember (for asterisk v1.4+)
exten => 27,1,Answer
exten => 27,2,NoOp( "QM: RemoveQueueMember (asterisk v1.4+) Agent/${AGENTCODE} on queue ${QUEUENAME} made by '${QM_LOGIN}'" )
exten => 27,3,RemoveQueueMember(${QUEUENAME}|Local/${AGENTCODE}@from-internal)
exten => 27,4,Hangup

;
; ================================================================
; The following dialplan is used in order to make oubound calls
; that are tracked through QueueMetrics.
; See http://forum.queuemetrics.com/index.php?board=12.0
; ================================================================

[from-agent]
exten => _1NXXNXXXXXX,1,goto(queuedial,999${EXTEN},1)
exten => _NXXNXXXXXX,1,goto(queuedial,999${EXTEN},1)
exten => _NXXXXXX,1,goto(queuedial,999${EXTEN},1)
exten => _911,1,goto(queuedial,999${EXTEN},1)
include => from-internal

[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-${EXTEN:0:3})
exten => _XXX.,n,Set(QDIALER_NUMBER=${EXTEN:3})
exten => _XXX.,n,Set(QDIALER_AGENT=Agent/${CALLERID(num)})
exten => _XXX.,n(setcid-outq999),Set(CALLERID(all)=<8643352720>)
exten => _XXX.,n,Set(QDIALER_CHANNEL=Zap/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)
include => from-internal

[queuedial-loggedon]
; This piece of dialplan will let only logged on agents dial out
exten => _XXX.,1,Set(QDIALER_QUEUE=q-${EXTEN:0:3})
exten => _XXX.,n,Set(QDIALER_NUMBER=${EXTEN:3})
exten => _XXX.,n,Set(QDIALER_AGENT=Agent/${AGENTBYCALLERID_${CALLERID(num)}})
exten => _XXX.,n,Set(QDIALER_CHANNEL=SIP/${QDIALER_NUMBER})
exten => _XXX.,n,Set(QueueName=${QDIALER_QUEUE})
exten => _XXX.,n,MixMonitor(Q-${QDIALER_QUEUE}-${UNIQUEID}.WAV|b|)
exten => _XXX.,n,GotoIf($[${LEN(${QDIALER_AGENT})} > 6]?qm-queuedial,s,1)
exten => _XXX.,n,NoOp,Extension ${CALLERID(num)} is not logged on as agent.
exten => _XXX.,n,Playback(agent-loggedoff)
exten => _XXX.,n,Congestion


[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()


[macro-queuedial-answer]
; Expecting $ARG1: uniqueid of the caller channel
;           $ARG2: global variable to store the answer results
;           $ARG3: queue name
;           $ARG4: agent name
;           $ARG5: enterqueue
;
exten => s,1,NoOp("Macro: queuedial-answer UID:${ARG1} GR:${ARG2} Q:${ARG3} A:${ARG4} E:${ARG5}")
exten => s,n,Set(NOW=${EPOCH})
exten => s,n,Set(WD=$[${NOW} - ${ARG5}])
exten => s,n,Macro(queuelog,${NOW},${ARG1},${ARG3},${ARG4},CONNECT,${WD})
exten => s,n,Set(GLOBAL(${ARG2})=A)
exten => s,n,Set(GLOBAL(${ARG2}ans)=${NOW})
exten => s,n,NoOp("Macro queuedial-answer terminating" )

[macro-queuelog]
; The advantage of using this macro is that you can choose whether to use the Shell version
; (where you have complete control of what gets written) or the Application version (where you
; do not need a shellout, so it's way faster).
;
; Expecting  $ARG1: Timestamp
;            $ARG2: Call-id
;            $ARG3: Queue
;            $ARG4: Agent
;            $ARG5: Verb
;            $ARG6: Param1
;            $ARG7: Param2
;            $ARG8: Param3
;
;exten => s,1,System( echo "${ARG1}|${ARG2}|${ARG3|${ARG4}|${ARG5}|${ARG6}|${ARG7}|${ARG8}" >> /var/log/asterisk/queue_log )
exten => s,1,QueueLog(${ARG3},${ARG2},${ARG4},${ARG5},${ARG6}|${ARG7}|${ARG8})


Thanks in advance for any help ...

Richie

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: The "Dial Button"
« Reply #1 on: June 25, 2010, 10:30:19 »
The fact that the agent's extension rings means we are at a good starting point :)
Basically what fails here is when it tries to reach an outgoing line.
You should post a CLI trace so we can detect what goes on when it tries to dial outside.


Zerabox

  • Newbie
  • *
  • Posts: 27
  • Karma: 0
    • View Profile
    • Email
Re: The "Dial Button"
« Reply #2 on: June 29, 2010, 14:58:05 »
Below is the CLI information right as the Dial button was used to place a call from extension 200...

Richie       


  PBX in a Flash Version 1.3 Daemon Status
********************************************************************
* Asterisk  * ONLINE  * Zaptel    * ONLINE  * MySQL      * ONLINE  *
* SSH       * ONLINE  * Apache    * ONLINE  * Iptables   * ONLINE  *
* Fail2ban  * ONLINE  * IP Connect* ONLINE  * Ip6tables  * ONLINE  *
* BlueTooth * ONLINE  * Hidd      * ONLINE  * NTPD       * ONLINE  *
* Sendmail  * ONLINE  * Samba     * OFFLINE * Webmin     * ONLINE  *
* Ethernet0 * ONLINE  * Ethernet1 *   N/A   * Wlan0      *   N/A   *
********************************************************************
* Running Asterisk Version : Asterisk 1.4.21.2
* Asterisk Source Version  : 1.4.21.2
* Zaptel Source Version    : 1.4.12.1
* Libpri Source Version    : 1.4.7
* Addons Source Version    : 1.4.7
********************************************************************
zerabox.local on 192.168.71.215 - eth0
CentOS release 5.2 (Final) :32 Bit Kernel: 2.6.18-92.1.6.el5
********************************************************************
 For help on PBX commands than you can run type help-pbx           *
********************************************************************
root@zerabox:~ $ asterisk -r
Asterisk 1.4.21.2, Copyright (C) 1999 - 2008 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for detail                                                                             s.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 1.4.21.2 currently running on zerabox (pid = 3493)
Verbosity is at least 3
  == Parsing '/etc/asterisk/manager.conf': Found
  == Parsing '/etc/asterisk/manager_additional.conf': Found
  == Parsing '/etc/asterisk/manager_custom.conf': Found
  == Manager 'admin' logged on from 127.0.0.1
    -- Executing [200@from-internal:1] GotoIf("Local/200@from-internal-e4a7,2", "1?ext-local|200|1") in new stack
    -- Goto (ext-local,200,1)
    -- Executing [200@ext-local:1] Macro("Local/200@from-internal-e4a7,2", "exten-vm|200|200") in new stack
    -- Executing [s@macro-exten-vm:1] Macro("Local/200@from-internal-e4a7,2", "user-callerid") in new stack
    -- Executing [s@macro-user-callerid:1] Set("Local/200@from-internal-e4a7,2", "AMPUSER=") in new stack
    -- Executing [s@macro-user-callerid:2] GotoIf("Local/200@from-internal-e4a7,2", "1?report") in new stack
    -- Goto (macro-user-callerid,s,11)
    -- Executing [s@macro-user-callerid:11] GotoIf("Local/200@from-internal-e4a7,2", "0?continue") in new stack
    -- Executing [s@macro-user-callerid:12] Set("Local/200@from-internal-e4a7,2", "__TTL=64") in new stack
    -- Executing [s@macro-user-callerid:13] GotoIf("Local/200@from-internal-e4a7,2", "1?continue") in new stack
    -- Goto (macro-user-callerid,s,20)
    -- Executing [s@macro-user-callerid:20] NoOp("Local/200@from-internal-e4a7,2", "Using CallerID "" <>") in new stack
    -- Executing [s@macro-exten-vm:2] Set("Local/200@from-internal-e4a7,2", "RingGroupMethod=none") in new stack
    -- Executing [s@macro-exten-vm:3] Set("Local/200@from-internal-e4a7,2", "VMBOX=200") in new stack
    -- Executing [s@macro-exten-vm:4] Set("Local/200@from-internal-e4a7,2", "EXTTOCALL=200") in new stack
    -- Executing [s@macro-exten-vm:5] Set("Local/200@from-internal-e4a7,2", "CFUEXT=") in new stack
    -- Executing [s@macro-exten-vm:6] Set("Local/200@from-internal-e4a7,2", "CFBEXT=") in new stack
    -- Executing [s@macro-exten-vm:7] Set("Local/200@from-internal-e4a7,2", "RT=15") in new stack
    -- Executing [s@macro-exten-vm:8] Macro("Local/200@from-internal-e4a7,2", "record-enable|200|IN") in new stack
    -- Executing [s@macro-record-enable:1] GotoIf("Local/200@from-internal-e4a7,2", "1?check") in new stack
    -- Goto (macro-record-enable,s,4)
    -- Executing [s@macro-record-enable:4] AGI("Local/200@from-internal-e4a7,2", "recordingcheck|20100629-085307|1277815987.119") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
  recordingcheck|20100629-085307|1277815987.119: Inbound recording enabled.
  recordingcheck|20100629-085307|1277815987.119: CALLFILENAME=20100629-085307-1277815987.119
    -- AGI Script recordingcheck completed, returning 0
    -- Executing [s@macro-record-enable:999] MixMonitor("Local/200@from-internal-e4a7,2", "20100629-085307-1277815987.119.wav||") in new stack
    -- Executing [s@macro-exten-vm:9] Macro("Local/200@from-internal-e4a7,2", "dial|15|tr|200") in new stack
  == Begin MixMonitor Recording Local/200@from-internal-e4a7,2
    -- Executing [s@macro-dial:1] GotoIf("Local/200@from-internal-e4a7,2", "1?dial") in new stack
    -- Goto (macro-dial,s,3)
    -- Executing [s@macro-dial:3] AGI("Local/200@from-internal-e4a7,2", "dialparties.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
  dialparties.agi: Starting New Dialparties.agi
  == Parsing '/etc/asterisk/manager.conf': Found
  == Parsing '/etc/asterisk/manager_additional.conf': Found
  == Parsing '/etc/asterisk/manager_custom.conf': Found
  == Manager 'admin' logged on from 127.0.0.1
  dialparties.agi: Caller ID name is 'unknown' number is 'unknown'
  dialparties.agi: Methodology of ring is  'none'
    --  dialparties.agi: Added extension 200 to extension map
    --  dialparties.agi: Extension 200 cf is disabled
    --  dialparties.agi: Extension 200 do not disturb is disabled
    --  dialparties.agi: DbDel CALLTRACE/200 - Caller ID is not defined
    --  dialparties.agi: Filtered ARG3: 200
  == Manager 'admin' logged off from 127.0.0.1
    -- AGI Script dialparties.agi completed, returning 0
    -- Executing [s@macro-dial:7] Dial("Local/200@from-internal-e4a7,2", "SIP/200|15|tr") in new stack
    -- Called 200
    -- SIP/200-098bda78 is ringing
    -- SIP/200-098bda78 answered Local/200@from-internal-e4a7,2
  == Manager 'admin' logged off from 127.0.0.1
  == Starting Local/200@from-internal-e4a7,1 at queuemetrics,28,1 failed so falling back to exten 's'
  == Starting Local/200@from-internal-e4a7,1 at queuemetrics,s,1 still failed so falling back to context 'default'
    -- Executing [s@default:1] Playback("Local/200@from-internal-e4a7,1", "vm-goodbye") in new stack
    -- <Local/200@from-internal-e4a7,1> Playing 'vm-goodbye' (language 'en')
    -- Executing [s@default:2] Macro("Local/200@from-internal-e4a7,1", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] ResetCDR("Local/200@from-internal-e4a7,1", "w") in new stack
    -- Executing [s@macro-hangupcall:2] NoCDR("Local/200@from-internal-e4a7,1", "") in new stack
    -- Executing [s@macro-hangupcall:3] GotoIf("Local/200@from-internal-e4a7,1", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,6)
    -- Executing [s@macro-hangupcall:6] GotoIf("Local/200@from-internal-e4a7,1", "1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,9)
    -- Executing [s@macro-hangupcall:9] GotoIf("Local/200@from-internal-e4a7,1", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,11)
    -- Executing [s@macro-hangupcall:11] Hangup("Local/200@from-internal-e4a7,1", "") in new stack
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'Local/200@from-internal-e4a7,1' in macro 'hangupcall'
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'Local/200@from-internal-e4a7,1'
  == Spawn extension (macro-dial, s, 7) exited non-zero on 'Local/200@from-internal-e4a7,2' in macro 'dial'
  == Spawn extension (macro-dial, s, 7) exited non-zero on 'Local/200@from-internal-e4a7,2' in macro 'exten-vm'
  == Spawn extension (macro-dial, s, 7) exited non-zero on 'Local/200@from-internal-e4a7,2'
    -- Executing [h@macro-dial:1] Macro("Local/200@from-internal-e4a7,2", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] ResetCDR("Local/200@from-internal-e4a7,2", "w") in new stack
    -- Executing [s@macro-hangupcall:2] NoCDR("Local/200@from-internal-e4a7,2", "") in new stack
    -- Executing [s@macro-hangupcall:3] GotoIf("Local/200@from-internal-e4a7,2", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,6)
    -- Executing [s@macro-hangupcall:6] GotoIf("Local/200@from-internal-e4a7,2", "1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,9)
    -- Executing [s@macro-hangupcall:9] GotoIf("Local/200@from-internal-e4a7,2", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,11)
    -- Executing [s@macro-hangupcall:11] Hangup("Local/200@from-internal-e4a7,2", "") in new stack
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'Local/200@from-internal-e4a7,2' in macro 'hangupcall'
  == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'Local/200@from-internal-e4a7,2'
  == End MixMonitor Recording Local/200@from-internal-e4a7,2
  == Parsing '/etc/asterisk/manager.conf': Found
  == Parsing '/etc/asterisk/manager_additional.conf': Found
  == Parsing '/etc/asterisk/manager_custom.conf': Found
  == Manager 'admin' logged on from 127.0.0.1
  == Manager 'admin' logged off from 127.0.0.1
zerabox*CLI> exit
root@zerabox:~ $

Zerabox

  • Newbie
  • *
  • Posts: 27
  • Karma: 0
    • View Profile
    • Email
Re: The "Dial Button"
« Reply #3 on: June 29, 2010, 15:57:09 »
Never mind ... found another post and after looking at the CLI and seeing their was no Queuemetrics 28,1 we found someone who had a Queuemetrics 28,1 and changed the trunk information and the calls are now going out. Does the latest version have all of this built in (outgoing calling).

Thanks for the help ...
« Last Edit: June 29, 2010, 16:38:26 by Zerabox »

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: The "Dial Button"
« Reply #4 on: June 30, 2010, 09:29:35 »
Yes in fact it was so :-)