Callee codec type


I have configured asterisk 11 in Ubuntu 12.04.My sip.conf is like this

context = unauthenticated  ; default context for incoming calls
allowguest = no  ; disable unauthenticated calls
srvlookup = yes  ; enabled DNS SRV record lookup on outbound calls
udpbindaddr =  ; listen for UDP requests on all interfaces
tcpenable = no  ; disable TCP support
subscribecontext = default

[office-phone](!); create a template for our devices
type = friend  ; the channel driver will match on username first, IP second
context = LocalSets  ; this is where calls from the device will enter the dialplan
host = dynamic  ; the device will register with asterisk
nat = yes  ; assume device is behind NAT
; *** NAT stands for Network Address Translation, which allows
; multiple internal devices to share an external IP address.
secret = 12345  ; a secure password for this device -- DON'T USE THIS PASSWORD!
dtmfmode = auto  ; accept touch-tones from the devices, negotiated automatically
disallow = all  ; reset which voice codecs this device will accept or offer
allow = alaw  ; which audio codecs to accept from, and request to, the device
allow = ulaw  ; in the order we prefer
allow = speex
allow = gsm

; define a device name and use the office-phone template
; define another device name using the same template

Now I have 2 SIP phone capable of allowing GSM,G.711(aLaw/uLaw),Speex.So my problem is if I generate a call to one of this SIP phone via Asterisk server,is there a way to detect the type of codec that has been used in SIP phone(callee)?

The codec could change from frame to frame; The remote system can send in any codec listed in the allow lines and Asterisk will generally send in the codec reeceived from the other party, if it is acceptable to the remote system. Only RTP debug will tell you which codec was actually used, and that is not something you would want to use on a production system.

The CLI sip show channel and sip show channels commands will tell you the codecs in common between the allow list and the phone’s list, but the phone could use a codec that Asterisk allowed, but the phone didn’t list.

SIP debugging output will show the SDP processing for codecs.

Later versions of the ${CHANNEL} function might provide similar information to the above commands.