The problem you&#39;re running into is that you are trying to do two different things inside of the thread that is controlling the call flow. Playing sound files and running Lua scripts are synchronous in this context. This seems more suited for an outbound event socket application. Using the event socket you can control the call while doing other things. <br>
<br>Just curious - does anyone have an ESL example of this kind of thing? The wiki could definitely use this kind of example as it is quite useful. I&#39;ll look around and see if I can find anything.<br><br>-MC<br><br><div class="gmail_quote">
On Fri, Jan 25, 2013 at 3:00 PM, JP <span dir="ltr">&lt;<a href="mailto:jaykris@gmail.com" target="_blank">jaykris@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">
<div>Avi,</div>Thanks for the response. Unfortunately that did not work. This is what I did<div><br></div><div><div><br></div><div>    &lt;extension name=&quot;MyExtension&quot;&gt;</div><div>      &lt;condition field=&quot;destination_number&quot; expression=&quot;9005&quot;&gt;</div>

<div>            &lt;action application=&quot;answer&quot;/&gt;</div><div>            &lt;action application=&quot;play_and_get_digits&quot; data=&quot;4 16 3 7000 # phrase:MyPrompt phrase:My_invalid_entry case_number \d+&quot; /&gt;</div>

<div>            &lt;action application=&quot;playback&quot; data=&quot;phrase:wait_msg&quot; /&gt;</div><div>            &lt;action application=&quot;sched_broadcast&quot; data=&quot;+0 playback::/tmp/WPJ_MUSIC_QUEUE_4.wav&quot;/&gt; </div>

<div>            &lt;action application=&quot;lua&quot; data=&quot;get_customer_info.lua ${case_number}&quot; /&gt;</div><div>       &lt;/condition&gt;</div><div>    &lt;/extension&gt;</div><div><br></div><div>The music only plays after the Lua script exits. I played around with the timer value, but that did not help either. Any other ideas?</div>

<div><br></div><div>Thanks<br>JP</div><div><br></div><br><div class="gmail_quote">On Fri, Jan 25, 2013 at 1:22 AM, Avi Marcus <span dir="ltr">&lt;<a href="mailto:avi@avimarcus.net" target="_blank">avi@avimarcus.net</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">ESL gives you more control, especially to execute things in parallel.<div>If you want to do it within FS, that&#39;s a little more complicated, since most things are sequential.</div>

<div><div><br></div><div>

However, if you use the async APIs, then I think it could work:</div><div>1) <a href="http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_sched_broadcast" target="_blank">sched_broadcast</a> -- schedule the playback of your file on the UUID of the channel, for +0, meaning now.</div>



<div>2) run your lua script</div><div>3) Then stop (break) the playback on that uuid: <a href="http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_break" target="_blank">break</a></div><div>4) Continue with your execution.</div>

<div><br>

</div><div>Please wikify your results and let us know how that works out!<br clear="all"><div><div dir="ltr"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small">-Avi</span></div></div><br><div class="gmail_quote">

<div><div>

On Fri, Jan 25, 2013 at 3:34 AM, JP <span dir="ltr">&lt;<a href="mailto:jaykris@gmail.com" target="_blank">jaykris@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div>

I want to do the following...<div><br></div><div>1. Play a long music file from a dialplan.</div><div>2. While the music is playing, I want to launch a Lua script to do some data dip.</div><div>3. Once the data is fetched and Lua exits, I want to interrupt the music and continue in the dialplan</div>




<div><br></div><div>How do I do this. Any sample code or pointers would be greatly appreciated.</div><div><br></div><div>Thanks</div>
<br></div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">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" target="_blank">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></blockquote></div><br></div></div></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">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" target="_blank">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></blockquote></div><br></div>
<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>
<br></blockquote></div><br><br clear="all"><br>-- <br>Michael S Collins<br>Twitter: @mercutioviz<br><a href="http://www.FreeSWITCH.org" target="_blank">http://www.FreeSWITCH.org</a><br><a href="http://www.ClueCon.com" target="_blank">http://www.ClueCon.com</a><br>
<a href="http://www.OSTAG.org" target="_blank">http://www.OSTAG.org</a><br><br>