Author Topic: Can't get Outbound working with Asterisk 1.4  (Read 8125 times)

jhfitness

  • Newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
    • Buy Treadmill Parts
Can't get Outbound working with Asterisk 1.4
« on: December 22, 2010, 22:34:29 »
I've been browsing every help file and forum topic I can find but I can't figure out how to get Outbound call log working with our otherwise perfectly functioning system. I've got the extensions_queuemetrics.conf file with the following details:

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-${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=SIP/${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()
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})

and I've it included in extensions_custom.conf

I made a queue in QM called "q-340" and I tried adding 340 when dialing out numbers but Asterisk doesn't want to complete the call, period:

Code: [Select]
-- Executing [3406365551234@from-internal:1] ResetCDR("SIP/118-05c00ae0", "") in new stack
    -- Executing [3406365551234@from-internal:2] NoCDR("SIP/118-05c00ae0", "") in new stack
    -- Executing [3406365551234@from-internal:3] Wait("SIP/118-05c00ae0", "1") in new stack
    -- Executing [3406365551234@from-internal:4] Playback("SIP/118-05c00ae0", "silence/1&cannot-complete-as-dialed&check-number-dial-again|noanswer") in new stack
    -- <SIP/118-05c00ae0> Playing 'silence/1' (language 'en')
    -- <SIP/118-05c00ae0> Playing 'cannot-complete-as-dialed' (language 'en')
    -- <SIP/118-05c00ae0> Playing 'check-number-dial-again' (language 'en')
    -- Executing [3406365551234@from-internal:5] Wait("SIP/118-05c00ae0", "1") in new stack
    -- Executing [3406365551234@from-internal:6] Congestion("SIP/118-05c00ae0", "20") in new stack
  == Spawn extension (from-internal, 3406365551234, 6) exited non-zero on 'SIP/118-05c00ae0'
    -- Executing [h@from-internal:1] Macro("SIP/118-05c00ae0", "hangupcall") in new stack
    -- Executing [s@macro-hangupcall:1] GotoIf("SIP/118-05c00ae0", "1?skiprg") in new stack
    -- Goto (macro-hangupcall,s,4)
    -- Executing [s@macro-hangupcall:4] GotoIf("SIP/118-05c00ae0", "1?skipblkvm") in new stack
    -- Goto (macro-hangupcall,s,7)
    -- Executing [s@macro-hangupcall:7] GotoIf("SIP/118-05c00ae0", "1?theend") in new stack
    -- Goto (macro-hangupcall,s,9)
    -- Executing [s@macro-hangupcall:9] Hangup("SIP/118-05c00ae0", "") in new stack
  == Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'SIP/118-05c00ae0' in macro 'hangupcall'
  == Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'SIP/118-05c00ae0'

Do I need to define 340 somewhere else? How do I know that it's even reading my _XXX? Not sure where to start troubleshooting.
« Last Edit: December 22, 2010, 22:36:56 by jahedlund »

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Can't get Outbound working with Asterisk 1.4
« Reply #1 on: December 23, 2010, 09:40:01 »
You need to create an outgoing route, like 9 + 340 + 12345678 that means, dial 12345678 on queue 340.

jhfitness

  • Newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
    • Buy Treadmill Parts
