<div dir="ltr">Got it:<div><br></div><div><div>extensions = {</div><div><span class="" style="white-space:pre"> </span>["macro-test"] = {</div><div><span class="" style="white-space:pre"> </span>["s"] = function(c, e)</div>
<div><span class="" style="white-space:pre"> </span>app.verbose("This is my macro")</div><div><span class="" style="white-space:pre"> </span>end;</div><div><span class="" style="white-space:pre"> </span>};</div>
<div><br></div><div><span class="" style="white-space:pre"> </span>default = {</div><div><br></div><div><span class="" style="white-space:pre"> </span>["_X"] = function(c, e)</div><div><span class="" style="white-space:pre"> </span>app.dial("SIP/00", nil, "mM(test)")<br>
</div><div><span class="" style="white-space:pre"> </span>end;<br></div></div><div><span style="white-space:pre"> };</span><br></div><div><span style="white-space:pre">};</span></div></div><div class="gmail_extra"><br clear="all">
<div><br clear="all"><div>---<br>Dennis Guse</div>
</div>
<br><br><div class="gmail_quote">On Fri, Jun 6, 2014 at 6:49 PM, George Joseph <span dir="ltr"><<a href="mailto:george.joseph@fairview5.com" target="_blank">george.joseph@fairview5.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="">On Fri, Jun 6, 2014 at 1:48 AM, Dennis Guse <span dir="ltr"><<a href="mailto:dennis.guse@alumni.tu-berlin.de" target="_blank">dennis.guse@alumni.tu-berlin.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi,</span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">I have defined a dialplan in lua and now would like to use "dial" with the macro M to implement some logic, when the callee-channel gets created.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Working old style would be (extensions.conf)</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">[default]</div><div style="font-family:arial,sans-serif;font-size:13px">exten => _X,1,dial(SIP/1,,M(mymacro^parameter))</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">[macro-mymacro]</div><div style="font-family:arial,sans-serif;font-size:13px">exten => s,1,verbose(${ARG1})</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">How to implement the same functionality using pbx_lua?</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
Details: Asterisk 11.7 on Ubuntu 14.04</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><span lang="DE" style="font-size:10pt;font-family:Arial,sans-serif">Kind regards<br>
<br>Dennis <span style="background-color:rgb(255,255,204)">Guse</span><br></span><span style="font-size:10pt;font-family:Arial,sans-serif"><br></span></div></div></blockquote></div><div>Here's how I do it for pre-dial handlers...</div>
<div><br></div><div><div><font face="courier new, monospace" size="1">extensions.handlers = {</font></div><div><font face="courier new, monospace" size="1"><span style="white-space:pre-wrap"> </span>["addheader"] = function(c,e)</font></div>
<div><font face="courier new, monospace" size="1"><span style="white-space:pre-wrap"> </span>channel.PJSIP_HEADER('add', "Alert-Info"):set(";info=custom1")</font></div><div><font face="courier new, monospace" size="1"><span style="white-space:pre-wrap"> </span>end;<br>
</font></div><div><font face="courier new, monospace" size="1">}</font></div></div><div><font face="courier new, monospace" size="1"><br></font></div><div><font face="courier new, monospace" size="1"><div>extensions.local_default = { <span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>["9999"] = function(c,e)</div><div><span style="white-space:pre-wrap"> </span>app.dial('PJSIP/'..e,nil,'b(handlers^addheader^1)')</div><div>
<span style="white-space:pre-wrap"> </span>end;</div>
</font></div><div><font face="courier new, monospace" size="1">}</font></div><div><br></div></div></div></div>
<br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br></div>