Trying to work out definitively how to order codecs properly


Hi there

I am struggling with Asterisk’s method of negotiating appropriate codecs. Every time I think I have it figured, something happens that makes me realise I haven’t.

Can someone please tell me the priority of codec selection.

E.G. I have a SIP ISDN gateway (Tenor BX) which is set to use G.729 as first priority and G.711a as second priority.

All phones are set the same.

I have an ATA with a fax machine attached that has only the G.711 coded in its preference list (for obvious reasons).

In sip.conf, I have allow in order of g729 ilbc g711a.

In my ata context I have allow g711 and disallow all

From this am I safe to assume that all calls TO AND FROM the ATA will be G711?

When I bring up conversations between endpoints sip show channels seems to be something other than what I expect. One device is using G.729 and the other is using G.711 on the same conversation.

If anyone can shed light on this, or point me to a good document on setting codecs I would be grateful. I really want different codecs to be used in different situations based on endpoint locations/capabilities, etc.



Can someone please tell me exactly what


for sip the codec values are only respected in the order they are presented in the [general] area of sip.conf. I am not sure on how it decides which one to use in the user/peer/friend context’s. i only know that you need to diallow them before you allow the ones you want.


You need to have account for evryone trying to call you in your sip.conf. If you expect them to send you FAX, then you have to define them to use only g.711. That is the olny solution that I can think of. It isn’t quite usefull… :frowning:(