Core Issue
A Cisco IOS Gateway running Session Initiation Protocol (SIP) is set up with default codec complexity and this codec preference:
voice class codec 2
codec preference 1 g729r8
codec preference 2 g729br8
codec preference 3 g711alaw
codec preference 4 g711ulaw
codec preference 6 g726r16
codec preference 7 g726r24
codec preference 8 g726r32
codec preference 9 g723ar63
codec preference 10 g723ar53
codec preference 11 gsmfr
Preference 1 is g729r8. However, this does not appear in the INVITE SDP. Instead, the first codec listed in the INVITE SDP is codec preference 2 (g729br8).
This is not working because the SIP stack assumes that without annexb=no in the SDP - the codec is G729br8 - the defect that introduced this behavior is CSCeh19375 (support for RFC3555 on SIP GWs ).The compliance of RFC3555 has been added by DDTS CSCeh19375 in IOS 12.3(15) and later releases.
The changes in the IOS (due to CSCeh19375) introduced support for RFC3555 on SIP GWs where the handling of G729 codecs is different. If the invite comes in with no annexB parameter - the GW assumes default is yes and looks for G729br8 in voice class codec.
RFC snip:
4.1.9. Registration of MIME media type audio/G729
MIME media type name: audio
MIME subtype name: G729
Required parameters: None
Optional parameters: ptime, maxptime
annexb: indicates that Annex B, voice activity detection, is used or preferred. Permissible values are "yes" and "no" (without the quotes); "yes" is implied if this parameter is omitted.
IOS SIP gateway treats G729 codec flavors, g729r8 & g729br8, as interoperable. According to RFC 3555 and IOS DSP team, this is not true. So this fix changes IOS behavior with respect to this codec and makes it compliant to RFC 3555 specification. In other words, IOS gateway will treat G729 codec mime type as documented in the rfc, if there is no annexb attribute present in the sdp, default value assumed will be "yes". If there is an annexb attribute present, there should be no change in behavior. For outgoing sdp, there is no change in behavior. This means that SIP user agents that are not compliant to RFC 3555 and do not add annexb attribute in sdp, may have interoperability issues with IOS gateway and call will fail.
Resolution
If both g729r8 and g729br8 are configured in the codec preference list, then the only way to advertise the full capability in the invite is to use the annexb= yes parameter in fmtp line. Since both codecs use 18 as payload value, there is no other way to differentiate if both codecs are on the preference list. If the end equipment wishes to use only g279r8, reply with either annexb=no or no fmtp line for payload 18. If the end equipment is a Cisco gateway and has the same codec list configuration, do the best match with this invite (g729br8). If you want to use only g729r8 on the Cisco Trunking Gateway (TGW), either configure g729r8 at the TGW dial peer level, or use only g729r8 in the codec preference list. This is a limitation when codecs lists are used with codecs that have different variants and same payload types.
For related information, refer to these documents: