<div dir="ltr">For anyone wondering, Adhearsion (<a href="http://adhearsion.com">http://adhearsion.com</a>) can do this kind of thing quite easily. I know you said ES is not an option for you, but you might consider it in future.</div>
<div class="gmail_extra"><br clear="all"><div>Regards,<br>Ben Langfeld</div>
<br><br><div class="gmail_quote">On 26 January 2013 03:46, Brian Wiese <span dir="ltr"><<a href="mailto:brian.wiese.freeswitch@gmail.com" target="_blank">brian.wiese.freeswitch@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
JP:<br>
<br>
Give this a try:<br>
<br>
===== Dialplan Extension =====<br>
<extension name="Wait for Lua"><br>
<condition field="destination_number" expression="^29000$"><br>
<action application="pre_answer"/><br>
<action application="eval" data="${luarun(wait.lua ${uuid})}"/><br>
<action application="playback"<br>
data="ivr/ivr-on_hold_indefinitely.wav"/> <!-- Obviously replace with<br>
a sound file containing music or something... --><br>
<!-- If the Lua script fails or times out (the above sound file<br>
played completely), do something so the user doesn't sit around<br>
forever... --><br>
<action application="sleep" data="2000"/><br>
<action application="playback" data="misc/error.wav"/><br>
<action application="sleep" data="2000"/><br>
<action application="playback" data="voicemail/vm-goodbye.wav"/><br>
<action application="hangup"/><br>
</condition><br>
</extension><br>
==========<br>
<br>
===== Lua Script (wait.lua) =====<br>
api = freeswitch.API();<br>
<br>
uuid = argv[1]; --The UUID of the call.<br>
<br>
if uuid == nil then<br>
freeswitch.consoleLog("crit","Fatal Error: A UUID was not passed to<br>
the script!\n");<br>
else<br>
freeswitch.consoleLog("info","Working...\n");<br>
<br>
--Do the task here that may take some time...<br>
<br>
session = freeswitch.Session(uuid);<br>
freeswitch.consoleLog("info","Transferring call!\n");<br>
session:transfer("lua_done"); --Obviously set this to a dialplan extension...<br>
end<br>
==========<br>
<br>
<br>
Using this method you can even make the dialplan as one extension (use<br>
extension "29000step2" for session:transfer in the Lua script):<br>
<br>
==== Dialplan Single Extension Example =====<br>
<extension name="Wait for Lua"><br>
<condition field="destination_number" expression="^29000(?:step2)?$"/><br>
<condition field="destination_number" expression="^29000$" break="on-true"><br>
<action application="pre_answer"/><br>
<action application="eval" data="${luarun(wait.lua ${uuid})}"/><br>
<action application="playback"<br>
data="ivr/ivr-on_hold_indefinitely.wav"/> <!-- Obviously replace with<br>
a sound file containing music or something... --><br>
<!-- If the Lua script fails or times out (the above sound file<br>
played completely), do something so the user doesn't sit around<br>
forever... --><br>
<action application="sleep" data="2000"/><br>
<action application="playback" data="misc/error.wav"/><br>
<action application="sleep" data="2000"/><br>
<action application="playback" data="voicemail/vm-goodbye.wav"/><br>
<action application="sleep" data="500"/><br>
<action application="hangup"/><br>
</condition><br>
<condition field="destination_number" expression="^29000step2$"><br>
<action application="answer"/><br>
<action application="sleep" data="500"/><br>
<action application="playback" data="ivr/ivr-yes_we_have_no_bananas.wav"/><br>
<action application="sleep" data="500"/><br>
<action application="hangup"/><br>
</condition><br>
</extension><br>
==========<br>
<span class="HOEnZb"><font color="#888888"><br>
~Brian<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Thu, Jan 24, 2013 at 7:34 PM, JP <<a href="mailto:jaykris@gmail.com">jaykris@gmail.com</a>> wrote:<br>
> I want to do the following...<br>
><br>
> 1. Play a long music file from a dialplan.<br>
> 2. While the music is playing, I want to launch a Lua script to do some data<br>
> dip.<br>
> 3. Once the data is fetched and Lua exits, I want to interrupt the music and<br>
> continue in the dialplan<br>
><br>
> How do I do this. Any sample code or pointers would be greatly appreciated.<br>
><br>
> Thanks<br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _________________________________________________________________________<br>
> Professional FreeSWITCH Consulting Services:<br>
> <a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
> <a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
><br>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
> <a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
><br>
> Official FreeSWITCH Sites<br>
> <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
> <a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
> <a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
><br>
> FreeSWITCH-users mailing list<br>
> <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
> <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
><br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br></div>