[Freeswitch-users] non-blocking bridge in Lua
Mi Ke
mi.ke at null.net
Fri Jul 15 21:42:34 MSD 2011
Many thanks, Avi ! The following code worked for me:
local ob_session = freeswitch.Session("{return_ring_ready=true,execute_on_answer=lua ob_answer.lua}" .. called_id,session)
if (ob_session:ready()) then
freeswitch.bridge(session,ob_session)
else
--- process failure here
end
All channel data related to the bridge and both legs are available from ob_answer.lua via session:getVariable()
All the best / Mike
----- Original Message -----
From: Avi Marcus
Sent: 07/15/11 01:48 AM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] non-blocking bridge in Lua
Some options: You can set an execute_on_answer on the leg B to run your new lua script
http://wiki.freeswitch.org/wiki/Variable_execute_on_answer
Or, you can schedule all this stuff in the originate string, with either execute_on_answer or export nolocal:api_on_answer=sched_transfer or the like.
-Avi Marcus
On Fri, Jul 15, 2011 at 1:31 AM, Mi Ke <http://mi.ke @http://null.net > wrote:
Hi all !
I want to make a Lua app which will start with Leg A, collect input, initiate outbound Leg B and when it answers, periodically play decreasing series of beeps to Leg A depending on how many minutes left to disconnect (remaining time queried via odbc).
My initial idea was to issue a non-blocking bridge command after Leg B session originate returns ring-ready and then to do the rest in while loop, but the bridge called by api:executeString("bgapi bridge legB_session legA_session") just returns Job UUID without actually bridging sessions. A usual freeswitch.bridge call blocks further script execution until unbridged, disallowing me to check Leg B states when it's active.
Is there any elegant way to acheive my goals using Lua/Dialplan apps ? To create an app starting with Leg A and constantly watching for Leg B existense/states, playing corresponding feedback messages to Leg A ?
Thanks in advance for yours hints/responses
Mike
_______________________________________________
Join us at ClueCon 2011, Aug 9-11, Chicago
http://www.cluecon.com 877-7-4ACLUE
FreeSWITCH-users mailing list
FreeSWITCH-users at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110715/015c6aa5/attachment.html
More information about the FreeSWITCH-users
mailing list