[asterisk-users] CODECS: Best practice question: Avoid transcode when calling out?
Philipp von Klitzing
klitzing at pool.informatik.rwth-aachen.de
Tue Feb 16 12:31:08 CST 2010
Hi Karl,
that's funny you are asking this, am also currently looking at how to
solve the g722 codec negotiation riddle, in my particular case to play
nicely together with a KonfTel 300 IP conference phone.
> In other words, incoming calls are easy since codecs are negotiated
> from least-known (the remote party) to most-known (my endpoint) and my
> codecs can simply be preferred accordingly to match the remote.
Look at setting the channel variable_SIP_CODEC - however it might or
might not work depending on your version of Asterisk, see for example:
https://issues.asterisk.org/view.php?id=13243
Here's a dialplan snippet that might give you another hint or two.
exten => 123,1,NoOp(-- Inbound read: ${CHANNEL(audioreadformat)} --)
exten => 123,n,NoOp(-- Inbound native: ${CHANNEL(audionativeformat)} --)
exten => 123,n,Set(WIDEBAND=0)
exten => 123,n,Set(WIDEBAND=${REGEX("g722"
${SIPPEER(${SIPCHANINFO(peername)}:codecs)})})
exten => 123,n,ExecIf($[${WIDEBAND} = 1]|Set|_SIP_CODEC=g722)
exten => 123,n,Dial(SIP/abc123)
Please note the SPACE between ${REGEX("g722" and ${SIPPEER
> Outbound calls seem harder. Our endpoints always negotiate g.722 between
> themselves and Asterisk and then Asterisk must transcode to the preferred
> codec of the REMOTE party. Not ideal.
Together with the g722 transcoding patch for Asterisk 1.4.17 it does not
work out, unfortunately. Currently I cannot make a statement on a more
recent 1.4 release.
g722 patch: http://users.netplex.net/~andrew/asterisk/#g722
Older patch that I use for 1.4.17:
http://users.netplex.net/~andrew/asterisk/g722-20080110.patch.gz
However I can successfully employ setting _SIP_CODEC if in the example
above instead of "Dial()" I do a "MusicOnHold()" - both with or without a
preceeding ANSWER; without means early audio playing of the native g722
encoded MOH file. My snom starts out with alaw, and then we switch to
g722.
> Is there an elegant way to do this?
Consider the codec negotiation patch? I'd be interested to hear about
your results!
http://www.b2bua.org/wiki/AsteriskCodecNegotiationPatch
https://issues.asterisk.org/view.php?id=4825
Philipp
More information about the asterisk-users
mailing list