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:m...@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.richa...@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

Reply via email to