Codec "read" variable?

Hello guys, me again, David55 if you are around you probably know this. Is there a variable that I can read to tell what the codec of a call leg is?

I’ve tried to use the ${SIP_CODEC_INBOUND}, but it seems this variable is for “set” only? Because when I tried to do NoOP(${SIP_CODEC_INBOUND}), it shows blank.

Thank you!

By the way, I have to be able to read a variable in the script (extensions.conf), I know you can see by using commandline “sip show channels”, but that is useless to me. In my script I need to be able to know what is the inbound leg codec and then decide what outbound codec to use.

thank you!

See the CHANNEL function.

Important NOTE: Although that function will, I think, give the instantaneous value, for SIP, the actual value can change to any of those in Asterisk’s initial offer, during the call, even when the dialplan is not running.

THANKS DAVID!!