[Asterisk-Users] Outbound calls on a busy Zap/1: BUSY vs.
CHANUNAVAIL
John Kapp
john.mailing at gmail.com
Sat Feb 12 06:29:35 MST 2005
Hi,
I'm using the macro below in extensions.conf for most of my outbound
calls. One issue with my current configuration is that when I make an
outbound call it doesn't properly detect that my PSTN line (Zap/1) is
busy with another call and then overflow to my outbound IAX
connections. I think the root cause is that DIALSTATUS gets reported
as BUSY. The debug output is below. My desired result would be for
DIALSTATUS to get set to CHANUNAVAIL so it would then try any other
trunks that I have configured. Further, I don't want simply change
the logic to try the IAX on a DIALSTATUS=BUSY because then a truely
busy destination number would get re-dialed three times.
Thanks for any help,
John
[macro-dial-pstn-iax]
;
exten => s,1,SetGlobalVar(FOUNDME=ANSWER)
exten => s,2,Dial(${PSTN}/${ARG1},${ARG2})
exten => s,3,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,4,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?5:19)
;
exten => s,5,GotoIf($[${LEN(${ARG1})} = 10]?7:6)
exten => s,6,GotoIf($[${LEN(${ARG1})} = 7]?9:11)
exten => s,7,SetVar(NumToDial=1${ARG1})
exten => s,8,Goto(s,12)
exten => s,9,SetVar(NumToDial=1908${ARG1})
exten => s,10,Goto(s,12)
exten => s,11,SetVar(NumToDial=${ARG1})
;
exten => s,12,SetGlobalVar(FOUNDME=ANSWER)
exten => s,13,Dial(${IAXCO1}/${NumToDial},${ARG2}) ; try server 1
exten => s,14,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,15,GotoIf($[${DIALSTATUS} = CHANUNAVAIL]?16:19)
;
exten => s,16,SetGlobalVar(FOUNDME=ANSWER)
exten => s,17,Dial(${IAXCO2}/${NumToDial},${ARG2}) ; try server 2
exten => s,18,SetGlobalVar(FOUNDME=${DIALSTATUS})
exten => s,19,Goto(s-${DIALSTATUS},1)
;
; returns here if busy on PSTN
;
exten => s,103,SetGlobalVar(FOUNDME=BUSY)
exten => s,104,Goto(s-BUSY,1)
;
; returns here if busy on IAXCO1
;
exten => s,114,SetGlobalVar(FOUNDME=BUSY)
exten => s,115,Goto(s-BUSY,1)
;
; returns here if busy on IAXCO2
;
exten => s,118,SetGlobalVar(FOUNDME=BUSY)
exten => s,119,Goto(s-BUSY,1)
;
exten => s-BUSY,1,BackGround(the-party-you-are-calling)
exten => s-BUSY,2,BackGround(is-curntly-busy)
exten => s-BUSY,3,SetGlobalVar(FOUNDME=BUSY)
exten => s-BUSY,4,Goto(s-CLEANEXIT,1)
;
exten => s-CANCEL,1,BackGround(canceled)
exten => s-CANCEL,2,SetGlobalVar(FOUNDME=CANCEL)
exten => s-CANCEL,3,Goto(s-CLEANEXIT,1)
;
exten => s-CHANUNAVAIL,1,BackGround(channel)
exten => s-CHANUNAVAIL,2,BackGround(is-curntly-unavail)
exten => s-CHANUNAVAIL,3,SetGlobalVar(FOUNDME=CHANUNAVAIL)
exten => s-CHANUNAVAIL,4,Goto(s-CLEANEXIT,1)
;
exten => s-NOANSWER,1,BackGround(nbdy-avail-to-take-call)
exten => s-NOANSWER,2,SetGlobalVar(FOUNDME=NOANSWER)
exten => s-NOANSWER,3,Goto(s-CLEANEXIT,1)
;
exten => s-ANSWER,1,SetGlobalVar(FOUNDME=ANSWER)
exten => s-ANSWER,2,Goto(s-CLEANEXIT,3)
;
exten => s-.,1,BackGround(something-terribly-wrong)
exten => s-.,2,SetGlobalVar(FOUNDME=ERROR)
exten => s-.,3,Goto(s-CLEANEXIT,1)
;
exten => s-CLEANEXIT,1,GotoIf($[${ARG3} = RT]?3:2)
exten => s-CLEANEXIT,2,Hangup
exten => s-CLEANEXIT,3,NoOp
<zapata.conf>
[channels]
language=en
context=inbound-analog
signalling=fxs_ks
usecallerid=yes
hidecallerid=no
callwaiting=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=no
echocancel=yes
echocancelwhenbridged=yes
echotraining=yes
echocancel=64
txgain=0.0
rxgain=0.0
channel => 1
Asterisk CVS-HEAD-01/30/05-15:35:12, Copyright (C) 1999 - 2005 Digium.
Written by Mark Spencer <markster at digium.com>
=========================================================================
-- Executing Macro("SIP/22-6189", "dial-pstn-iax|5370000|70|HR")
in new stack
-- Executing SetGlobalVar("SIP/22-6189", "FOUNDME=ANSWER") in new stack
-- Setting global variable 'FOUNDME' to 'ANSWER'
-- Executing Dial("SIP/22-6189", "Zap/1/5370000|70") in new stack
Feb 12 08:22:22 NOTICE[18856]: app_dial.c:884 dial_exec_full: Unable
to create channel of type 'Zap' (cause 0)
== Everyone is busy/congested at this time (1:0/0/1)
-- Executing SetGlobalVar("SIP/22-6189", "FOUNDME=BUSY") in new stack
-- Setting global variable 'FOUNDME' to 'BUSY'
-- Executing Goto("SIP/22-6189", "s-BUSY|1") in new stack
-- Goto (macro-dial-pstn-iax,s-BUSY,1)
-- Executing BackGround("SIP/22-6189",
"the-party-you-are-calling") in new stack
-- Playing 'the-party-you-are-calling' (language 'en')
-- Executing BackGround("SIP/22-6189", "is-curntly-busy") in new stack
-- Playing 'is-curntly-busy' (language 'en')
-- Executing SetGlobalVar("SIP/22-6189", "FOUNDME=BUSY") in new stack
-- Setting global variable 'FOUNDME' to 'BUSY'
-- Executing Goto("SIP/22-6189", "s-CLEANEXIT|1") in new stack
-- Goto (macro-dial-pstn-iax,s-CLEANEXIT,1)
-- Executing GotoIf("SIP/22-6189", "0?3:2") in new stack
-- Goto (macro-dial-pstn-iax,s-CLEANEXIT,2)
-- Executing Hangup("SIP/22-6189", "") in new stack
== Spawn extension (macro-dial-pstn-iax, s-CLEANEXIT, 2) exited
non-zero on 'SIP/22-6189' in macro 'dial-pstn-iax'
== Spawn extension (intern, 5370000, 1) exited non-zero on 'SIP/22-6189'
More information about the asterisk-users
mailing list