[asterisk-users] Using macros in extensions.lua?

Dennis Guse dennis.guse at alumni.tu-berlin.de
Mon Jun 9 14:53:45 CDT 2014


Got it:

extensions = {
["macro-test"] = {
["s"] = function(c, e)
 app.verbose("This is my macro")
end;
};

default = {

["_X"] = function(c, e)
app.dial("SIP/00", nil, "mM(test)")
 end;
};
};


---
Dennis Guse


On Fri, Jun 6, 2014 at 6:49 PM, George Joseph <george.joseph at fairview5.com>
wrote:

> On Fri, Jun 6, 2014 at 1:48 AM, Dennis Guse <
> dennis.guse at alumni.tu-berlin.de> wrote:
>
>> Hi,
>>
>> 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.
>>
>> Working old style would be (extensions.conf)
>>
>> [default]
>> exten => _X,1,dial(SIP/1,,M(mymacro^parameter))
>>
>> [macro-mymacro]
>> exten => s,1,verbose(${ARG1})
>>
>> How to implement the same functionality using pbx_lua?
>>
>> Details: Asterisk 11.7 on Ubuntu 14.04
>>
>> Kind regards
>>
>> Dennis Guse
>>
>> Here's how I do it for pre-dial handlers...
>
> extensions.handlers = {
>   ["addheader"] = function(c,e)
>   channel.PJSIP_HEADER('add', "Alert-Info"):set(";info=custom1")
>   end;
> }
>
> extensions.local_default = {
>   ["9999"] = function(c,e)
>   app.dial('PJSIP/'..e,nil,'b(handlers^addheader^1)')
>   end;
> }
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20140609/b9e4d279/attachment.html>


More information about the asterisk-users mailing list