I have a macro for standard extensions that gets called with 2 arguments; the extension and a variable that is set to the technology/number. A snip of this is shown below. The calls do not complete
This is what i see on the console:
– Executing Macro(“SIP/x.x.x.x-09778998”, “stdext|9999999999|”) in new stack
I get the following warning on the console as well:
Jul 27 11:15:11 WARNING[5000]: app_dial.c:803 dial_exec_full: Dial requires an argument (technology/number)
As you can see, the variable is not being interpreted and a blank is being sent. If I call the macro with the SIP/9999999999 as the 2nd argument, it works just fine. There’s something about the variable that isn’t working. Any help would be appreciated.
[TEST]
BRUCE=SIP/9999999999
exten => 9999999999,1,Macro(stdext,${EXTEN},${BRUCE})
[macro-stdext]
;ARG1 is the extension number
;ARG2 is the device
exten => s,1,Dial(${ARG2},20)
exten => s,2,Voicemail(u${ARG1})
;exten => s,3,MusicOnHold(default)
exten => s,102,Voicemail(b${ARG1})
exten => s,103,Hangup
if Yopu want global variable BRUCE, You should declare it in [general] section, not in [test] context.
if variable doesn’t exist You can’t pass it to macro.
You can also try
exten => 9999,1,Set(BRUCE=9999)
exten => 9999,2,Macro(stdext,${EXTEN},${BRUCE})
I tried declaring the variable BRUCE in the [general] section with the same result. I do not want to set the variable in the context for the caller. Eventually the variable will be read in from a database, so i want this to be data driven, not hard-coded.
it’s looks taht You have some errors in variable declaration.
i create extensions.conf :
[general]
static=yes
writeprotect=no
[globals]
BRUCE=SIP/103
[macro-stdext]
exten => s,1,Dial(${ARG1},20)
exten => s,n,Dial(SIP/${ARG2},10)
exten => s,n,Hangup
[sip]
exten => 9999999999,1,noop(------ ${BRUCE} ---- ${EXTEN} ---)
exten => 9999999999,n,macro(stdext,${BRUCE},${EXTEN})
it’s good enough for testing variables passing
i have only one 103 SIP number
CLI> output
MtG*CLI>
-- Executing NoOp("SIP/103-08170a58", "------ SIP/103 ---- 9999999999 ---") in new stack
-- Executing Macro("SIP/103-08170a58", "stdext|SIP/103|9999999999") in new stack
-- Executing Dial("SIP/103-08170a58", "SIP/103|20") in new stack
-- Called 103
-- SIP/103-0817b778 is ringing
-- Nobody picked up in 20000 ms
-- Executing Dial("SIP/103-08170a58", "SIP/9999999999|10") in new stack
Jul 27 21:29:56 WARNING[19171]: chan_sip.c:1980 create_addr: No such host: 9999999999
Jul 27 21:29:56 NOTICE[19171]: app_dial.c:1049 dial_exec_full: Unable to create channel of type 'SIP' (cause 3 - No route to destination)
== Everyone is busy/congested at this time (1:0/0/1)
-- Executing Hangup("SIP/103-08170a58", "") in new stack
== Spawn extension (macro-stdext, s, 3) exited non-zero on 'SIP/103-08170a58' in macro 'stdext'
== Spawn extension (macro-stdext, s, 3) exited non-zero on 'SIP/103-08170a58'
variables are passing correctly. check up variables declaration in dialplan
I fixed this by declaring the variables in the [globals] section.
Thanks for the help.