how to capture variables from lua script in xml dialplan?
the dialpan is as follow: <extension name="Test_Extension"> <condition field="destination_number" expression="^\b(10[0-1][0-9])\b$" break="never"> <action application="set" data="continue_on_fail=true" /> <action application="lua" data="setvar.lua" /> <action application="log" data="INFO my_lua_var=${my_lua_var}" /> </condition> <condition field="${my_lua_var}" expression="1"> <action application="sleep" data="1000" /> </condition> </extension> the the xml dialplan i have a variable set inside a lua script(session:setVariable("my_lua_var", "1");), but its value is always "undefined" during the parsing stage. i need the variable to be a condition field so how can i capture it?
You would have to do inline="true" on your lua statement, but I am not sure you can even do that -- inline is only good for a few things like set, but maybe Brian or someone could let us know if you can do that with a lua script. Vincent Xia <gmangudai@gmail.com> wrote:
the dialpan is as follow: <extension name="Test_Extension"> <condition field="destination_number" expression="^\b(10[0-1][0-9])\b$" break="never"> <action application="set" data="continue_on_fail=true" /> <action application="lua" data="setvar.lua" /> <action application="log" data="INFO my_lua_var=${my_lua_var}" /> </condition> <condition field="${my_lua_var}" expression="1"> <action application="sleep" data="1000" /> </condition> </extension>
the the xml dialplan i have a variable set inside a lua script(session:setVariable("my_lua_var", "1");), but its value is always "undefined" during the parsing stage. i need the variable to be a condition field so how can i capture it?
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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
-- Your life is like a penny. You're going to lose it. The question is: How do you spend it? John Covici covici@ccs.covici.com
yeah inline is the workout, just need to have the lua application written as below: <action inline="true" application="lua" data="setvar.lua" /> but seems there comes another issue, session:streamFile() is no longer working, playback the same file in the xml dialplan is fine. 2014-05-16 19:10 GMT+08:00 <covici@ccs.covici.com>:
You would have to do inline="true" on your lua statement, but I am not sure you can even do that -- inline is only good for a few things like set, but maybe Brian or someone could let us know if you can do that with a lua script.
Vincent Xia <gmangudai@gmail.com> wrote:
the dialpan is as follow: <extension name="Test_Extension"> <condition field="destination_number" expression="^\b(10[0-1][0-9])\b$" break="never"> <action application="set" data="continue_on_fail=true" /> <action application="lua" data="setvar.lua" /> <action application="log" data="INFO my_lua_var=${my_lua_var}" /> </condition> <condition field="${my_lua_var}" expression="1"> <action application="sleep" data="1000" /> </condition> </extension>
the the xml dialplan i have a variable set inside a lua script(session:setVariable("my_lua_var", "1");), but its value is always "undefined" during the parsing stage. i need the variable to be a condition field so how can i capture it?
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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
-- Your life is like a penny. You're going to lose it. The question is: How do you spend it?
John Covici covici@ccs.covici.com
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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
Not sure this is your issue...if you use lua with inline, you can't touch the media. The media is for later to be processed. -Avi On May 17, 2014 1:07 PM, "Vincent Xia" <gmangudai@gmail.com> wrote:
yeah inline is the workout, just need to have the lua application written as below: <action inline="true" application="lua" data="setvar.lua" />
but seems there comes another issue, session:streamFile() is no longer working, playback the same file in the xml dialplan is fine.
2014-05-16 19:10 GMT+08:00 <covici@ccs.covici.com>:
You would have to do inline="true" on your lua statement, but I am not sure you can even do that -- inline is only good for a few things like set, but maybe Brian or someone could let us know if you can do that with a lua script.
Vincent Xia <gmangudai@gmail.com> wrote:
the dialpan is as follow: <extension name="Test_Extension"> <condition field="destination_number" expression="^\b(10[0-1][0-9])\b$" break="never"> <action application="set" data="continue_on_fail=true" /> <action application="lua" data="setvar.lua" /> <action application="log" data="INFO my_lua_var=${my_lua_var}" /> </condition> <condition field="${my_lua_var}" expression="1"> <action application="sleep" data="1000" /> </condition> </extension>
the the xml dialplan i have a variable set inside a lua script(session:setVariable("my_lua_var", "1");), but its value is always "undefined" during the parsing stage. i need the variable to be a condition field so how can i capture it?
_________________________________________________________________________
Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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
-- Your life is like a penny. You're going to lose it. The question is: How do you spend it?
John Covici covici@ccs.covici.com
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
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
-
covici@ccs.covici.com
-
Vincent Xia