I am “ringing the changes” this weekend. Over the past few months I have been getting, frankly, quite frustrated with a relatively new piece of software called FreeSWITCH which is a software PBX (or, in English, a telephone exchange). Up until recently, I’ve been using a piece of software called Asterisk to do the job, and in many ways it’s worked very well. But over time I’ve been getting increasingly frustrated by its bugs. So I’ve been having a look round to see if there is anything “better”.
I decided there were three probable open source software candidates for the job: Kamailio, Asterisk 1.8 or FreeSWITCH. All three are quite capable in their own little ways, but it was more a case of which one to choose. So, I installed them all and gave them a try.
Firstly, I tried Kamailio. This particular product is a derivative of what was originally SIP Express Router. This product, it is claimed, handles hundreds and hundreds of call setups per second, so it is very suitable for use in large telcos. Out of the three packages, it is probably the closest thing to what is known as a softswitch in telecoms terms, and is also the closest thing to how the SIP protocol was envisaged to work when it was created. Unlike the other two products, what Kamailio is best at is setting up, tearing down and routing calls. Which is great, but unfortunately people expect “features” in their PBXes these days, such as voicemail or conferencing and so on! With a softswitch, this is typically done by handing off to “feature” servers (which, ironically, are quite often run by PBXes!)
What really put the nail in the coffin for me as far as Kamailio was concerned, was how complex the configuration file was. It seemed necessary to understand the SIP protocol at a very low level to even begin to understand how to use it. Whilst I have a good book on this subject, I felt it was massive overkill to need to configure a softswitch at that low a level for what is basically a small home PBX. A pity, because I think it is probably very good at what it does, but just wasn’t for me.
This is the very recently (at the time of writing) released version of the existing software that I was using. Despite the fact that I have been using this software ever since version 1.0, and that’s years and years, over the past few months, I have become increasingly frustrated at the rather stupid bugs that Asterisk (or * for short) contains. In particular, its SIP support is frankly rubbish. Until now this hasn’t really been a problem since my service provider offered IAX2 connections to the PSTN, but since they have commissioned a new server, which is SIP only, I felt it was time to move away from IAX2 (which although published as RFC 5456, has never really gained acceptance much beyond the * community) and talk pure SIP. So I bought myself a good book on the subject, and tried to learn it. It was mainly through this that I was seeing more and more shortcomings in the SIP implementation in *. Also, there was in the previous version no IPv6 support (which is going to become increasingly more important in the next year or two), and it is only the SIP stack which is IPv6 enabled – none of the other modules yet support it.
Asterisk is still a hugely popular PBX, and I know many people that use it, but it is fast becoming the “last resort” choice for me now that I am only too painfully aware of its shortcomings. It’ll be sad to leave it in a way, because I’ve had a lot of fun with it, starting off with a single ISDN2e (Euro-ISDN) line and graduating all the way up to SIP phones with IAX2 trunks and all kinds of fancy features enabled over the years, but enough is enough. Asterisk is badly in need of a rewrite and needs to start being compliant with some actual standards, and then it may usable again. It was fun while it lasted though!
So, having been disappointed by Kamailio because it was too complex, and disappointed by Asterisk because it was too buggy, that really only left FreeSWITCH. I remember getting the source code for the first time and trying to compile it. It was a nightmare. Then I discovered that you had to run bootstrap.sh first and then the Makefile appeared.
This must be about my fourth go at installing FreeSWITCH. The first three times I gave up in disgust. But, there is something about it that I like, and that is the architecture of it. FreeSWITCH (fs for short) is designed from the ground up to be modular, and not only that, to use third-party libraries as much as possible. This is good news because it means that it can use industry-standard libraries like libsofia (derived from code originally written by Nokia) which are fully RFC compliant.
The initial big downside of FreeSWITCH is its XML configuration, and the fact that there is stuff-all documentation supplied with the thing. In my opinion, it’s a classic case of “programmer-itis”, where the documentation is the code, except that’s no good if you’re not a hotshot programmer (i.e. me). The wiki does have some documentation on it, but there’s a lot missing, and that’s frustrating.
What is more frustrating is that the sample config is cram-packed full of features, none of which are explained, and no indications of what it’s safe to leave out. After much experimenting, tearing out of hair and even buying the new FreeSWITCH book (which frankly wasn’t always an awful lot of help, since it just said “use the config we supplied and tweak it” a lot of the time.), I managed to get a very basic configuration going, and I used that as the basis of my experiments.
But … there’s no denying that FreeSWITCH does have a lot going for it, once you begin to understand it. I found that once I’d got rid of all the dead wood in the configuration and built one up from scratch, it did begin to make a lot more sense. Now I have it up to the point where it is quite usable, I can see that it actually has many advantages over Asterisk – the primary one being that it’s a cleaner, far better design and hence why I’m going to stick with it, despite the configuration taking weeks to do and involved a painful retraining process. Give a while, and I think it’ll be a serious contender to Asterisk.
So, FreeSWITCH wins, but what’s happening this weekend?
So, what now? This weekend marks the official switchover to FreeSWITCH. Currently my “live numbers” are not on any PBX at all, going straight to the phone so that I can guarantee the calls can get through whilst the new server was being set up. I have a couple of test numbers on the fs server from two different providers, so that I can test compatibility before I move all the numbers over.
The configuration isn’t finished yet, but most of it is done. Voicemail is working, and the conferencing server is up, and I can route calls inbound and outbound to and from the PSTN. Still left to do are conversions of a couple of old Asterisk scripts, plus implementation of ACR (anonymous call rejection) and other assorted bits and pieces like implementation of feature codes, but none of those will stop the incoming calls ringing the phones if they’re not in place.
So, if you can’t get through on the this weekend, that’ll be why … although I don’t expect the job will be too arduous, like most things of this nature, it’s fine if it doesn’t go wrong. I expect I’ll be blogging again after the event to let you know how well it didn’t work … :)