[Asterisk-Users] Using Macro's that cause loops, on purpose and using h, exten in default twice

david winter dwinter at planet-telecom.com
Tue Oct 5 13:59:52 MST 2004


Please see my extensions below. I will try to type you through this. In default, an extension 5149053538 is matched on. This fires a macro that 
determines what time is it, and resets a variable which is then used to call another macro to place a call. if the call is answered, and the far 
end hangs up, the dial macro exits, then the routing macro exits, and you are back to default. at this point h, extension is called to handle the 
hangup, and sends the call back to the original 5149053538 match in default, which starts the whole process over. this works for the first time 
the far end hangs up, but not the second time. Any insight?
[default]
include => AnswerDIDs

[AnswerDIDs]
;Test Numnber in Montreal

exten => 5149053538,1,macro(time-routing)
exten => 5149053538,2,SetVar(bar=0)
exten => 5149053538,3,NoOp($bar})
exten => 5149053538,102,SetVar(bar=1)
exten => 5149053538,103,NoOp(${bar})




;exten => 5149053538,1,goto(custserv,${EXTEN},1)
;exten => 1000,1,Goto(melbourne,s,1)
;exten => 1000,1,Playback(hold-or-dial-0)
exten => 1000,1,Goto(custserv,s,5)

;Melbourne Voicemail Access
exten => 0380805497,1,Goto(custserv,1234,1)

;Customer Service Access
exten => 5149053529,1,macro(time-routing)
exten => 5149053534,1,macro(time-routing)
exten => 5149053535,1,macro(time-routing)
exten => 0380805499,1,macro(time-routing)
exten => 0280805499,1,macro(time-routing)
exten => 0380805140,1,macro(time-routing)
exten => 0380805141,1,macro(time-routing)
exten => 0380805142,1,macro(time-routing)
exten => 0380805143,1,macro(time-routing)
exten => 0280805140,1,macro(time-routing)
exten => 0280805141,1,macro(time-routing)
exten => 0280805142,1,macro(time-routing)
exten => 0280805143,1,macro(time-routing)

exten => 0,1,Goto(voicemail,s,1)

exten => i,1,Goto(invalid,s,1)

exten => h,1,Playback(pls-stay-on-line)
exten => h,2,SetVar(foo=0)
exten => h,3,NoOp(${foo})
exten => h,4,Goto(${DID},1)

[macro-time-routing]
exten => s,1,SetVar(DID=${MACRO_EXTEN})
exten => s,2,NoOp(${DID})
exten => s,3,SetVar(route=1) ;route 1 is melbourne
exten => s,4,NoOp(${route})
exten => s,5,GotoIftime(18:00-8:00|Sun-Thu|*|*?s,7)
exten => s,6,SetVar(route=2) ;route 2 is tampa
exten => s,7,Goto(${MACRO_EXTEN},1)

exten => _X.,1,macro(${route})

exten => h,1,Playback(pls-stay-on-line)
exten => h,2,SetVar(foo=1)
exten => h,3,NoOp(${foo})
exten => h,4,Goto(${MACRO_EXTEN},3)


[macro-2]       ;Tampa Customer Service
exten => s,1,goto(${MACRO_EXTEN},1)
exten => _X.,1,Answer
exten => _X.,2,Playback(pls-wait-connect-call)
exten => _X.,3,Dial(SIP/3162 at tampa_office,20,m)
exten => _X.,4,BackGround(hold-or-dial-0)
exten => _X.,5,BackGround(silence/5)
exten => _X.,6,Goto(${MACRO_EXTEN},2)
exten => _X.,104,Playback(pls-try-call-later)
exten => _X.,105,Hangup

exten => 0,1,Goto(Voicemail,s,1)

exten => h,1,Playback(pls-stay-on-line)
exten => h,2,SetVar(foo=2)
exten => h,3,NoOp(${foo})
exten => h,4,Goto(${MACRO_EXTEN},3)

[macro-1]       ;Melbourne Customer Service
exten => s,1,goto(${MACRO_EXTEN},1)
exten => _X.,1,Answer
exten => _X.,2,Playback(pls-wait-connect-call)
exten => _X.,3,Dial(SIP/61393881910 at melbourne,20,m)
exten => _X.,4,BackGround(hold-or-dial-0)
exten => _X.,5,BackGround(silence/5)
exten => _X.,6,Goto(${MACRO_EXTEN},1)
exten => _X.,104,Playback(pls-try-call-later)
exten => _X.,105,Hangup

exten => 0,1,Goto(Voicemail,s,1)

exten => h,1,Playback(pls-stay-on-line)
exten => h,2,Goto(${MACRO_EXTEN},3)


[voicemail]
exten => s,1,Goto(${DID},1)
exten => _X.,1,Voicemail(1234)
exten => _X.,2,Playback(goodbye)
exten => _X.,3,Hangup

exten => i,1,Goto(invalid,s,1)

[invalid]
exten => s,1,Goto(${DID},1)
exten => _X.,1,Playback(invalid)
exten => _X.,2,Playback(pls-try-call-later)
exten => _X.,3,Hangup


