[asterisk-users] Passing an argument to a macro within an Originatecommand

Andrew Thomas andy at datavox.co.uk
Thu Mar 17 04:50:06 CDT 2011


The last Originate() option is ignored if using 'app'.  It is only there
for 'exten'.

http://www.voip-info.org/wiki/view/Asterisk+cmd+Originate tells all :)



-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Bruce
Hopkins
Sent: 15 March 2011 21:36
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


 If you have received this communication in error we would appreciate
you advising us either by telephone or return of e-mail. The contents
of this message, and any attachments, are the property of DataVox,
and are intended for the confidential use of the named recipient only.
If you are not the intended recipient, employee or agent responsible
for delivery of this message to the intended recipient, take note that
any dissemination, distribution or copying of this communication and
its attachments is strictly prohibited, and may be subject to civil or
criminal action for which you may be liable.
Every effort has been made to ensure that this e-mail or any attachments
are free from viruses. While the company has taken every reasonable
precaution to minimise this risk, neither company, nor the sender can
accept liability for any damage which you sustain as a result of viruses.
It is recommended that you should carry out your own virus checks
before opening any attachments. 

Registered in England. No. 27459085.





More information about the asterisk-users mailing list