[Freeswitch-users] Detecting End of Content on Socket Interface
Klaus Teller
klaus.teller at gmx.net
Wed Oct 22 06:42:54 PDT 2008
Hi,
I have a pretty silly question here, so please bear with me. When reading events through a socket (socket event interface), it is said that i should either wait for 2CR or if the content length was specified, i must continue reading until i got the exact number of bytes from the input stream.
Now, what happens when reading simple responses such as:
Request response: Content-Type: command/reply
Reply-Text: +OK
Is there a way to detect the end of such blocks?
The issue i have is following. Given that events are asynchronous (please correct me if i'm wrong), i need a thread which continuously read and process them as they arrive. But then, considering that not only events are sent by Freeswitch, i want to also detect different response commands properly.
Let me give an example. I send a command to Freeswitch to play a file. Right after that, i wait for the answer from Freeswitch. But just before the response, Freeswitch could send a DTMF event. If i use a dedicated reading thread, how does it identify the response that resulted from the play file command? Otherwise, if i try to synchronously wait for the result just after sending the play file command, how do i say that what i will get from Freeswitch is not just the part of an event?
Does this make any sense to you?
Thanks,
Klaus.
--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
More information about the FreeSWITCH-users
mailing list