DEBUG---------------------------------
     -- Executing Macro("SIP/1.1.1.1-08154e90", "time-routing") in new stack
     -- Executing SetVar("SIP/1.1.1.1-08154e90", "DID=5149053538") in new stack
     -- Executing NoOp("SIP/1.1.1.1-08154e90", "5149053538") in new stack
     -- Executing SetVar("SIP/1.1.1.1-08154e90", "route=1") in new stack
     -- Executing NoOp("SIP/1.1.1.1-08154e90", "1") in new stack
     -- Executing GotoIfTime("SIP/1.1.1.1-08154e90", "18:00-8:00|Sun-Thu|*|*?s|7") in new stack
     -- Executing SetVar("SIP/1.1.1.1-08154e90", "route=2") in new stack
     -- Executing Goto("SIP/1.1.1.1-08154e90", "5149053538|1") in new stack
     -- Goto (macro-time-routing,5149053538,1)
     -- Executing Macro("SIP/1.1.1.1-08154e90", "2") in new stack
     -- Executing Goto("SIP/1.1.1.1-08154e90", "5149053538|1") in new stack
     -- Goto (macro-2,5149053538,1)
     -- Executing Answer("SIP/1.1.1.1-08154e90", "") in new stack
     -- Executing Playback("SIP/1.1.1.1-08154e90", "pls-wait-connect-call") in new stack
     -- Playing 'pls-wait-connect-call' (language 'en')
     -- Executing Dial("SIP/1.1.1.1-08154e90", "SIP/3162 at tampa_office|20|m") in new stack
     -- Called 3162 at tampa_office
     -- Started music on hold, class 'default', on SIP/1.1.1.1-08154e90
     -- SIP/tampa_office-f569 is making progress passing it to SIP/1.1.1.1-08154e90
     -- SIP/tampa_office-f569 answered SIP/1.1.1.1-08154e90
     -- Stopped music on hold on SIP/1.1.1.1-08154e90
     -- Attempting native bridge of SIP/1.1.1.1-08154e90 and SIP/tampa_office-f569
   == Spawn extension (macro-2, 5149053538, 3) exited non-zero on 'SIP/1.1.1.1-08154e90' in macro '2'
   == Spawn extension (macro-time-routing, 5149053538, 1) exited non-zero on 'SIP/1.1.1.1-08154e90' in macro 'time-routing'
   == Spawn extension (default, 5149053538, 1) exited non-zero on 'SIP/1.1.1.1-08154e90'
     -- Executing Playback("SIP/1.1.1.1-08154e90", "pls-stay-on-line") in new stack
     -- Playing 'pls-stay-on-line' (language 'en')
Oct  5 16:38:30 NOTICE[1087994800]: chan_sip.c:7561 handle_request: Registration from '<sip:dwinter at 1.1.1.1>' failed for '192.168.0.109'
     -- Executing SetVar("SIP/1.1.1.1-08154e90", "foo=0") in new stack
     -- Executing NoOp("SIP/1.1.1.1-08154e90", "0") in new stack
     -- Executing Goto("SIP/1.1.1.1-08154e90", "5149053538|1") in new stack
     -- Goto (default,5149053538,1)
     -- Executing Macro("SIP/1.1.1.1-08154e90", "time-routing") in new stack
     -- Executing SetVar("SIP/1.1.1.1-08154e90", "DID=5149053538") in new stack
     -- Executing NoOp("SIP/1.1.1.1-08154e90", "5149053538") in new stack
     -- Executing SetVar("SIP/1.1.1.1-08154e90", "route=1") in new stack
     -- Executing NoOp("SIP/1.1.1.1-08154e90", "1") in new stack
     -- Executing GotoIfTime("SIP/1.1.1.1-08154e90", "18:00-8:00|Sun-Thu|*|*?s|7") in new stack
     -- Executing SetVar("SIP/1.1.1.1-08154e90", "route=2") in new stack
     -- Executing Goto("SIP/1.1.1.1-08154e90", "5149053538|1") in new stack
     -- Goto (macro-time-routing,5149053538,1)
     -- Executing Macro("SIP/1.1.1.1-08154e90", "2") in new stack
     -- Executing Goto("SIP/1.1.1.1-08154e90", "5149053538|1") in new stack
     -- Goto (macro-2,5149053538,1)
     -- Executing Answer("SIP/1.1.1.1-08154e90", "") in new stack
     -- Executing Playback("SIP/1.1.1.1-08154e90", "pls-wait-connect-call") in new stack
     -- Playing 'pls-wait-connect-call' (language 'en')
     -- Executing Dial("SIP/1.1.1.1-08154e90", "SIP/3162 at tampa_office|20|m") in new stack
     -- Called 3162 at tampa_office
     -- Started music on hold, class 'default', on SIP/1.1.1.1-08154e90
     -- SIP/tampa_office-1aeb is making progress passing it to SIP/1.1.1.1-08154e90
     -- SIP/tampa_office-1aeb answered SIP/1.1.1.1-08154e90
     -- Stopped music on hold on SIP/1.1.1.1-08154e90
     -- Attempting native bridge of SIP/1.1.1.1-08154e90 and SIP/tampa_office-1aeb
   == Spawn extension (macro-2, 5149053538, 3) exited non-zero on 'SIP/1.1.1.1-08154e90' in macro '2'
   == Spawn extension (macro-time-routing, 5149053538, 1) exited non-zero on 'SIP/1.1.1.1-08154e90' in macro 'time-routing'
   == Spawn extension (default, 5149053538, 1) exited non-zero on 'SIP/1.1.1.1-08154e90'

-- 
David Winter
Senior Network Engineer
Planet-Telecom, Inc.
Tampa FL
(813)901-5182 Office
(813)864-3162 Direct
(813)817-4204 Mobile
(813)881-9762 Fax
------------------------------------------
AIM:     mobofool
ICQ:      3563403
MSN:    dwinter at vt.edu
Y!:        vt_fool



More information about the asterisk-users mailing list