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

George Joseph george.joseph at fairview5.com
Fri Jun 6 11:49:55 CDT 2014


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;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20140606/50979563/attachment.html>


More information about the asterisk-users mailing list