<div dir="ltr">Just putting the channel in a loop calling switch_read_frame() is an ample way to keep the channel idle.  <div>That really is all switch_sleep does but you can&#39;t call it from some other thread.  The session thread must call it.</div>
<div>You should never call any functions on a session from some other thread unless it is not related to media and even then should be used sparingly.<div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Oct 1, 2013 at 6:19 AM, Paul-Lists <span dir="ltr">&lt;<a href="mailto:lists@collisters.com" target="_blank">lists@collisters.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi everyone, I&#39;m developing a bespoke app for freeswitch that communicates via modem tones and DTMF with remote devices.<br>
All is going well and Freeswitch seems an ideal development platform.<br>
I am struggling with some of the bigger concepts, like threads and scheduling.<br>
 My dial plan, answers the call and calls my app where I am attaching a media bug from my main app entry point. the media bug gets the rtp packets and happily decodes them until it has received a full block of data. I have implemented my own event queue  and timer processes, and my main loop reads from its queue, does the work, executes a switch_sleep() then goes round the loop until the incoming phone call ends<br>

<br>
My problem is that when the sleep ends, there is some kind of a glitch and I lose an RTP packet, containing a few bytes of modem data.  If I make the sleep last for 60 seconds, I get stacks of modem data and it all decodes fine without a missing bit, just the act of waking, then going back to sleep causes the problem.<br>

Is there a better way to suspend my app for a second or less while I&#39;m decoding data in the background, I don&#39;t want to hog the processor.<br>
Any pointers would be much appreciated.<br>
<br>
Best regards,<br>
<br>
Paul Collister<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-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:+19193869900
</div>