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, 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? -- Robin Vleij
On Fri, Dec 18, 2009 at 2:21 AM, Robin Vleij <viper@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, 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
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@fx-services.com <mailto:viper@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
On 12/18/09 7:18 PM, Michael Collins wrote: Hi Michael,
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
Cool idea, didn't think about that!
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:
Right, makes sense. Going to try a bit in that direction. Do the enum lookup and then transfer to an enum handling context. Simple, should have thought about that. :)
This is just one way to do it without using a scripting lang. you can by all means use Lua as well.
My main question there really was, since I'm not able to work on vars I set in an extention, will that work if I return vars from a script? It should really, but I was asking to make sure it would. I think in that design, the script would have been like three rules or something, but keeping it in the dialplan is nicer, I think (even though it says "don't do magic in the dialplan, do it in scripts" on the wiki). I'll report back when I managed to fiddle something together. /Robin
participants (3)
-
Metik
-
Michael Collins
-
Robin Vleij