Is that possible?

My scenario is made of site A and site B both of them with about 8 telephone sets and just one Asterisk at site A controlling the call for these 16 phones. In between the two sites, I have a slow link (about 256 kbps for data and voice). My goal is to have the telephone sets in site A and in site B using G711 codec when the cal is amongst telephone sets in the same site but use GSM codec for call in between site A and B.

Is that possible?


I assume you are using sip phones and I think it’s not possible do this, because the codec configuration, asterisk side and phone side, can’t be based on location but it’s “fixed” and I don’t know a way to manipulate the codec negotiation from the dialplan, if someone has an idea please post here.
In your case should be simpler to use just the gsm codec, you can’t do this ?


Marco Bruni


I think you need to make sure canreinvite is yes then experiment with ordering the codec order in the sip,conf

I think you may be able acheive what you want by doing this.

It will just take some experimentation. and seeing what the CLI and sip debug says till you get it right


So let me expand a little bit more on the problem:

In Asterisk you can create contexts (a call domain) where you define the extensions in this context. You can then specify what codecs are allowed in a context. Usually what we do is to disallow all codecs and then allow the codec you want to use. I.e.:

[test] ; where test is a context
allow=alaw,gsm ; this would force alaw to be the first choice and gsm the second choice

This would make Asterisk to invite the destination of a SIP call of “testâ€


Can you tell me where I can find a forum that I could get some help in this posted problem? I got no help so it is more like that either, I am asking a too stupid question or people does not know how to answer…

I like reading, so if you know any source I could get the answer by reading, please let me know.


If the phone supports it, you could setup 2 lines on each of the phones, thus 2 contexts for each phone in sip.conf. One context gets alaw and gsm and the second context just gsm. Then modify the extensions.conf to remap calls made between A and B locations to rewrite all calls such that they only ring the 2nd line on the destination, thus making use of the 2nd context in sip.conf.