How are codecs codified?

I have three views of the codec negotiation protocol (see below) and I can’t reconcile them. The first one, from “sip debug peer” lists numbers such as ‘96’ and ‘97’. How does that match “sip show codec 96” or “sip show codec 97”? Even stranger is codec 0, since “show codec 0” gives an error. The last entry (Cisco) includes a given codec with varying lengths(?).

Other than reading the RFCs, is there any documentation on this? Perhaps a kind soul can explain this?

On a related topic: it is clear that a bitmapped word can inform the other side about the available codecs, but what about the priority? How can you make a bit “heavier” than another?

TIA,

-Ramon F Herrera


sip debug peer:
v=0
o=- 2649501 2649501 IN IP4 71.41.206.193
s=-
c=IN IP4 71.41.206.193
t=0 0
m=audio 36388 RTP/AVP 0 2 4 8 18 96 97 98 100 101
a=rtpmap:0 PCMU/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:4 G723/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729a/8000
a=rtpmap:96 G726-40/8000
a=rtpmap:97 G726-24/8000
a=rtpmap:98 G726-16/8000
a=rtpmap:100 NSE/8000
a=fmtp:100 192-193
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:30
a=sendrecv


cowboy*CLI> show codec 96
32 (1 << 5) ADPCM
64 (1 << 6) 16 bit Signed Linear PCM


cowboy*CLI> show codec 97
1 (1 << 0) G.723.1
32 (1 << 5) ADPCM
64 (1 << 6) 16 bit Signed Linear PCM


cowboy*CLI> show codec 0
Codec 0 not found


From a Cisco:

voice class codec 1
codec preference 1 g729r8 bytes 40
codec preference 2 gsmfr bytes 132
codec preference 3 g723r63 bytes 96
codec preference 4 g726r16 bytes 80

Ok, I found a line is non-ascending order:

m=audio 5004 RTP/AVP 98 0 8 18 2 15 4 9

which led me to believe that the priority is interpreted from left to right.

My other questions (about the meaning of ‘98’, ‘9’ or ‘0’ for instance) are still open.

Thanks,

-Ramon