[Freeswitch-dev] sleep()

Paul-Lists lists at collisters.com
Tue Oct 1 15:19:28 MSD 2013


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


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