Writing a simple voip application with C

I want to start coding a simple Voip application that will help me talk with my friend. Like skyp.

I search the web and find useful links like this

It looks good. What are you talking about?

Oh, I forgot to say that I think I’ll write this application in C. What do you think? Do you prefer any other language for this work? A good choice?

Also, if someone has ever tried something like this, please tell me your experience. How to start, if there is a good tutorial, which language to use and any other useful information.

Thank you for your time.

+4
source share
1 answer

OK, writing a simple VOIP program as a learning experience is certainly a good reason.

You must first select the appropriate audio codec and learn how to use it. I would recommend SPEEX .

Secondly, you need to decide how you are going to send encoded data over the network. A simple TCP socket can work with at least the correct parameters (I think, in particular, TCP_NODELAY here), but most VOIP applications seem to use UDP to send packets directly, trading reliability for efficiency. Therefore, you must learn how to configure and use UDP sockets.

Of course, you also need to learn to read and play audio. The details of this will depend on the language and platform you are using.

Once you have a pen for all this, it should be pretty simple. Read the audio from the microphone, encode it, send it over the network, read the incoming data from the network, decode, play. Of course, you do several of these things at the same time; this is not good if your program stops sending your vote while it is waiting for incoming data that may or may not arrive.

One way to handle this can be to split the program into two streams: one for listening and transmitting, and another for receiving and playing. Another solution would be to use non-blocking I / O and event-driven programming to process data from multiple sources as they become available. One of the possible advantages of this option is that it can simplify the implementation of conference calls, where you send and receive audio from several people.

Of course, I never tried this myself, so I really guess here.

+8
source

All Articles