What does Asterisk need codecs for?

0

Let's take a system which consists of one Asterisk server and two SIP clients. Each client has an equal set of codecs installed. Traffic encoding and decoding is performed on a client side.

Then why to install codecs on Asterisk side? It can be only a dial-up-controlled traffic switch leaving the encoding/decoding job to clients and therefore making CPU load very humble.

When codecs on Asterisk side may be needed? Only when Asterisk should tell something to a client: a ringback tone, a busy signal, voice platform notifications. Also they should be used in call recording. If not to use the call recording, those moments are relatively rare and transient.

In all other cases traffic could only dumbly pass through an Asterisk server.

I read everywhere that Asterisk PC CPU load depends highly on number of concurrent conversations and on codec being used. Does it mean that Asterisk decodes all the voice data from one client only to encode it again for other?

Paul

Posted 2015-06-20T21:55:56.823

Reputation: 579

1Asterisk has many many configurations, but to illustrate one that you haven't considered, google this: asterisk analog card .... Actually I have no idea when asterisk uses or doesn't use codecs for encoding or decoding, but connecting traditional POTS analog lines is one where it will need them. – Tyson – 2015-06-20T22:38:29.280

Answers

1

If both side of SIP call use SAME codec, you need format module (format_g729.so for example) but NOT need codec module(codec_g729.so)

However if you playback something and recording is not in .g729 you need codec.

If you use uncompressed stream(other codec or pstn/e1 card) you need codec.

Also in some variants can be situation when one stream downway go with one codec, upway same stream go other codec(if both side support 2 codec but different preference set)

Asterisk mixing engine will try avoid codec if possible(especialy in version above 11.x). However due to internal limitation there can be situation when codec supported by both end, but still selected different codec on both legs of calls.

For example if you have on one side

 allow=g729
 allow=g723

on other side

  allow=g723
  allow=g729

AND both phones support both codecs, asterisk will select top codec for both and WILL require codec binary. In newer version you can control that by changing options in sip.conf

  preferred_codec_only=

Also you can put codecs preference in variables

https://wiki.asterisk.org/wiki/display/AST/chan_sip+Channel+Variables

arheops

Posted 2015-06-20T21:55:56.823

Reputation: 977