PS: You need to compile with the latest PTLib SVN to enable LUA scripting. Jan Willamowius wrote: > Hi, > > the LUA scripting is still highly experimental and the way how LUA > scripts interface with GnuGk may still change. Thats why I haven't added > anything to the manual, yet. > > The main idea is that you shouldn’t have to worry about keeping another > process running to make complex routing decisions or destination > rewrites. Right now the 'lua' policy can do about the same things the > 'vqueue' and 'sql' policies can do, just more convenient. > > With the latest CVS, you can add > > [RoutingPolicy] > default=lua,explicit,internal > > [Routing::Lua] > ;Script=destAlias=string.gsub(calledAlias, "#", "*") > ;Script=destAlias=calledAlias;destAlias=string.gsub(destAlias, "#", "*") > ScriptFile=myscript.lua > > The current interface between LUA and GnuGk is that the script gets > access to a number of global symbols, like "calledAlias" and writes the > new destination to "destAlias" and GnuGk will treat this the same as a > RouteToAlias. What you do in the LUA script to make the transformation > is all up to you. > There are a few more symbols you can use. See Routing.cxx. > > If somebody tries this, please give me feedback how you like the > interface. I'm considering to move away from the lists of symbols maybe > towards functions GetProperty("calledAlias") and > SetProperty("destAlias", "new value") or even something completely > different. > > It would also be cool to have this kind of scripting ability for CLI > rewriting... > > Regards, > Jan > > -- > Jan Willamowius, Founder of the GNU Gatekeeper Project > EMail : jan@xxxxxxxxxxxxxx > Website: http://www.gnugk.org > Support: http://www.willamowius.com/gnugk-support.html > > > Robert Kulagowski wrote: > > On Tue, Feb 7, 2012 at 2:16 PM, Robert Kulagowski <rkulagow@xxxxxxxxx> wrote: > > > Any pointers on how to use lua to do things? > > > > To expand on this, I'm wondering if Lua is going to assist me. > > > > I have implemented a "flat" dialplan in my company. Endpoints > > register to the GnuGK using countrycode-ISDN-number, so in the U.S. > > they're registered as 13125678901, in the UK they're registered as > > 442072987654, etc. > > > > The issue I run into is that users are used to dialing international > > escape codes, even when they don't need them, so a user in the U.S. > > may dial 011442072987654 to reach an internal system. > > > > To avoid unnecessary ISDN charges, I wrote a vqueue perl script that's > > triggered on 011, 00, 0011 which are the international escape codes > > that I see worldwide. > > > > The script takes off the escape code, then does a lookup of the number > > that remains, and checks if that number maps to an internal alias. > > > > it then has logic that does this: > > > > rejectRoute is true when we don't want the endpoint to use one of the > > ISDN gateways. isAlias is true when we've mapped a dialed ISDN number > > to an internal H323-name. > > > > if ( !$rejectRoute ) { > > if ($isAlias) { > > print "destination alias is $destinationAlias and > > destinationIP is $dialedDestination\n"; > > print "routetoalias $destinationAlias"." $EP_ID $CRV\n"; > > print $sock "routetoalias $destinationAlias"." $EP_ID $CRV\n"; > > $sock->getline(); > > $isAlias = false; > > } > > else { > > print "routetogateway $destinationAlias $destinationIP > > $EP_ID $CRV\n"; > > print $sock "routetogateway $destinationAlias > > $destinationIP $EP_ID $CRV\n"; > > $sock->getline(); > > } > > } > > else #route was rejected, so EP should use its native ISDN > > { > > $rejectRoute = false; > > print "Rejecting route\n"; > > print $sock "routereject $EP_ID $CRV\n"; > > $sock->getline(); > > } > > } > > } > > > > Would Lua allow more flexibility in how numbers are manipulated and > > rewritten prior to a final routing decision being made by GnuGK? ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________________ Posting: mailto:Openh323gk-users@xxxxxxxxxxxxxxxxxxxxx Archive: http://sourceforge.net/mailarchive/forum.php?forum_name=openh323gk-users Unsubscribe: http://lists.sourceforge.net/lists/listinfo/openh323gk-users Homepage: http://www.gnugk.org/