Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

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


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
dennis.guse at alumni....
Guest





PostPosted: Fri Jun 06, 2014 2:49 am    Post subject: [asterisk-users] Using macros in extensions.lua? Reply with quote

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

Quality and Usability Lab
Telekom Innovation Laboratories
TU Berlin
Ernst-Reuter-Platz 7
D-10587 Berlin, Germany
Tel: +49 30 8353 58874
Fax: +49 30 8353 58409
E-mail: dennis.guse@telekom.de (dennis.guse@telekom.de)
Web: www.qu.tlabs.tu-berlin.de
Back to top
george.joseph at fairv...
Guest





PostPosted: Fri Jun 06, 2014 11:50 am    Post subject: [asterisk-users] Using macros in extensions.lua? Reply with quote

On Fri, Jun 6, 2014 at 1:48 AM, Dennis Guse <dennis.guse@alumni.tu-berlin.de (dennis.guse@alumni.tu-berlin.de)> wrote:
Quote:
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;

}
Back to top
dennis.guse at alumni....
Guest





PostPosted: Mon Jun 09, 2014 2:54 pm    Post subject: [asterisk-users] Using macros in extensions.lua? Reply with quote

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@fairview5.com (george.joseph@fairview5.com)> wrote:
Quote:
On Fri, Jun 6, 2014 at 1:48 AM, Dennis Guse <dennis.guse@alumni.tu-berlin.de (dennis.guse@alumni.tu-berlin.de)> wrote:
Quote:
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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services