Syntax Help Please

Hello I am having issues getting the following to work. The if will not switch extensions.

exten => s,1,Noop(Entering user defined context macro-dialout-one-predial-hook in extensions_custom.conf)
exten => s,n,NoOp(Incoming call from extension ${AMPUSER})
exten => s,n,Set(GLOBAL(911CB)=${AMPUSER})
exten => s,n,NoOp(Setting return emergency destination to ${911CB})

exten => s,n,GotoIf($[${911CB} = "0"]?user0)
exten => s,n,GotoIf($[${911CB} = "5001"]?user1)
;exten => s,n,MacroExit

exten => s,n,(user0)GoSub(func-set-sipheader,s,1(Geolocation-Routing,no))
exten => s,n,GoSub(func-set-sipheader,s,1(Geolocation,<https://emergency.bandwidth.com/locations/5008554/GL-test-0001?loc=Test%20Call>))
exten => s,n,GoSub(func-set-sipheader,s,1(P-Asserted-Identity,<sip:[email protected]:5060>))
exten => s,n,NoOp(Location set to Test Call)
exten => s,n,MacroExit

exten => s,n,(user1)GoSub(func-set-sipheader,s,1(Geolocation-Routing,no))
exten => s,n,GoSub(func-set-sipheader,s,1(Geolocation,<https://emergency.bandwidth.com/locations/5008554/GL-test-0001?loc=Front%20Office>))
exten => s,n,GoSub(func-set-sipheader,s,1(P-Asserted-Identity,<sip:[email protected]:5060>))
exten => s,n,NoOp(Location set to Front Office)
exten => s,n,MacroExit

Providing Great Debug - Support Services - Sangoma Documentation (atlassian.net)

I dont think I, ready for a debug. I am unable to even get a simple gotoif to work like below

[macro-dialout-trunk-predial-hook]
exten => s,1,Noop(Entering user defined context macro-dialout-one-predial-hook in extensions_custom.conf)
exten => s,n,Set(GLOBAL(911CB)=0)

exten => s,n,GotoIf($[${911CB} = “0”]?user0)
exten => s,n,GotoIf($[${911CB} = “5000”]?user1)

exten => s,n,(user0)Noop(Loop 1)
exten => s,n,MacroExit

exten => s,n,(user1)Noop(Loop 2)
exten => s,n,MacroExit

  1. Why do you need to use Global variables?
  2. Your labels appear to be in the wrong format

Try this, if it doesn’t work, please post a call trace as mentioned above

[macro-dialout-trunk-predial-hook]
exten => s,1,Noop(Entering user defined context macro-dialout-one-predial-hook in extensions_custom.conf)
exten => s,n,Set(911CB=${AMPUSER})

exten => s,n,GotoIf($["${911CB}" = "0"]?user0)
exten => s,n,GotoIf($["${911CB}" = "5000"]?user1)

exten => s,n(user0),Noop(Loop 1)
exten => s,n,MacroExit

exten => s,n(user1),Noop(Loop 2)
exten => s,n,MacroExit

This makes no sense to me… The debug literally tells you how a call flows through your dial plan and where it breaks? Why do you think this is not the next step in troubleshooting?

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.