<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Bruce Hopkins<br>
<b><span style='font-weight:bold'>Sent:</span></b> Tuesday, March 15, 2011 4:36
PM<br>
<b><span style='font-weight:bold'>To:</span></b>
asterisk-users@lists.digium.com<br>
<b><span style='font-weight:bold'>Subject:</span></b> [asterisk-users] Passing
an argument to a macro within an Originatecommand</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Hi,<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>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.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Here is my sample dialplan to illustrate:<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'>exten => 123,1,Answer()</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'>exten =>
123,n,Originate(SIP/20,app,Macro,foo,bar)</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'>exten => 123,n,NoOp(This is the NoOp
after the originate command)</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'>exten => 123,n,Wait(30)</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'>exten => 123,n,Hangup()</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'>[macro-foo]</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'>exten => s,1,Answer()</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'>exten => s,2,NoOp(arg1 is ${ARG1} and
arg2 is ${ARG2})</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'>exten => s,3,Playback(tt-monkeys)</span></font><o:p></o:p></p>
</div>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>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.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Here is the CLI output:<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'>pbx*CLI> </span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> == Using SIP RTP TOS bits
184</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> == Using SIP RTP CoS mark 5</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[123@from-internal:1] Answer("SIP/21-0000000c", "") in new
stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[123@from-internal:2] Originate("SIP/21-0000000c",
"SIP/20,app,Macro,foo,bar") in new stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> == Using SIP RTP TOS bits
184</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> == Using SIP RTP CoS mark 5</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Launching
Macro(foo) on SIP/20-0000000d</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[s@macro-foo:1] Answer("SIP/20-0000000d", "") in new stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[s@macro-foo:2] NoOp("SIP/20-0000000d", "<b><span
style='font-weight:bold'>arg1 is and arg2 is </span></b>") in new
stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[s@macro-foo:3] Playback("SIP/20-0000000d", "tt-monkeys")
in new stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> --
<SIP/20-0000000d> Playing 'tt-monkeys.gsm' (language 'en')</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[123@from-internal:3] NoOp("SIP/21-0000000c", "This is the NoOp
after the originate command") in new stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[123@from-internal:4] Wait("SIP/21-0000000c", "30") in new
stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[123@from-internal:5] Hangup("SIP/21-0000000c", "") in new
stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> == Spawn extension
(from-internal, 123, 5) exited non-zero on 'SIP/21-0000000c'</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[h@from-internal:1] Macro("SIP/21-0000000c", "hangupcall")
in new stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[s@macro-hangupcall:1] GotoIf("SIP/21-0000000c",
"1?skiprg") in new stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Goto
(macro-hangupcall,s,4)</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[s@macro-hangupcall:4] GotoIf("SIP/21-0000000c",
"1?skipblkvm") in new stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Goto (macro-hangupcall,s,7)</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[s@macro-hangupcall:7] GotoIf("SIP/21-0000000c",
"1?theend") in new stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Goto
(macro-hangupcall,s,9)</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> -- Executing
[s@macro-hangupcall:9] Hangup("SIP/21-0000000c", "") in new
stack</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> == Spawn extension (macro-hangupcall,
s, 9) exited non-zero on 'SIP/21-0000000c' in macro 'hangupcall'</span></font><o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'> == Spawn extension
(from-internal, h, 1) exited non-zero on 'SIP/21-0000000c'</span></font><o:p></o:p></p>
</div>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Could anyone tell me what I am doing wrong please?<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Many thanks in advance for any assistance anyone is able to offer.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Best regards<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Bruce Hopkins<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>This might do it<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 color="#3333ff" face="Times New Roman"><span
style='font-size:12.0pt;color:#3333FF'>exten =>
123,n,Originate(SIP/20,app,Macro(foo,bar))</span></font><o:p></o:p></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
</div>
</div>
</div>
</body>
</html>