Friday 23 October 2009

Just passing through


We're moving!

Blogspot has been a great way to start blogging, but it has limitations. We've just completed a brand new annex to the smartvox web site called the Smartvox Knowledgebase - it is a combined blog plus a complete archive of all the blogs and VoIP articles I've written in the last few years. Please visit the new Smartvox Knowledgebase at:
http://kb.smartvox.co.uk/.

To read the latest revision of this article on Asterisk Codec selection and pass-through mode at the new site, follow this link:
http://kb.smartvox.co.uk/asterisk/how-it-works/rtp-pass-through-mode-in-asterisk/

The Pika Appliance for Asterisk (affectionately known as the Warp Appliance) is a great little device to use as a small office telephone system connecting to SIP trunks and conventional analogue or Basic Rate ISDN lines. It does, however, have one potentially annoying weakness - no support for transcoding to or from the G.729 codec.

G.729 compressed speech uses less bandwidth than uncompressed G.711. Ok, there is a trade-off in so far as the speech quality is not quite as good, but if you need to deliver multiple simultaneous calls over an ADSL broadband link, then it has to be considered.

In theory, Asterisk supports so-called "pass-through" mode - this is where the encoded/compressed speech passes through unchanged from the SIP trunk to an IP extension phone. Transcoding is not required, so the Pika's lack of support for G.729 is irrelevant. The question is "Can the Pika Appliance be configured as a basic PBX feeding G.729 encoded calls from a SIP trunk to local extensions?". The answer is yes, but setting up the list of allowed codecs in the sip.conf file is not altogether straightforward.

My research showed that Asterisk is not very clever when it is matching up codecs on the inbound and outbound legs of a SIP-to-SIP call. The rules seem to be this: the 1st preferred codec of the calling peer is always used and, provided the called peer also supports this codec, then pass-through is activated. If the calling peer's 1st codec is not allowed by the called peer, then Asterisk attempts transcoding using the 1st codec of each peer. If it is unable to transcode (e.g. when G.729 is the 1st codec for one peer on the Pika Warp) then the call fails with a "not supported here" message. This is quite unsophisticated because it never looks at the options for pass-through using the 2nd, 3rd or other codecs listed for the calling peer.

Pass-through mode may provide a useful solution for direct peer to peer calling, but if you want Asterisk to play a sound file then you may be faced with a similar problem. In theory you could record all the prompts in a G.729 encoded format thus avoiding the need for transcoding. If you have tried this or have any other comments, please post your comments back here.