Using Socket Based Codecs
Telephony Software Concept Paper
This concept paper outlines how a socket based codec service can be implemented and utilised by open source telephony software in order to resolve license incompatibility problems with proprietary codecs.
A Socket Based Codec Service
Document version: 1.0 Author: Benjamin Kowarsch Copyright (c) 2007 Sunrise Telephone Systems Ltd., Tokyo, Japan Permission is hereby granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, GFDL Version 1.2. This Document is provided "as is" without any warranty of any kind. A Socket Based Codec Service Background Some commercial codecs are licensed under terms which are incompatible with the GPL license and therefore such codec implementations cannot be linked with GPL licensed telephony software. However, a codec implemented as a socket based service could be used by GPL licensed software without any legal issues. It would therefore be beneficial to open source telephony projects to implement such a socket based codec server. This document outlines a socket based codec server and how it could be used by GPL software such as GNU Bayonne, Callweaver, Freeswitch and others. The Codec Server A codec server running as an independent process will create a Unix special device node in /dev (or another suitable location) with a common control socket and multiple audio sockets representing one channel each. For example: /dev/codecs/g729/ctl -- the control socket for a g729 codec server /dev/codecs/g729/1 -- audio socket for channel 1 of the g729 codec server /dev/codecs/g729/2 -- audio socket for channel 2 of the g729 codec server etc The codec server will provide the following primitives on the control socket: Information primitives - codec license - list of channels in use - number of remaining unused channels - packet size for a given audio channel Management primitives - request and allocate an audio channel - release a previously allocated audio channel - set the packet size for a given audio channel - request encoding of audio data - notify availability of encoded audio data on the audio channel - request decoding of audio data - notify availability of decoded audio data on the audio channel Client Side Many open source telephony servers have plugin architectures which allow the use of loadable modules to add custom features and interfaces. Here we will assume the use of Callweaver to illustrate how a GPL compatible plugin module could be used to add an interface to the Codec Server outlined further above. A Callweaver plugin codec module will connect to the codec server sockets to use the codecs provided by the codec server. The following steps are involved: 1) connect to the control socket 2) request a channel on the control socket 3) set the packet size for the allocated channel (optional) 4) connect to the channel's audio socket 5) send and receive audio on the channel's audio socket 6) disconnect from the audio socket 7) release the channel 8) disconnect from the control socket The difference between this codec module and conventional codec modules for Callweaver is the way in which the module talks to the codec service. Whilst conventional codec modules link to the SpanDSP library to use the codecs provided by that library, this module communicates with the codec service over the sockets provided for this purpose by the codec server. The codec server client plugin module may be implemented as a multi-codec module in which case configuration options are required to direct the module which codecs are available on which sockets. Alternatively, one codec specific module per codec may be provided which is how conventional codec modules for Callweaver have been implemented.
Click here to download this document.