[asterisk-dev] SIP and using less-prior codec

Klaus Darilion klaus.mailinglists at pernau.at
Wed Apr 1 12:51:52 CDT 2009


Ok. Answering Anthony and myself.

Anthony Plack wrote:
>> For a showcase I need Asterisk to always signal G.729 as preferred
>> codec (to receive G.729) but to always send G.711, even if the
>> other party signals another codec as preferred codec.
>> 
>> Can someone please point to the respective code in chan_sip were I
>> can hard-code the used codec?
>> 
> Are you talking about guests or defined channels?

I as talking about chan_sip in general, my showcase uses a SIP "peer".

> As far as I know, this is a user question and not a code question
> because each sip definition defines separate allow/deny combinations.

No. Unpatched Asterisk does not support asymmetric codecs (tested with 
1.4.24). So, what does asymmetric codec means: The RTP format in the 
sent RTP packets is different to the RTP format in the received RTP packets.

allow/disallow can be used to configure different codecs per peer/user, 
but not asymmetric codecs.

> So incoming definitions have deny=all,allow=g729,ulaw and outbound
> channels have deny=all,allow=ulaw.

I am not talking about using different codecs for incoming/outgoing 
calls but different codecs for incoming/outgoing RTP packets (regardless 
if it is an incoming or outgoing call).

Asterisk's 1.4.24 always uses the same "sending" codec as the received 
RTP packets. E.g. a call starts with G.711 in both directions. Then, the 
peer sends an RTP packet with G.729 -> Asterisk changes codec of sent 
RTP packets to G.729.

Thus, to have asymmetric codecs, Asterisk needs to be patched (a littly 
bit tricky as chan->nativeformats is used for both, reading and writing 
frames to a channel).

> More info is needed as to why this is a dev question.

done.

regards
klaus



More information about the asterisk-dev mailing list