I'm new to creating a voip apps for mobile devices. I currently have an asterisk server set up and also an iphone voip app and an android voip app. For both the iphone and android, I'm using linphone core library as my sip library.
Right now, I am able to successfully make calls. Sometimes I have call quality issues like "crackling" in the audio, or parts of people's sentences are dropped. As such, I'm trying to improve performance.
This is my first time investigating codecs, so I'm trying to determine which codecs are actually in use. So my question is:
When are codecs actually employed? Do the phones use codecs to compress the audio to be uploaded and decompress the incoming audio? Or does something happen on the asterisk server? Or both?
I haven't been able to figure out the answer to this question. When I run the linphone command getAudioCodecs(), it gives me a list of available codecs, but not actually the one thats employed on a particular call. For example, here's a var_dump of the function getAudioCodecs() in the middle of a call:
08-13 08:39:49.787: I/System.out(16358): codec:SILK 16000
08-13 08:39:49.787: I/System.out(16358): codec:speex 16000
08-13 08:39:49.787: I/System.out(16358): codec:speex 8000
08-13 08:39:49.787: I/System.out(16358): codec:PCMU 8000
08-13 08:39:49.787: I/System.out(16358): codec:PCMA 8000
08-13 08:39:49.797: I/System.out(16358): codec:SILK 24000
08-13 08:39:49.797: I/System.out(16358): codec:SILK 12000
08-13 08:39:49.797: I/System.out(16358): codec:SILK 8000
08-13 08:39:49.797: I/System.out(16358): codec:speex 32000
08-13 08:39:49.797: I/System.out(16358): codec:AMR 8000
08-13 08:39:49.797: I/System.out(16358): codec:iLBC 8000
08-13 08:39:49.797: I/System.out(16358): codec:L16 44100
08-13 08:39:49.797: I/System.out(16358): codec:L16 44100
08-13 08:39:49.807: I/System.out(16358): codec:G722 8000
08-13 08:39:49.817: I/System.out(16358): codec:GSM 8000
That's a lot of codecs...so how do we know which one is being used?
As for my asterisk server, my sip.conf has the following lines for each user:
allow=ulaw
allow=gsm
So does that mean I'm using GSM? Because GSM is the only codec that appears in both my var_dump of getAudioCodecs and my sip.conf?
Here's the documentation for the linphone sip library if it helps: http://www.linphone.org/docs/liblinphone-javadoc/
Additional Info
OK, I found a few more interesting things. I wrote this code into my android app:
//mLC is the currently active LinphoneCore object when receiving a call
LinphoneCallParams lcp = mLc.getCurrentCall().getCurrentParamsCopy();
PayloadType pt = lcp.getUsedAudioCodec();
String mime = pt.getMime(); // the mime value is PCMU
I noticed that the variable mime currently holds the value "PCMU". I did a google search and i see it is associated with G.711.
So can I assume that on the android app, it is the G.711 Codec? If so, then how come even though I don't mention G711 in my sip.conf, it still allows it?