Re: Can't get Outbound working with Asterisk 1.4
« Reply #2 on: December 23, 2010, 15:44:20 »
I made an outgoing route in PBX with dial pattern 340NXXNXXXXXX and tried to place a call dialing 340636xxxxxxx (actual number replaced). It seems like it matches the route now but it sends the whole number to the trunk without catching and stripping the 340. Maybe I need to include my file in a different place? (I've got the #include statement at the last line of extensions_custom.conf)

Code: [Select]
-- Executing [340636xxxxxxx@from-internal:1] Set("SIP/121-05c20810", "MOHCLASS=Web") in new stack
    -- Executing [340636xxxxxxx@from-internal:2] Macro("SIP/121-05c20810", "user-callerid|SKIPTTL|") in new stack
    -- Executing [340636xxxxxxx@from-internal:3] Set("SIP/121-05c20810", "_NODEST=") in new stack
    -- Executing [340636xxxxxxx@from-internal:4] Macro("SIP/121-05c20810", "record-enable|121|OUT|") in new stack
    -- Executing [s@macro-record-enable:1] GotoIf("SIP/121-05c20810", "1?check") in new stack
    -- Goto (macro-record-enable,s,4)
    -- Executing [s@macro-record-enable:4] AGI("SIP/121-05c20810", "recordingcheck|20101223-082540|1293114340.67") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
  recordingcheck|20101223-082540|1293114340.67: Outbound recording not enabled
    -- AGI Script recordingcheck completed, returning 0
    -- Executing [s@macro-record-enable:5] MacroExit("SIP/121-05c20810", "") in new stack
    -- Executing [340636xxxxxxx@from-internal:5] Macro("SIP/121-05c20810", "dialout-trunk|1|340636xxxxxxx||") in new stack
    -- Executing [s@macro-dialout-trunk:1] Set("SIP/121-05c20810", "DIAL_TRUNK=1") in new stack
    -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/121-05c20810", "0?sub-pincheck|s|1") in new stack
    -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/121-05c20810", "0?disabletrunk|1") in new stack
    -- Executing [s@macro-dialout-trunk:4] Set("SIP/121-05c20810", "DIAL_NUMBER=340636xxxxxxx") in new stack
    -- Executing [s@macro-dialout-trunk:5] Set("SIP/121-05c20810", "DIAL_TRUNK_OPTIONS=tr") in new stack
    -- Executing [s@macro-dialout-trunk:6] Set("SIP/121-05c20810", "OUTBOUND_GROUP=OUT_1") in new stack
    -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/121-05c20810", "0?nomax") in new stack
    -- Executing [s@macro-dialout-trunk:8] GotoIf("SIP/121-05c20810", "0?chanfull") in new stack
    -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/121-05c20810", "0?skipoutcid") in new stack
    -- Executing [s@macro-dialout-trunk:10] Set("SIP/121-05c20810", "DIAL_TRUNK_OPTIONS=") in new stack
    -- Executing [s@macro-dialout-trunk:11] Macro("SIP/121-05c20810", "outbound-callerid|1") in new stack
    -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/121-05c20810", "0|SetCallerPres|") in new stack
    -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/121-05c20810", "0|Set|REALCALLERIDNUM=121") in new stack
    -- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/121-05c20810", "1?normcid") in new stack
    -- Goto (macro-outbound-callerid,s,6)
    -- Executing [s@macro-outbound-callerid:6] Set("SIP/121-05c20810", "USEROUTCID=") in new stack
    -- Executing [s@macro-outbound-callerid:7] Set("SIP/121-05c20810", "EMERGENCYCID=") in new stack
    -- Executing [s@macro-outbound-callerid:8] Set("SIP/121-05c20810", "TRUNKOUTCID=1636yyyyyyy") in new stack
    -- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/121-05c20810", "1?trunkcid") in new stack
    -- Goto (macro-outbound-callerid,s,12)
    -- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/121-05c20810", "1|Set|CALLERID(all)=1636yyyyyyy") in new stack
    -- Executing [s@macro-outbound-callerid:13] ExecIf("SIP/121-05c20810", "0|Set|CALLERID(all)=") in new stack
    -- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/121-05c20810", "0|SetCallerPres|prohib_passed_screen") in new stack
    -- Executing [s@macro-dialout-trunk:12] ExecIf("SIP/121-05c20810", "1|AGI|fixlocalprefix") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/fixlocalprefix
    -- AGI Script fixlocalprefix completed, returning 0
    -- Executing [s@macro-dialout-trunk:13] Set("SIP/121-05c20810", "OUTNUM=+340636xxxxxxx") in new stack
    -- Executing [s@macro-dialout-trunk:14] Set("SIP/121-05c20810", "custom=SIP/VP-SIPJFKA") in new stack
    -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/121-05c20810", "1|Set|DIAL_TRUNK_OPTIONS=M(setmusic^Web)") in new stack
    -- Executing [s@macro-dialout-trunk:16] Macro("SIP/121-05c20810", "dialout-trunk-predial-hook|") in new stack
    -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/121-05c20810", "") in new stack
    -- Executing [s@macro-dialout-trunk:17] GotoIf("SIP/121-05c20810", "0?bypass|1") in new stack
    -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/121-05c20810", "0?customtrunk") in new stack
    -- Executing [s@macro-dialout-trunk:19] Dial("SIP/121-05c20810", "SIP/VP-SIPJFKA/+340636xxxxxxx|300|M(setmusic^Web)") in new stack
    -- Called VP-SIPJFKA/+340636xxxxxxx
    -- Got SIP response 503 "Service Unavailable" back from 64.61.93.190
    -- SIP/VP-SIPJFKA-05c220d0 is circuit-busy
  == Everyone is busy/congested at this time (1:0/1/0)
    -- Executing [s@macro-dialout-trunk:20] Goto("SIP/121-05c20810", "s-CONGESTION|1") in new stack
    -- Goto (macro-dialout-trunk,s-CONGESTION,1)
    -- Executing [s-CONGESTION@macro-dialout-trunk:1] GotoIf("SIP/121-05c20810", "1?noreport") in new stack
    -- Goto (macro-dialout-trunk,s-CONGESTION,3)
    -- Executing [s-CONGESTION@macro-dialout-trunk:3] NoOp("SIP/121-05c20810", "TRUNK Dial failed due to CONGESTION - failing through to other trunks") in new stack
    -- Executing [340636xxxxxxx@from-internal:6] Macro("SIP/121-05c20810", "outisbusy|") in new stack
    -- Executing [s@macro-outisbusy:1] GotoIf("SIP/121-05c20810", "0?emergency|1") in new stack
    -- Executing [s@macro-outisbusy:2] GotoIf("SIP/121-05c20810", "0?intracompany|1") in new stack
    -- Executing [s@macro-outisbusy:3] Playback("SIP/121-05c20810", "all-circuits-busy-now&pls-try-call-later| noanswer") in new stack
    -- <SIP/121-05c20810> Playing 'all-circuits-busy-now' (language 'en')
    -- <SIP/121-05c20810> Playing 'pls-try-call-later' (language 'en')
    -- Executing [s@macro-outisbusy:4] Congestion("SIP/121-05c20810", "20") in new stack
  == Spawn extension (macro-outisbusy, s, 4) exited non-zero on 'SIP/121-05c20810' in macro 'outisbusy'
  == Spawn extension (macro-outisbusy, s, 4) exited non-zero on 'SIP/121-05c20810'
« Last Edit: December 23, 2010, 15:51:10 by jahedlund »

marcos

  • Loway
  • Full Member
  • *
  • Posts: 138
  • Karma: 3
    • View Profile
Re: Can't get Outbound working with Asterisk 1.4
« Reply #3 on: January 03, 2011, 12:32:56 »
Hi

Are you using trixbox/freebpx? I think yes reading the reported logs.
This probably could helps you: http://www.queuemetrics.com/manuals/QM_Trixbox-chunked/ar01s03.html

The main idea is to generate an outbound route that forward the outbound call to the queuedial context defined in the extension_queuemetrics.conf
You need to customize it a little bit following what is explained in the document provided at the link above.

Let me know if this could helps.

Regards,
Marco.

jhfitness

  • Newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
    • Buy Treadmill Parts
Re: Can't get Outbound working with Asterisk 1.4
« Reply #4 on: January 07, 2011, 15:40:29 »
Yes, FreePBX. Thank you! The custom trunk was what I was missing! My epiphany came when I looked at the generated code in my extensions_additional.conf file and realized that brackets are kind of like functions that get called, and my outbound route function was calling my trunk function without ever paying any attention to my [queuedial] "function"! Then like the instructions said it was just a matter of getting the QDIALER_CHANNEL variable to match what the Dial() function uses on calls through regular routes and trunks.

Anyway, the details aren't perfectly set up yet but I'm successfully getting calls through now with my prefix. However the caller ID showed up on my other phone as "Unknown" where it shows up with the number when I dial without the prefix, but I haven't looked into it yet (any quick ideas?). Also would like to get it working without having to dial the prefix, but I'm more confident that I can figure that out now that I've gotten this far... there are more docs and forum topics. Will post here if I have more questions.

Thanks again to both!

jhfitness

  • Newbie
  • *
  • Posts: 26
  • Karma: 1
    • View Profile
    • Buy Treadmill Parts
Re: Can't get Outbound working with Asterisk 1.4
« Reply #5 on: January 07, 2011, 16:42:56 »
Got caller id working by setting

Code: [Select]
exten => s,n,Set(CALLERID(all)=<##########>)
right before Dial() on [qm-queuedial] as recommended in another topic. Had to reload the configuration, of course. Got it down to one integer as a regular ol' dial rule by hardcoding the prefix for QDIALER-QUEUE (we're only using one campaign, at least for now).

Thanks again.

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Can't get Outbound working with Asterisk 1.4
« Reply #6 on: January 10, 2011, 13:46:23 »
 ;D