[Freeswitch-users] LUA and return variables
Metik
freeswitch-users-list at metik.com
Fri Dec 18 11:13:03 PST 2009
I use a similar method (transfer to XML dialplan based on the value of
"${enum_route_1}") to determine if the SIP URI is native to a particular
FS instance or if it needs to be sent off-net and it works well.
-metik
Michael Collins wrote:
>
>
> On Fri, Dec 18, 2009 at 2:21 AM, Robin Vleij <viper at fx-services.com
> <mailto:viper at fx-services.com>> wrote:
>
> Hi guys (and girls)!
>
> I'm working on a little bit of ENUM trickery and I tried doing some
> (illegal) nested conditions. :-)
>
> What I want to do is to first check enum with the ENUM application,
> then depending on the answer do some stuff. Say that the domain part
> of the ENUM answer is robin.nl <http://robin.nl>, then I want to
> do action X instead of
> just briding the enum answer directly as I see in most examples.
>
> But I remembered that it wasn't allowed to do nested conditions. So
> what I did was stacked conditions. After that I read the dialplan wiki
> pages again and figured that my regexp never matches because variables
> I "set" during some phase of the extension I can't use in the same
> "go" as another condition. So, now my plan is to use LUA to do the
> regexp.
>
> I'll pass the enum answer to a lua script which will split the answer
> in a user and domain part and return those two to the main app. Then
> based on those two vars I'll do routing or other actions (like, prefix
> and then route).
>
> Is this how I'm supposed to do it? I can't find many examples on
> manipulating ENUM answers, other than bridging them directly. I can't
> change the way I do stuff to ENUM answers, because in most cases I'll
> just route them out the standard way.
>
> Anyone with experience on fiddling with ENUM answers?
>
>
> One thing you can do is create an extension that does the enum look up
> and then transfers the call back into the dialplan. You could set up a
> separate context that handles just the enum checking. Your condition
> would just need to match whatever var you put the enum return val in.
> So if your var name is "enum_res" then you can transfer like this
> after your enum lookup:
>
> <action application="transfer" data="${enum_res} XML my_enum_context"/>
>
> Then create a context named "my_enum_context" and match for the
> condition(s) you need, like:
> <condition field="${enum_res}" expression="robin\.nl">
> do stuff
> </condition>
>
> Then have a different extension for other values of enum_res...
>
> This is just one way to do it without using a scripting lang. you can
> by all means use Lua as well.
> -MC
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
More information about the FreeSWITCH-users
mailing list