Controlling codec listed in INVITE SDP (2)



I am trying to specify in an AGI script the codecs to be used in a SIP INVITE.

I found a workaround to do this:

In the Dial Plan:
exten => 1,1,Set(_PREFERRED_CODEC=ulaw)
exten => 1,2,Dial(SIP/foo/123)

Then I modified the source in chan_sip.c so that if it finds _PREFERRED_CODEC defined, it skips the normal addition of supported codec to add only the one specified by _PREFERRED_CODEC. It works, at least for me.

There are some important drawbacks to this:

  1. It works for SIP, but not for IAX, so I should go on and modify chan_iax2.c as well.
  2. I want to continue upgrade my Asterisk when new versions arrive, and maintaining patches is really hard.

Also, I found those three related topics on Mantis:

0003232 closed kpfleming SIP [request] ability to set non-optimized codec priority
0003553 closed kpfleming IAX [patch] IAX codec passthrough configuration
0003346: [patch] PREFERRED_CODEC - codec preference override

Does anyone know what is the status of those improvements ? Have they been integratd into CVS ?
How can I do this is a more standard and supported way ?