[Freeswitch-users] Accessing Config Info From Database
Jerry Richards
jerry.richards at teotech.com
Tue Nov 17 08:22:36 PST 2009
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 at freeswitch.org]
Sent: Monday, November 16, 2009 11:33 AM
To: freeswitch-users at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20091117/acf65320/attachment-0002.html
More information about the FreeSWITCH-users
mailing list