Hello!<div><br></div><div>I'm a huge FreeSWITCH fan and am always amazed at how much I can do with it. I have a Lua script that has been working great, but now have been tasked with enhancing it, and have run into a problem.</div>
<div><br></div><div>I want to be able to play media, detect DTMF and hang up a call after bridging two sessions, but my Lua script blocks on freeswitch.bridge(), and doesn't resume until one side or the other hangs up.</div>
<div><br></div><div>Here is my problem reduced to a Lua script in its simplest form:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><font class="Apple-style-span" face="'courier new', monospace">-- first session</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">session1 = session</font></div><div><font class="Apple-style-span" face="'courier new', monospace">-- call out</font></div><div><font class="Apple-style-span" face="'courier new', monospace">session2 = freeswitch.Session("{ignore_early_media=true}sofia/gateway/<a href="http://etc.com/">etc.com/</a>" .. phoneNumber)</font></div>
<div><font class="Apple-style-span" face="'courier new', monospace">-- bridge the calls</font></div><div><div><font class="Apple-style-span" face="'courier new', monospace">freeswitch.bridge(session1, session2)</font></div>
</div><div><div><font class="Apple-style-span" face="'courier new', monospace">-- this next line doesn't execute until after either session 1 or 2 hangs up</font></div></div><div><div><font class="Apple-style-span" face="'courier new', monospace">freeswitch.consoleLog("info", "This is a test.\n")</font></div>
</div></blockquote><div><br></div><div>How can I do an asynchronous bridge, and still be able to play media and detect dtmf afterwards?</div><div><br></div><div>Mike van Lammeren</div><div><br></div>