By John Foland, Developer Evangelist
Since its inception, SignalWire is the most advanced communications cloud platform on the planet, and for over 15 years, the FreeSWITCH open-source project has been the ultimate toolset for any kind of real-time communication service, unrivaled in power and flexibility. Now the two can operate seamlessly together, thanks to mod_signalwire.
SignalWire's core group of O.G. developers founded and developed the FreeSWITCH project, so using the two of them together couldn't be simpler with mod_signalwire. It allows developers to use SignalWire's elastic cloud infrastructure for carrier services in conjunction with FreeSWITCH, all in a few simple steps.
In this demo, we will be taking the connection token from a fresh install of FreeSWITCH and placing it into SignalWire's integration interface. We'll then do some minor configuration and edit our dialplan to test out our setup. In order to perform all the steps in this demonstration, you will need a functional FreeSWITCH installation (minimum version 1.8.3) and a SignalWire Space with at least one purchased phone number.
Step 1 - Retrieving the connection token
From a fresh install of FreeSWITCH, one of the very first outputs in FS_cli is the mod_signalwire connection token, so if you catch that line, you're already good-to-go. That line looks like this:
If you missed that, no worries, a simple command allows you to display your connection token at any time from FS_cli: `signalwire token`
Now that you have your connection token, you're ready to complete the integration of your FreeSWITCH installation and your SignalWire Space.
Step 2 - Configuring SignalWire
With your connection token in hand, hop on over to your Space. Make sure you are in the project that you wish to use FreeSWITCH with (the project selector appears below the SignalWire logo) and click on the "Integrations" tab. You'll want to create a new integration by clicking on the appropriate button. The integrations page will appear with the various options for connecting SignalWire with your platform. Select the FreeSWITCH option, of course.
Once on the "New FreeSWITCH Connection" page, simply paste your connection token into the appropriate field and give your new connection a friendly name of your choosing so that it may be easily identified later. This comes in especially handy when connecting multiple instances of FreeSWITCH to your Space's project.
Back over on the FreeSWITCH side, you should see your console returning lines like the following:
The next bit of setup in regards to the connection is not necessary for the purposes of this demonstration and is rather self-explanatory. At the connection level, two general parameters can be set: "Caller ID" (for SIP to SIP calls) and "Send As" (for PSTN phone numbers). The former is optional, and the latter defaults to randomly selecting an available phone number from the purchased and/or verified numbers in your project.
Finally, let's take one of your project's phone numbers and configure it for use with your new connection. To do this, simply edit the settings of any phone number attached to the project that you connected to FreeSWITCH with mod_signalwire. Under the "Voice and Fax Settings", make sure to handle calls using "a FreeSWITCH Connector" and then select your connector's friendly name in the dropdown menu underneath "When A Call Comes In, Forward Call To".
Step 3 - Dialplan
Here's where we'll put our setup into play with a simple XML dialplan. Add the following code to your /etc/freeswitch/dialplan/default.xml file (or equivalent on a non-Debian based OS):
Now call your purchased phone number from any other line. If everything is set up properly, you should hear the current date and time, straight from your FreeSWITCH instance!
Come and build something great on SignalWire!
* Please check our pricing page for up to date pricing. Short code lease rates, carrier activation & pass-through rates apply. Please contact our sales department (Phone: +1.650.382.0000) for more information.