Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing a simple voip application with C [closed]

Tags:

c

voip

sip

I want to start coding a simple Voip application that will help me to talk with a friend of mine. Like Skyp.

I search to the internet and found some useful links like this

It looks good. What you say ?

Ohh i forget to say that i m thinking write this app in C. Whats your opinion ? Do you prefer any other language for this work ? Is a good choice?

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

Thanks for your time.

like image 885
user547363 Avatar asked Oct 14 '11 16:10

user547363


1 Answers

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

First, you should pick a suitable audio codec and learn to use it. I'd recommend SPEEX.

Second, you need to decide how you're going to be sending the encoded data over the network. A simple TCP socket could work, at least with the right options (I'm thinking particularly of TCP_NODELAY here), but most VOIP applications seem to use UDP to transmit the packets directly, trading reliability for efficiency. So you should learn how to set up and use UDP sockets.

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

Once you've got a handle on all that, it should be pretty straightforward. Read audio from the microphone, encode it, send it out over the network, read incoming data from network, decode, play. Of course, you have do several of these things at the same time — it's no good if your program stops sending out your voice while it's waiting for incoming data that may or may not arrive.

One way to handle this could be to split the program into two threads: one for listening and transmission and another for receiving and playback. Another solution would be to use non-blocking I/O and event-driven programming to handle data from multiple sources as it arrives. One possible advantage of this option is that it might make it easier to implement conference calls, where you send and receive audio from multiple people.

Of course, I've never tried this myself, so I'm really just guessing here.

like image 59
Ilmari Karonen Avatar answered Oct 24 '22 09:10

Ilmari Karonen