Accessing Config Info From Database
Is there a way to access configuration information from a database (e.g. SQL) rather than from the XML files? Best Regards, Jerry
Take a look at http://wiki.freeswitch.org/wiki/Mod_xml_curl to get started. On Fri, Nov 13, 2009 at 4:59 PM, Jerry Richards <jerry.richards@teotech.com>wrote:
Is there a way to access configuration information from a database (e.g. SQL) rather than from the XML files?
Best Regards, Jerry
_______________________________________________ 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
Hi, You can use mod_xml_curl (generate xml on a webserver): http://wiki.freeswitch.org/wiki/Mod_xml_curl or mod_xml_odbc (generate xml in freeswitch): http://wiki.freeswitch.org/wiki/Mod_xml_odbc or LUA together with luasql (generate xml in freeswitch): http://wiki.freeswitch.org/wiki/Lua#For_serving_configuration regards, Leon On Fri, 2009-11-13 at 13:59 -0800, Jerry Richards wrote:
Is there a way to access configuration information from a database (e.g. SQL) rather than from the XML files?
Best Regards, Jerry
_______________________________________________ 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 Fri, Nov 13, 2009 at 11:28:55PM +0100, Leon de Rooij wrote:
Hi,
You can use mod_xml_curl (generate xml on a webserver):
http://wiki.freeswitch.org/wiki/Mod_xml_curl
or mod_xml_odbc (generate xml in freeswitch):
http://wiki.freeswitch.org/wiki/Mod_xml_odbc
or LUA together with luasql (generate xml in freeswitch):
http://wiki.freeswitch.org/wiki/Lua#For_serving_configuration
Or, if you're really crazy, the erlang module can do it too (even dynamically): http://wiki.freeswitch.org/wiki/Mod_erlang_event#XML_search_bindings :P Andrew
I have a bit of confusion about Lua scripting. When a script is invoked, should it always return an XML string that is used by FS? Or as in the case of dialplan examples, does it actually execute the dialplan (e.g. "session:answer();")? Best Regards, Jerry -----Original Message----- From: Leon de Rooij [mailto:leon@scarlet-internet.nl] Sent: Friday, November 13, 2009 2:29 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Accessing Config Info From Database Hi, You can use mod_xml_curl (generate xml on a webserver): http://wiki.freeswitch.org/wiki/Mod_xml_curl or mod_xml_odbc (generate xml in freeswitch): http://wiki.freeswitch.org/wiki/Mod_xml_odbc or LUA together with luasql (generate xml in freeswitch): http://wiki.freeswitch.org/wiki/Lua#For_serving_configuration regards, Leon On Fri, 2009-11-13 at 13:59 -0800, Jerry Richards wrote:
Is there a way to access configuration information from a database (e.g. SQL) rather than from the XML files?
Best Regards, Jerry
_______________________________________________ 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-use rs http://www.freeswitch.org
On Mon, Nov 16, 2009 at 9:36 AM, Jerry Richards <jerry.richards@teotech.com>wrote:
I have a bit of confusion about Lua scripting. When a script is invoked, should it always return an XML string that is used by FS? Or as in the case of dialplan examples, does it actually execute the dialplan (e.g. "session:answer();")?
Best Regards, Jerry
Jerry, A Lua script that is explicitly called from the dialplan will indeed execute dialplan-ish stuff. For example, let's say you had this in conf/dialplan/default.xml: <extension name="lua sample"> <condition field="destination_number" expression="9876"> <action application="lua" data="/path/to/myluascript.lua"/> </condition> </extension> Then myluascript.lua has something like: --Sample Lua script session:answer() session:sleep(1000) session:streamFile("/path/to/file.wav") session:hangup() Assuming an otherwise default install, the above Lua script would execute when a caller dialed 9876, or if a call was x-ferred to 9876. However, if you're wanting to use Lua to serve up a dialplan then it's totally different. Lua is not called from the dialplan; Lua provides the dialplan to FreeSWITCH. This latter case is the scenario discussed in the wiki section you referenced. ( http://wiki.freeswitch.org/wiki/Lua#For_serving_configuration) Are you trying to use Lua scripting for serving up a dynamic configuration of some sort? -MC
Hi, Since recently it's also possible to use lua *as* a dialplan: http://wiki.freeswitch.org/wiki/Mod_lua#For_dialplan regards, Leon On Mon, 2009-11-16 at 11:33 -0800, Michael Collins wrote:
On Mon, Nov 16, 2009 at 9:36 AM, Jerry Richards <jerry.richards@teotech.com> wrote:
I have a bit of confusion about Lua scripting. When a script is invoked, should it always return an XML string that is used by FS? Or as in the case of dialplan examples, does it actually execute the dialplan (e.g. "session:answer();")?
Best Regards, Jerry
Jerry,
A Lua script that is explicitly called from the dialplan will indeed execute dialplan-ish stuff. For example, let's say you had this in conf/dialplan/default.xml:
<extension name="lua sample"> <condition field="destination_number" expression="9876"> <action application="lua" data="/path/to/myluascript.lua"/> </condition> </extension>
Then myluascript.lua has something like:
--Sample Lua script session:answer() session:sleep(1000) session:streamFile("/path/to/file.wav") session:hangup()
Assuming an otherwise default install, the above Lua script would execute when a caller dialed 9876, or if a call was x-ferred to 9876.
However, if you're wanting to use Lua to serve up a dialplan then it's totally different. Lua is not called from the dialplan; Lua provides the dialplan to FreeSWITCH. This latter case is the scenario discussed in the wiki section you referenced. (http://wiki.freeswitch.org/wiki/Lua#For_serving_configuration)
Are you trying to use Lua scripting for serving up a dynamic configuration of some sort? -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
MC, We would like the dialplan to route the call based on Presence, which is a database lookup. I should be able to do this in Lua, true? Jerry _____ From: Michael Collins [mailto:msc@freeswitch.org] Sent: Monday, November 16, 2009 11:33 AM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Accessing Config Info From Database On Mon, Nov 16, 2009 at 9:36 AM, Jerry Richards <jerry.richards@teotech.com> wrote: I have a bit of confusion about Lua scripting. When a script is invoked, should it always return an XML string that is used by FS? Or as in the case of dialplan examples, does it actually execute the dialplan (e.g. "session:answer();")? Best Regards, Jerry Jerry, A Lua script that is explicitly called from the dialplan will indeed execute dialplan-ish stuff. For example, let's say you had this in conf/dialplan/default.xml: <extension name="lua sample"> <condition field="destination_number" expression="9876"> <action application="lua" data="/path/to/myluascript.lua"/> </condition> </extension> Then myluascript.lua has something like: --Sample Lua script session:answer() session:sleep(1000) session:streamFile("/path/to/file.wav") session:hangup() Assuming an otherwise default install, the above Lua script would execute when a caller dialed 9876, or if a call was x-ferred to 9876. However, if you're wanting to use Lua to serve up a dialplan then it's totally different. Lua is not called from the dialplan; Lua provides the dialplan to FreeSWITCH. This latter case is the scenario discussed in the wiki section you referenced. (http://wiki.freeswitch.org/wiki/Lua#For_serving_configuration) Are you trying to use Lua scripting for serving up a dynamic configuration of some sort? -MC
On Tue, Nov 17, 2009 at 8:22 AM, Jerry Richards <jerry.richards@teotech.com>wrote:
MC,
We would like the dialplan to route the call based on Presence, which is a database lookup. I should be able to do this in Lua, true?
Jerry
Yes, you can use Lua for this if you wish to do so, HOWEVER, luasql has a bug so tread carefully. Check with Chad/hunmonk for thoughts on doing db lookups from Lua. -MC
participants (5)
-
Andrew Thompson
-
Jerry Richards
-
Leon de Rooij
-
Michael Collins
-
Phillip Jones