which language to implement dial plans in?
I am new to freeswitch, and wondering which of the many languages to implement my rather complex dial plan in. I know i can't express my desires in the normal XML language, because I need looping and database access, so which language is the best tested and most reliable in terms of usage with FreeSwitch. My finalists so far are Lua, Python, and good old C. Haven't used python or lua yet, but I figure C will have a big performance advantage. but maybe not important considering how much greater the CPU load in the switch is devoted to handling audio streams... edj
On Feb 18, 2011 8:51 AM, "Edward de Jong" <edward.dejong@voicecarrier.com> wrote:
I am new to freeswitch, and wondering which of the many languages to
implement my rather complex dial plan in. I know i can't express my desires in the normal XML language, because I need looping and database access There is a mod called mod_odbc_query in the git contrib that lets you make sql queries from the dialplan. The static xml can do a lot. I'm not sure what you mean by looping, but you can transfer to a new number, and it can restart going through thr dialplan. , so which language is the best tested and most reliable in terms of usage with FreeSwitch. My finalists so far are Lua, Python, and good old C. Haven't used python or lua yet, but I figure C will have a big performance advantage.
but maybe not important considering how much greater the CPU load in the
switch is devoted to handling audio streams...
Lua can be run directly, whereas python would be used eith mod_xml_curl, served from a server (I do tis with php) so if you know lua, use it. If you like python, use that. C is probably overkill becaue you would need to compile it for any change you make. If you have standardized functions that don't already have a mod, then by all means write a modin C and share it wih the community. -Avi
edj
_______________________________________________ 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
Lua can be run directly, whereas python would be used eith mod_xml_curl, served from a server (I do tis with php) so if you know lua, use it. If you like python, use that.
Not true - while you can implement the script that mod_xml_curl using Python, you can also use it directly within FreeSWITCH just like Lua: http://wiki.freeswitch.org/wiki/Mod_python -Steve On 18 February 2011 08:17, Avi Marcus <avi@avimarcus.net> wrote:
On Feb 18, 2011 8:51 AM, "Edward de Jong" <edward.dejong@voicecarrier.com> wrote:
I am new to freeswitch, and wondering which of the many languages to
implement my rather complex dial plan in. I know i can't express my desires in the normal XML language, because I need looping and database access There is a mod called mod_odbc_query in the git contrib that lets you make sql queries from the dialplan. The static xml can do a lot. I'm not sure what you mean by looping, but you can transfer to a new number, and it can restart going through thr dialplan.
, so which language is the best tested and most reliable in terms of usage with FreeSwitch. My finalists so far are Lua, Python, and good old C. Haven't used python or lua yet, but I figure C will have a big performance advantage.
but maybe not important considering how much greater the CPU load in the
switch is devoted to handling audio streams...
Lua can be run directly, whereas python would be used eith mod_xml_curl, served from a server (I do tis with php) so if you know lua, use it. If you like python, use that. C is probably overkill becaue you would need to compile it for any change you make. If you have standardized functions that don't already have a mod, then by all means write a modin C and share it wih the community. -Avi
edj
_______________________________________________ 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
_______________________________________________ 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
C is faster, but it's probably not worth it unless you can show that there's enough processing being done by your script that it'd have an impact. It's slightly more work to tweak it than just editing a script since you'd need to recompile and reload the module, which might also be trickier if you're handling traffic at the time. Lua (mod_lua) is probably the most commonly used language, but there's also Python (mod_python) as you've spotted. There's also JavaScript (mod_spidermonkey) which you haven't mentioned. Which you use is really up to you though. As far as database access goes, from Lua check out: http://wiki.freeswitch.org/wiki/Lua_freeswitch_dbh It gives you a database interface without having to install and configure luasql, and you get to take advantage of the FS connection pooling which you wouldn't if you were using the native support. That'll should speed up database access times (you'll in most cases already be connected to the database so the call doesn't have to wait while you connect). I don't think that interface is available in the other languages just yet though. -Steve On 18 February 2011 06:17, Edward de Jong <edward.dejong@voicecarrier.com>wrote:
I am new to freeswitch, and wondering which of the many languages to implement my rather complex dial plan in. I know i can't express my desires in the normal XML language, because I need looping and database access, so which language is the best tested and most reliable in terms of usage with FreeSwitch. My finalists so far are Lua, Python, and good old C. Haven't used python or lua yet, but I figure C will have a big performance advantage.
but maybe not important considering how much greater the CPU load in the switch is devoted to handling audio streams...
edj
_______________________________________________ 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
mod_python, cool. I've heard lua has a very low overhead, but what about mod_python (or PHP ESL)? I'd imagine the script would have to be left "running" until the call completed. mod_python seems pretty well fleshed out... -Avi On Fri, Feb 18, 2011 at 11:07 AM, Steven Ayre <steveayre@gmail.com> wrote:
C is faster, but it's probably not worth it unless you can show that there's enough processing being done by your script that it'd have an impact. It's slightly more work to tweak it than just editing a script since you'd need to recompile and reload the module, which might also be trickier if you're handling traffic at the time.
Lua (mod_lua) is probably the most commonly used language, but there's also Python (mod_python) as you've spotted. There's also JavaScript (mod_spidermonkey) which you haven't mentioned. Which you use is really up to you though.
As far as database access goes, from Lua check out: http://wiki.freeswitch.org/wiki/Lua_freeswitch_dbh
It gives you a database interface without having to install and configure luasql, and you get to take advantage of the FS connection pooling which you wouldn't if you were using the native support. That'll should speed up database access times (you'll in most cases already be connected to the database so the call doesn't have to wait while you connect). I don't think that interface is available in the other languages just yet though.
-Steve
On 18 February 2011 06:17, Edward de Jong <edward.dejong@voicecarrier.com>wrote:
I am new to freeswitch, and wondering which of the many languages to implement my rather complex dial plan in. I know i can't express my desires in the normal XML language, because I need looping and database access, so which language is the best tested and most reliable in terms of usage with FreeSwitch. My finalists so far are Lua, Python, and good old C. Haven't used python or lua yet, but I figure C will have a big performance advantage.
but maybe not important considering how much greater the CPU load in the switch is devoted to handling audio streams...
edj
_______________________________________________ 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
_______________________________________________ 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
In terms of running python scripts, it's running for the same time the equivalent lua one would be. Don't know how the overhead compares, although I expect lua is lower. -Steve On 18 February 2011 10:37, Avi Marcus <avi@avimarcus.net> wrote:
mod_python, cool. I've heard lua has a very low overhead, but what about mod_python (or PHP ESL)? I'd imagine the script would have to be left "running" until the call completed. mod_python seems pretty well fleshed out... -Avi
On Fri, Feb 18, 2011 at 11:07 AM, Steven Ayre <steveayre@gmail.com> wrote:
C is faster, but it's probably not worth it unless you can show that there's enough processing being done by your script that it'd have an impact. It's slightly more work to tweak it than just editing a script since you'd need to recompile and reload the module, which might also be trickier if you're handling traffic at the time.
Lua (mod_lua) is probably the most commonly used language, but there's also Python (mod_python) as you've spotted. There's also JavaScript (mod_spidermonkey) which you haven't mentioned. Which you use is really up to you though.
As far as database access goes, from Lua check out: http://wiki.freeswitch.org/wiki/Lua_freeswitch_dbh
It gives you a database interface without having to install and configure luasql, and you get to take advantage of the FS connection pooling which you wouldn't if you were using the native support. That'll should speed up database access times (you'll in most cases already be connected to the database so the call doesn't have to wait while you connect). I don't think that interface is available in the other languages just yet though.
-Steve
On 18 February 2011 06:17, Edward de Jong <edward.dejong@voicecarrier.com
wrote:
I am new to freeswitch, and wondering which of the many languages to implement my rather complex dial plan in. I know i can't express my desires in the normal XML language, because I need looping and database access, so which language is the best tested and most reliable in terms of usage with FreeSwitch. My finalists so far are Lua, Python, and good old C. Haven't used python or lua yet, but I figure C will have a big performance advantage.
but maybe not important considering how much greater the CPU load in the switch is devoted to handling audio streams...
edj
_______________________________________________ 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
_______________________________________________ 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
_______________________________________________ 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
participants (3)
-
Avi Marcus
-
Edward de Jong
-
Steven Ayre