How to force INVITE based on CALLER offered voice codec?

I have gateway running on Asterisk 11.15.1 and it has carrier peer setup with

When a caller hit the gateway with only G729 voice codec, I would like to send INVITE to the carrier only on G729.

Can anyone help me out on this please?

At the moment, my gateway offering all the above codec and carrier then prefer alaw. This makes my gateway to do trans-coding.

Kind regards,

You can use the following option

preferred_codec_only=yes ; Respond to a SIP invite with the single most preferred codec rather than advertising all joint codec capabilities. This limits the other side’s codec choice to exactly what we prefer.

1 Like

The OP wants to control the B side request, not the A side response

I believe there is a channel variable you can set, for chan_sip, that will limit the offer to the codecs specified there. See for details.

Thank you. I will try your straight forward option and update you the feedback.

Kind a useful for wider development. Thank you. I will try to understand this one.

Kind regards,