Introducing FreeSWITCH
Somewhere along the way from all that planning, we actually produced code that could run on Windows as well as Linux and Mac OSX. My original teammates, Michael and Brian, were there from the beginning, and Mike, having a lot of experience in Windows, made sure we could compile and run the code in MSVC. It was a struggle at first, but after having to correct tons of compiler errors on many occasions, I began to learn how to code in a way that would be friendly on most platforms on the first try. Time started to fly and before I knew it, it was ClueCon time again. That year I gave my first presentation on FreeSWITCH, demonstrating the core design and fundamentals that are outlined in the opening chapter of this book. We saw very exciting modules, such as an endpoint module that can communicate with Google Talk. My presentation featured a live demonstration of several thousand calls being set up and torn down by our mod_exosip
SIP module. It was a nice demo, but we still weren’t happy.
Exosip was a SIP library that was really nothing more than a helper library to Osip, an open source SIP library that provided most of the functionality. The Exosip made it a bit easier to get an endpoint moving, and we decided to use it, but we encountered several mishaps with it, and I started to feel that same sinking feeling I had when I was trying to get Asterisk working, so we started looking for a replacement. It didn’t help that there was potential licensing conflicts because Exosip claimed to be GPL despite the fact that its parent library was LGPL (which, in my opinion, is a much more reasonable license). As we chose MPL for our project, it was forbidden by the GPL to allow GPL’d code to be included in an MPL app. License debates are fun and a good way to get people excited, but that was not the time for one.
We searched the land of open source far and wide, for both a new SIP stack and an RTP stack to use in FreeSWITCH since there was quite the high demand for SIP functionality. We auditioned several libraries for both roles and we ended up trying at least five different stacks for both protocols. I never found an RTP stack that satisfied me, so I wrote my own. I was not foolish enough to try the same thing with SIP. Having a front row seat to the mess caused by Asterisk trying to write a SIP stack from scratch and the failure with Exosip in my rear-view window, I continued to search for a SIP stack until I found Sofia-SIP, a SIP stack written by Nokia. We built a functional mod_sofia
to test things out, and we were highly impressed. We continued to polish the module until we reached the point where we could drop mod_exosip
and use mod_sofia
as our primary SIP endpoint module. This was only the beginning really, as I still find myself adding code to mod_sofia
on a regular basis to this day. SIP is a complicated and frightening protocol that brings many unpleasant thoughts to mind even saying its name, but now is not the time for that conversation.
We gave another presentation on FreeSWITCH at ClueCon 2007, this time with a new SIP module and a lot more code. Now we also had OpenZAP, a TDM library to connect FreeSWITCH to telephone hardware. OpenZAP was later replaced to FreeTDM and is now maintained by Sangoma Corporation. I experienced the joy of making the very same cards I got working on Asterisk so long ago to work with FreeSWITCH as well. We had announced that soon we would be releasing the 1.0 edition of FreeSWITCH. Anyone who read our original home page that I posted earlier might notice we announced that an official release was "coming soon" way back then. This was announced in January of 2006, and we were trying desperately to make things the way we wanted them ever since. We really wanted to focus on making a stable core before all else, and we were making real progress, but we still were not ready to release 1.0.
By spring of 2008 we had stable SIP, we had the event socket to remotely control FreeSWITCH, we had a module to interface with our API commands over HTTP, we had XML curl and a nice big list of features. We finally decided it was the right time for a release, so we bit the bullet and released FreeSWITCH 1.0 Phoenix. I chose Phoenix as the release name because I felt that all of our hard work was born from the ashes of our previous failures, and though it had been used by a lot of others, including NASA who was launching the Phoenix to Mars at the same exact time, I think it was the appropriate title.
ClueCon 2008 featured the announcement that 1.0 had been finally released earlier that year in late May. Several presentations also related to FreeSWITCH as well as the other open source projects such as Asterisk, who had produced a 1.6 release that year. We spent the next entire year focusing on wideband audio support and other advanced features such as on-the-fly re-sampling of unlike audio streams. We added many new SIP features such as presence indications and other fancy things beyond simple call setup and a follow-up 1.0.1 release.
In 2009, we released 1.0.2 to 1.0.4 versions and presented FreeSWITCH again at the fifth annual ClueCon. Some of our early innovations matched up with reality by that time, as we were able to demonstrate Polycom phones using high-definition audio on their new Siren codec as well as support for the Skype protocol as an endpoint module. The FreeSWITCH presentation was an overview of the things you probably didn’t realize you could do unless you learn to think fourth-dimensionally, as Dr. Emmett Brown (from Back To The Future) and I both like to put it. We have some similarities to Asterisk in behavior, but we also have an entirely new paradigm that opens the door to some incredible things you can do with just a PC and a telephone.
In 2010 we had ClueCon MMX at the Trump Tower! It was one of the most memorable ClueCons ever, and the first edition of this book was released. We even gave a few away as prizes! We gave a detailed presentation on FreeSWITCH and performance. We released 1.0.5 and 1.0.6. The theme that year seemed to be Erlang. Everyone was getting on the bandwagon for doing event-driven architecture, so we were definitely in the right place at the right time!
2011 was a big transition year for the project. Inspired by our own presentation on performance the year before we made some drastic changes to the Sofia SIP module to try to de-serialize it at the point where the messages met the application so we could push the message processing for each call into its own thread. This change yielded a lot more parallelization of operations and reduced the likelihood of the entire SIP stack getting stuck behind an issue happening on a single channel. For ClueCon that year, we went Euro at the fabulous Sofitel. We demonstrated a bunch of new features added to help developers, such as the concept of array variables and scoped variables so you can set a channel variable that is only set during the execution of a particular app.
In early 2012 we announced a new initiative to create a stable branch to the FreeSWITCH code repository. This is a daunting task because you must separate your mature code from your newer code and do additional checks on changes to respective branches to make sure everything is running smoothly. We’ve been working hard on this, and the refresh of this book will mark the beginning of the FreeSWITCH 1.2 stable branch. We had a great ClueCon at the Hyatt and showcased several new features such as faxmodem emulation designed to work with Hylafax and also mod_htttapi
that is covered in an earlier chapter in this book.
At the time of the writing of this book we have most of 2013 ahead of us. Having survived the Mayan apocalypse, we look on to bridging the gap between telephony and HTML5 with support for WebRTC and the first alpha releases of FreeSWITCH 1.4. ClueCon will be held at the Hyatt again, and they have remodeled the entire building for our enjoyment. We hope to see you all there, and I hope you have managed to learn a little bit more about FreeSWITCH and why I decided to start typing those first few characters in that empty text-editor that has blossomed into nearly half a million lines of code just inside the core components of FreeSWITCH.