Navigation

Smartswitch: Media Proxy

Figure 1. Architecture

Media Proxy is a helper module, that is absent in the standard Asterisk package. It was designed and developed by our company from scratch.

Its purpose is to boost media streaming through the system. For some business applications, for example, Wholesale Switching, this is essential, because wholesalers handle hundreds of simultaneous calls.

Performance improvement is achieved by the short media path, because Media Proxy works solely in the kernel mode. Thus, no kernel to userspace back and forth context switches and packet copying are done to handle a single voice frame. Together with FreeBSD's fast forwarding feature this gives almost wire speed. CPU is utilized mainly for checksumming and routing.

Advantages of using Media Proxy:

Performance improvement

Although the whole idea is not new (FreeBSD already has NAT and forwarding implementation in the kernel), when applied to VoIP, this gives significant performance improvement and this is the only possible way to handle heavy voice traffic through the system (besides clustering).

Decreased latency

Another benefit of such an implementation is decreased latency of the frame handing. Due to fact that frame goes only through the kernel, it appears on output of network device faster than in kernel->userspace->kernel implementation. This makes user experience better.

Decreased jitter

Kernel level activities have more prority than userpace ones, therefore media flow is handled with more priority. Therefore, even when system is 100% loaded (for example, complex report
generation or re-calculating billing), media flow is not affected and jitter is not inserted. This is especially actual for devices with poor jitter buffer implementation.

Media Proxy supports:

audio/video RTP;

RTCP;

UDPTL (transport for T.38 faxes);

clients under NAT.

Media Proxy is activated only when:

channels are bridged;

media doesn't go directly peer-to-peer;

bridged channels have identical media formats;

core doesn't need to get media from the channels (for example, no voice recording is configured);

Jitter Buffer is disabled.

Testing showed astonishing results: up to 1100 simultaneous sessions with g711 codec and 2-way audio have been handled by a single Core 2 Duo system.

Table 1. Comparison of media bridging techniques.

Bridge technique

Sessions

Native. Voice travels directly peer-to-peer.

unlimited

Transcoding. Media format is transcoded back and forth between the bridged channels.