Bruce Hopkins
2011-Mar-15 21:35 UTC
[asterisk-users] Passing an argument to a macro within an Originate command
Hi, With Asterisk 1.8.3, I can't figure out how to pass an argument to a macro which is used within an originate command. Here is my sample dialplan to illustrate: exten => 123,1,Answer() exten => 123,n,Originate(SIP/20,app,Macro,foo,bar) exten => 123,n,NoOp(This is the NoOp after the originate command) exten => 123,n,Wait(30) exten => 123,n,Hangup() [macro-foo] exten => s,1,Answer() exten => s,2,NoOp(arg1 is ${ARG1} and arg2 is ${ARG2}) exten => s,3,Playback(tt-monkeys) I was hoping the ${ARG1} within the macro would be 'bar', but the argument does not seem to be passed on to the macro so far as I can tell. Here is the CLI output: pbx*CLI> == Using SIP RTP TOS bits 184 == Using SIP RTP CoS mark 5 -- Executing [123 at from-internal:1] Answer("SIP/21-0000000c", "") in new stack -- Executing [123 at from-internal:2] Originate("SIP/21-0000000c", "SIP/20,app,Macro,foo,bar") in new stack == Using SIP RTP TOS bits 184 == Using SIP RTP CoS mark 5 -- Launching Macro(foo) on SIP/20-0000000d -- Executing [s at macro-foo:1] Answer("SIP/20-0000000d", "") in new stack -- Executing [s at macro-foo:2] NoOp("SIP/20-0000000d", "*arg1 is and arg2 is *") in new stack -- Executing [s at macro-foo:3] Playback("SIP/20-0000000d", "tt-monkeys") in new stack -- <SIP/20-0000000d> Playing 'tt-monkeys.gsm' (language 'en') -- Executing [123 at from-internal:3] NoOp("SIP/21-0000000c", "This is the NoOp after the originate command") in new stack -- Executing [123 at from-internal:4] Wait("SIP/21-0000000c", "30") in new stack -- Executing [123 at from-internal:5] Hangup("SIP/21-0000000c", "") in new stack == Spawn extension (from-internal, 123, 5) exited non-zero on 'SIP/21-0000000c' -- Executing [h at from-internal:1] Macro("SIP/21-0000000c", "hangupcall") in new stack -- Executing [s at macro-hangupcall:1] GotoIf("SIP/21-0000000c", "1?skiprg") in new stack -- Goto (macro-hangupcall,s,4) -- Executing [s at macro-hangupcall:4] GotoIf("SIP/21-0000000c", "1?skipblkvm") in new stack -- Goto (macro-hangupcall,s,7) -- Executing [s at macro-hangupcall:7] GotoIf("SIP/21-0000000c", "1?theend") in new stack -- Goto (macro-hangupcall,s,9) -- Executing [s at macro-hangupcall:9] Hangup("SIP/21-0000000c", "") in new stack == Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'SIP/21-0000000c' in macro 'hangupcall' == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/21-0000000c' Could anyone tell me what I am doing wrong please? Many thanks in advance for any assistance anyone is able to offer. Best regards Bruce Hopkins -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110315/0c4e2cd2/attachment.htm>
Danny Nicholas
2011-Mar-15 21:37 UTC
[asterisk-users] Passing an argument to a macro within an Originatecommand
_____ From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Bruce Hopkins Sent: Tuesday, March 15, 2011 4:36 PM To: asterisk-users at lists.digium.com Subject: [asterisk-users] Passing an argument to a macro within an Originatecommand Hi, With Asterisk 1.8.3, I can't figure out how to pass an argument to a macro which is used within an originate command. Here is my sample dialplan to illustrate: exten => 123,1,Answer() exten => 123,n,Originate(SIP/20,app,Macro,foo,bar) exten => 123,n,NoOp(This is the NoOp after the originate command) exten => 123,n,Wait(30) exten => 123,n,Hangup() [macro-foo] exten => s,1,Answer() exten => s,2,NoOp(arg1 is ${ARG1} and arg2 is ${ARG2}) exten => s,3,Playback(tt-monkeys) I was hoping the ${ARG1} within the macro would be 'bar', but the argument does not seem to be passed on to the macro so far as I can tell. Here is the CLI output: pbx*CLI> == Using SIP RTP TOS bits 184 == Using SIP RTP CoS mark 5 -- Executing [123 at from-internal:1] Answer("SIP/21-0000000c", "") in new stack -- Executing [123 at from-internal:2] Originate("SIP/21-0000000c", "SIP/20,app,Macro,foo,bar") in new stack == Using SIP RTP TOS bits 184 == Using SIP RTP CoS mark 5 -- Launching Macro(foo) on SIP/20-0000000d -- Executing [s at macro-foo:1] Answer("SIP/20-0000000d", "") in new stack -- Executing [s at macro-foo:2] NoOp("SIP/20-0000000d", "arg1 is and arg2 is ") in new stack -- Executing [s at macro-foo:3] Playback("SIP/20-0000000d", "tt-monkeys") in new stack -- <SIP/20-0000000d> Playing 'tt-monkeys.gsm' (language 'en') -- Executing [123 at from-internal:3] NoOp("SIP/21-0000000c", "This is the NoOp after the originate command") in new stack -- Executing [123 at from-internal:4] Wait("SIP/21-0000000c", "30") in new stack -- Executing [123 at from-internal:5] Hangup("SIP/21-0000000c", "") in new stack == Spawn extension (from-internal, 123, 5) exited non-zero on 'SIP/21-0000000c' -- Executing [h at from-internal:1] Macro("SIP/21-0000000c", "hangupcall") in new stack -- Executing [s at macro-hangupcall:1] GotoIf("SIP/21-0000000c", "1?skiprg") in new stack -- Goto (macro-hangupcall,s,4) -- Executing [s at macro-hangupcall:4] GotoIf("SIP/21-0000000c", "1?skipblkvm") in new stack -- Goto (macro-hangupcall,s,7) -- Executing [s at macro-hangupcall:7] GotoIf("SIP/21-0000000c", "1?theend") in new stack -- Goto (macro-hangupcall,s,9) -- Executing [s at macro-hangupcall:9] Hangup("SIP/21-0000000c", "") in new stack == Spawn extension (macro-hangupcall, s, 9) exited non-zero on 'SIP/21-0000000c' in macro 'hangupcall' == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/21-0000000c' Could anyone tell me what I am doing wrong please? Many thanks in advance for any assistance anyone is able to offer. Best regards Bruce Hopkins This might do it exten => 123,n,Originate(SIP/20,app,Macro(foo,bar)) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110315/19070b6c/attachment.htm>