Summary:ASTERISK-02332: [patch] Make the codecs we answer with configurable
Reporter:pfn (pfn)Labels:
Date Opened:2004-09-02 18:54:50Date Closed:2004-09-25 02:07:29
Versions:Frequency of
Environment:Attachments:( 0) rtpcodecs[1].txt
Description:Regardless of the codecs we are offered, we answer with all the codecs we are capable supporting (those that have allow=).  This is perfectly acceptable according to the RFCs (they have no bias as to whether this is correct or not).  Some SIP servers, however don't always behave well if you answer back with a codec you don't support.

E.g. broadvoice will offer only ulaw, but if you answer with g729 & ulaw, broadvoice will send to you via g729.  While there's nothing wrong with that itself, they don't support rfc2833, etc.  Additionally, broadvoice inbound calls often fall into the general SIP context, otherwise I'd do the allow/disallow game.  So, I'd like to only allow what broadvoice offers.


The attached diff adds a new config option to rtp.conf, rtpanswercodecs with valid values all or offered.  All will respond with all codecs in our cadre while offered will answer with only the codecs offered to us.  The default value is set to all, as this is the current behavior on Asterisk.
Comments:By: Mark Spencer (markster) 2004-09-02 23:20:49

You can already do this with the SIP_CODEC variable

By: pfn (pfn) 2004-09-03 04:10:05

Can you be a little more specific?  Looking at chan_sip.c, I see it reads SIP_CODEC for specific codecs to be used, how is this useful?  At what point do you set SIP_CODEC?  As a global in the dialplan?  How does this apply on incoming calls?

This is completely different from what my patch does...

Here is an example scenario:

I have allow=ulaw, gsm, ilbc, speex

I receive an offer with the codecs ulaw, gsm, alaw

Currently, asterisk responds with:  ulaw, gsm, ilbc, speex.

I want Asterisk to respond with:  ulaw, gsm.

If I were offered: gsm, ilbc, g729

I want to respond: gsm, ilbc

I know the current behavior isn't against RFC, but I would like to be able to support both sides of the coin.  SIP_CODEC does not appear to satisfy this need.

I want to be able to set this on a generic basis, instead of forcing a specific set of codecs via SIP_CODEC.

By: Mark Spencer (markster) 2004-09-03 20:41:44

You may on a per-friend / per-user / per-peer basis explicitly allow/disallow codecs and you may set the SIP_CODEC variable to what specific codec you want to answer with in the dialplan if the former is not sufficient.

If you still don't think you don't have enough flexibility or understanding, please try to ask questions on IRC even if you're asking them of me.  Remember that the bug tracker is for bugs/features exclusively and not for technical support.