<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">&lt;<a href="mailto:brian.wiese.freeswitch@gmail.com" target="_blank">brian.wiese.freeswitch@gmail.com</a>&gt;</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>
&lt;extension name=&quot;Wait for Lua&quot;&gt;<br>
  &lt;condition field=&quot;destination_number&quot; expression=&quot;^29000$&quot;&gt;<br>
    &lt;action application=&quot;pre_answer&quot;/&gt;<br>
    &lt;action application=&quot;eval&quot; data=&quot;${luarun(wait.lua ${uuid})}&quot;/&gt;<br>
    &lt;action application=&quot;playback&quot;<br>
data=&quot;ivr/ivr-on_hold_indefinitely.wav&quot;/&gt;  &lt;!-- Obviously replace with<br>
a sound file containing music or something... --&gt;<br>
    &lt;!-- If the Lua script fails or times out (the above sound file<br>
played completely), do something so the user doesn&#39;t sit around<br>
forever... --&gt;<br>
    &lt;action application=&quot;sleep&quot; data=&quot;2000&quot;/&gt;<br>
    &lt;action application=&quot;playback&quot; data=&quot;misc/error.wav&quot;/&gt;<br>
    &lt;action application=&quot;sleep&quot; data=&quot;2000&quot;/&gt;<br>
    &lt;action application=&quot;playback&quot; data=&quot;voicemail/vm-goodbye.wav&quot;/&gt;<br>
    &lt;action application=&quot;hangup&quot;/&gt;<br>
  &lt;/condition&gt;<br>
&lt;/extension&gt;<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(&quot;crit&quot;,&quot;Fatal Error:  A UUID was not passed to<br>
the script!\n&quot;);<br>
else<br>
  freeswitch.consoleLog(&quot;info&quot;,&quot;Working...\n&quot;);<br>
<br>
  --Do the task here that may take some time...<br>
<br>
  session = freeswitch.Session(uuid);<br>
  freeswitch.consoleLog(&quot;info&quot;,&quot;Transferring call!\n&quot;);<br>
  session:transfer(&quot;lua_done&quot;);  --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 &quot;29000step2&quot; for session:transfer in the Lua script):<br>
<br>
====  Dialplan Single Extension Example =====<br>
&lt;extension name=&quot;Wait for Lua&quot;&gt;<br>
  &lt;condition field=&quot;destination_number&quot; expression=&quot;^29000(?:step2)?$&quot;/&gt;<br>
  &lt;condition field=&quot;destination_number&quot; expression=&quot;^29000$&quot; break=&quot;on-true&quot;&gt;<br>
    &lt;action application=&quot;pre_answer&quot;/&gt;<br>
    &lt;action application=&quot;eval&quot; data=&quot;${luarun(wait.lua ${uuid})}&quot;/&gt;<br>
    &lt;action application=&quot;playback&quot;<br>
data=&quot;ivr/ivr-on_hold_indefinitely.wav&quot;/&gt;  &lt;!-- Obviously replace with<br>
a sound file containing music or something... --&gt;<br>
    &lt;!-- If the Lua script fails or times out (the above sound file<br>
played completely), do something so the user doesn&#39;t sit around<br>
forever... --&gt;<br>
    &lt;action application=&quot;sleep&quot; data=&quot;2000&quot;/&gt;<br>
    &lt;action application=&quot;playback&quot; data=&quot;misc/error.wav&quot;/&gt;<br>
    &lt;action application=&quot;sleep&quot; data=&quot;2000&quot;/&gt;<br>
    &lt;action application=&quot;playback&quot; data=&quot;voicemail/vm-goodbye.wav&quot;/&gt;<br>
    &lt;action application=&quot;sleep&quot; data=&quot;500&quot;/&gt;<br>
    &lt;action application=&quot;hangup&quot;/&gt;<br>
  &lt;/condition&gt;<br>
  &lt;condition field=&quot;destination_number&quot; expression=&quot;^29000step2$&quot;&gt;<br>
    &lt;action application=&quot;answer&quot;/&gt;<br>
    &lt;action application=&quot;sleep&quot; data=&quot;500&quot;/&gt;<br>
    &lt;action application=&quot;playback&quot; data=&quot;ivr/ivr-yes_we_have_no_bananas.wav&quot;/&gt;<br>
    &lt;action application=&quot;sleep&quot; data=&quot;500&quot;/&gt;<br>
    &lt;action application=&quot;hangup&quot;/&gt;<br>
  &lt;/condition&gt;<br>
&lt;/extension&gt;<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 &lt;<a href="mailto:jaykris@gmail.com">jaykris@gmail.com</a>&gt; wrote:<br>
&gt; I want to do the following...<br>
&gt;<br>
&gt; 1. Play a long music file from a dialplan.<br>
&gt; 2. While the music is playing, I want to launch a Lua script to do some data<br>
&gt; dip.<br>
&gt; 3. Once the data is fetched and Lua exits, I want to interrupt the music and<br>
&gt; continue in the dialplan<br>
&gt;<br>
&gt; How do I do this. Any sample code or pointers would be greatly appreciated.<br>
&gt;<br>
&gt; Thanks<br>
&gt;<br>
</div></div><div class="HOEnZb"><div class="h5">&gt; _________________________________________________________________________<br>
&gt; Professional FreeSWITCH Consulting Services:<br>
&gt; <a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
&gt; <a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
&gt;<br>
&gt; FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
&gt; <a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
&gt;<br>
&gt; Official FreeSWITCH Sites<br>
&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
&gt; <a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
&gt; <a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
&gt;<br>
&gt; FreeSWITCH-users mailing list<br>
&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
&gt;<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>