Sunday, October 25, 2009

VoIP: Why You Should Try FreeSWITCH

VoIP is here to stay. Do a google search on "PBX" or "telephone system" and you'll see there's no going back to the TDM-only days. I'm an old-school PBX guy and I can definitely see the writing on the wall. I actually like TDM, but the advantages of VoIP are just too hard to ignore or dismiss.

So, you want to get into VoIP, but you aren't sure where to begin. There are lots of products out there claiming to be "what you need." Of course, you may not know exactly what you need. Do you need a PBX? A soft-switch? An application server? Something else? It's hard to know when you're just getting started. Even if you've already started down the path with a particular piece of software (or hardware for that matter) there's something you need to know about: FreeSWITCH.

Before I continue, let me just say that I am a bit of a fanboy. I am certainly biased. If you can look past my obvious homerism and think about what FreeSWITCH can do for you then I think you might be pleasantly surprised. FreeSWITCH is extremely scalable and versatile. It is designed to meet many different needs. So, what exactly is FreeSWITCH?

FreeSWITCH is a cross-platform, scalable soft-switching library. In other words, it can be embedded in other software, like .so or .dll files are. Yes, it runs on Windows. It runs reasonably well, I might add. Most people don't embed FreeSWITCH in their own software but instead run the "freeswitch" application. This is like the difference between cURL (the program) and libcurl (the underlying software library). The default FreeSWITCH install is a simple but powerful PBX. However, it can scale up or down. For example, you can use it as a soft-phone or a soft-switch. Since it is a telephony switching engine that can scale you can use it in many forms. I use it as a soft-phone on my laptop. (I find it to be much more stable than Ekiga.) There are others who use it as a carrier class soft-switch serving many thousands of customers. FreeSWITCH will scale with your hardware, so you can use it as you see fit.

The scalable nature of FreeSWITCH helps you. You want to get into VoIP but don't know exactly what you need? FreeSWITCH can scale to meet your needs. It's a great choice for a telephony platform. So if you want to build a SOHO PBX or a large-scale enterprise PBX or a VoIP-PSTN gateway then FreeSWITCH can help. So what can't it do? FreeSWITCH operates as a back-to-back user agent (B2BUA) which means that it is not designed to act as a SIP proxy. Instead, it is meant to complement a SIP proxy. (If you need a SIP proxy then stick with OpenSIPS or one of its cousins.)

One thing that FreeSWITCH does very well is handling media. It can handle audio streams at 8kHz, 16kHz, 32kHz, and 48kHz. It can handle numerous codecs, including some really nice HD codecs like Polycom's Siren(tm) codecs or the fantastic CELT. Best of all, it can bridge audio streams from any codec/sampling rate to any other codec/sampling. I know that may not sound like a big deal, but just try it with other systems. Try having 20 people in a single conference where they are all calling in with different codecs and sampling rates and see how well they can hear each other. I don't know of any other system that can handle sampling rates above 16kHz. FreeSWITCH will go up to 48kHz. If you have a good headset and ear phones then the high definition codecs sound incredible. (Once you go HD voice you will never want to go back to standard 8kHz analog phone lines or worse, GSM cell phone quality calls.)

FreeSWITCH is extremely well-designed and is very stable. It can scale far beyond its competitors on the same hardware. While 10,000 call legs on Asterisk was prize-worthy (see the Asterisk S-Prize) the FS devs were playing around with 20,000 call legs just for fun. They long ago found out the levels where the number of UDP ports runs out as well as how easily they could saturate a 100MB Ethernet connection. Bragging rights aside, the number of concurrent calls on a single box isn't that great a measurement of how awesome your telephony platform really is. Just because you can run 16,000 call legs on one box does not mean you should, at least not in production. One hiccup taking out 8,000 calls is probably not good for business.

FreeSWITCH is configured with XML files, or with a back-end database that serves XML configuration information. This is very scalable - one can have multiple FreeSWITCH boxes receiving configuration information from a redundant db cluster. FreeSWITCH is very modular, and in the XML configuration you can enable or disable various modules. Don't need a module? Disable it. You enable only the modules that you need.

One other great thing about FreeSWITCH: the hooks. You can enable the built-in HTTP server and send commands and receive the output as text, XML or HTML markup. FreeSWITCH can output CDRs in CSV files or with the very powerful cdr_xml module. CDRs in XML are amazing as it is, but in addition to dumping XML to a file, FreeSWITCH can POST XML CDRs to a Web server that can in turn handle the db back-end. This allows for easy off-line handling of CDRs. The power of the XML CDRs cannot be overstated. If you've ever dealt with the drama of CDRs on an Asterisk system then you know what I'm talking about. When it comes to CDRs, it's better to have too much information rather than not enough. Single-record CSVs are okay, but XML CDRs give you a complete call history. You can log the A leg, B leg, or both legs. Each leg's XML CDR file has a field to identify the "other" leg so that you can logically associate two XML CDR files and create a complete call record. The greatest "hook" in FreeSWITCH, though, is the event socket.

FreeSWITCH has an amazing eventing system where modules send event messages to the core and receive messages from the core. This allows for agnosticism in the design of the system. Disparate modules don't have to know anything about each other. All they have to do is send messages to the core and act upon messages from the core. The event socket is an extension of this eventing system. An external process can connect to FreeSWITCH and subscribe to these events and act accordingly. The process can control calls, record stats, monitor the system, etc. Any programming language that supports socket programming can be used to control FreeSWITCH. It really is amazing.

Try FreeSWITCH, I promise you will be impressed. Even if you are totally satisfied with your existing system, be it OSS like Asterisk and YATE, or proprietary like 3CX, I recommend giving FreeSWITCH a test drive. Some have done so and immediately decided to add FreeSWITCH to their repertoire. Others needed functionality or stability that Asterisk or other systems could not provide. What can FreeSWITCH do for you? Among other things it will give you one of the most powerful telephony engines in the world and you won't have to spend a dime on software. At the very least you will have an ace up your sleeve the next time you need to build a VoIP system.

1 comment:

  1. I'm an software engineer that spent many years working for telcos (Rolm, Siemens). I'm playing with FS and would like to exchange email addresses - I can be reached at