[Freeswitch-dev] sleep()

Anthony Minessale anthony.minessale at gmail.com
Tue Oct 1 19:19:37 MSD 2013


Just putting the channel in a loop calling switch_read_frame() is an ample
way to keep the channel idle.
That really is all switch_sleep does but you can't call it from some other
thread.  The session thread must call it.
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.



On Tue, Oct 1, 2013 at 6:19 AM, Paul-Lists <lists at collisters.com> wrote:

> Hi everyone, I'm developing a bespoke app for freeswitch that communicates
> via modem tones and DTMF with remote devices.
> All is going well and Freeswitch seems an ideal development platform.
> I am struggling with some of the bigger concepts, like threads and
> scheduling.
>  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
>
> 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.
> Is there a better way to suspend my app for a second or less while I'm
> decoding data in the background, I don't want to hog the processor.
> Any pointers would be much appreciated.
>
> Best regards,
>
> Paul Collister
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org
googletalk:conf+888 at conference.freeswitch.org
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20131001/a284de32/attachment-0001.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-dev mailing list