Re: LUA scripting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ian,

Ian Blenke wrote:
> LUA as a domain-specific language is a great idea!
> 
> Unfortunately, the LUA implemented by ptlib is pretty basic. Any
> chance of including extensions like LuaSocket?

I agree that that sockets would be very useful. Do you know what it
would take to include the LuaSocket in PTLib ? I'm pretty sure Robert
and Craig are fine with us adding more functionality. I already had to
expand it a bit to get the GnuGk implementation to work.


> At the moment, based on the Route.cxx, it looks like the script is
> passed these fields:
> 
>   source
>   calledAlias
>   calledIP
>   caller
>   callingStationId
>   callID
>   messageType
>   clientauthid
> 
> While those are definitely based in the legacy of the current gnugk
> codebase (not trying to be insulting here, really!), I'm not really
> fond of that naming convention. In my head, I think of things in terms
> of Wireshark, like this:
> 
>   Q.931:
>     displayName
>     callingPartyNumber
>     calledPartyNumber
>   H.225:
>     sourceAddressIP
>     sourceAddressDialedDigits
>     sourceAddressH323Id
>     sourceAddressH323Url
>     destinationAddressIP
>     destinationAddressDialedDigits
>     destinationAddressH323Id
>     destinationAddressH323Url
>     sourceCallSignalAddressIP
>     destinationCallSignalAddressIP
>     callIdentifier
>     clientAuthID

Again, I agree that the current names aren't great. But since they
don't 1:1 represent Q.931 or H.225 items, we shouldn't pretend they
are: The same variables are made available for routing calls based on
ARQ, Setup, LRQ and facilty messages. The current fields are filled
with the closest equivalent in those messages so you don't have to
write specific code for all 4 situations (but you can look at
messageType if you really want to know what you are routing).

Secondly, if you split eg. the sourceAddress from a Setup by alias type
into 4 (or more) variables thats going to lead to terrible if/else
cascades in the routing code.


> The pseudocode of what happens after the script returns is something like this:
> 
>   if action == "REJECT"      => reject the call, and set ISDN Q.931
> result code to rejectCode
> 
>   if destAlias => H323SetAliasAddress(destAlias)
> 
>   if destIP =>  SocketToH225TransportAddr(ip, port)
> 	if destAlias => route.m_destNumber = destAlias
> 
> This looks like a REJECT or RouteToGateway kind of function.
> 
> Having a RouteToAlias function to deliver calls to locally registered
> endpoints is important as well.

If you set the destIP="" and destAlias="123" you get local delivery
like RouteToAlias.

> It would be great to be able to do things like BindAndRouteToGateway,
> but that may be a bit beyond what everyone else really needs gnugk to
> do.

That shouldn't be too hard. the underlying functionality is already
there from vqueue routing.


> > It would also be cool to have this kind of scripting ability for CLI
> > rewriting...
> 
> That sounds intriguing.
> 
> I'm not conceptualizing what you're proposing... have some example use cases?

What I don't like about the current implementation are 2 things:
a.) When you look at just the LUA code, its hard to see where the input
and where the output is. Its hidden in imlicitely filled variables.

b.) The code in GnuGk to fill the inputs and read the outputs is
alraedy quite repetative and would imagine the number of variables only
grows over time. If there were a way to generically access and modify
_all_ fields of the message being routed on that would be a huge stzep
forward. But this isn't only a question of the LUA interface; the whole
routing policy mechanism would have to be rewritten for that.

Right now, I don't need the LUA stuff for any project. I'm just toying
with it to get a feel for what a good API might look like. 

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

------------------------------------------------------------------------------
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/


[Index of Archives]     [SIP]     [Open H.323]     [Gnu Gatekeeper]     [Asterisk PBX]     [ISDN Cause Codes]     [Yosemite News]

  Powered by Linux