Showing posts with label SIP. Show all posts
Showing posts with label SIP. Show all posts

Monday, December 12, 2011

FreeSWITCH Implementation ideas

Disclaimer: Flying through Linux and OpenSource. You might experience Freedom along with plenty of awesomeness.
So you have a SIP Server/PBX setup with FreeSWITCH. What all can you do with it?

Use it in your Small Office/Home Office:

  1. Use it for interoffice voice communication.
  2. Use it for internal voice communications between satellite office locations.
  3. Setup call routing for all incoming calls based on the time of day and availability of personnel.
  4. Create an IVR menu for your customers/clients to assist with call routing and to provide valuable information over the phone, such as hours of operation, directions, etc.
  5. Create an IVR menu for your customers/clients to assist them with account inquiry - some coding needed to interface with your backend datastores.
  6. Auto-announce important messages or season's greetings to the caller before routing calls.
  7. Setup automated calls to your customers/clients reminding them about useful information or deadlines.
Use it in your Home:
  1. Use it as a Skype replacement for your immediate and extended families.
  2. Route incoming calls intelligently directly to the intended recipient's SIP phone device.
  3. Make outbound calls from any computer or SIP/soft phone on your network.
  4. Block unsolicited incoming calls from telemarketers.
  5. Block unsolicited incoming calls from annoying callers.
  6. Play "This number is no longer in service" when annoying callers call.
  7. Screen incoming calls having callers announce their names before sending the call through, giving you the opportunity to reject calls.
  8. Setup reminders having the "home" call you reminding you about the milk.
  9. Prank your friends by using pretend voice greetings when they call.
  10. Replace your fixed home phone units with unused smartphones over WiFi.
  11. Make calls using your home phone even when away (*see how I set this feature on my home network below)
  12. Use you favorite VoIP home phone service's features from anywhere (*see how I set this feature on my home network below)
Fun project ideas that could use FreeSWITCH - some coding required:
  1. Interface with your Home Automation System and turn lights on and off by calling your home.
  2. Have your home phone read out your emails or rss feeds when you call.
  3. Have your home phone take dictation and voice notes and store them on your home network.
  4. Setup a dial-in radio/jukebox.
  5. Have your home phone give you information about local weather, news headlines, your server's overall health, software application's progress, etc.

Here is how I use it in my home network:


We have a Vonage home phone serivce with a flat monthly rate international calling plan. However, it is a fixed home phone line. Now with the FreeSWITCH + SPA 3102 setup, I can make international phone calls from my Android cell phone over 3G and WiFi where ever available.
For all the non-smart phones in our household, I found a free service called IPKall  that gives you a regular phone number (Washington state numbers only) that can be forwarded to any sip phone. I've configured a new extension on the public profile and forwarded the IPKall phone number to go to this extension. The following happens when someone calls this IPKall number:

  1. If the incoming caller id is identified as one of our cell phones, then the caller is prompted to enter the number. FreeSWITCH then initiates a outbound call using the home phone line and bridges the two calls.
  2. If the incoming caller id is not identified as one of our cell phones, then the caller is sent to voice mail box.

This way my parents, who don't yet have an Android phone, can still make international calls through our Vonage home phone from their cell phones. At the same time I don't have to worry too much about someone finding out about this IPKall number and using it to make unauthorized international calls using our phone line.


This article is part of a series which can be tracked by the following articles:
PogoDebian + FreeSWITCH + Linksys 3102 VoIP Gateway = Pure Bliss - Part 1
Hello!!! We have a dial tone.
"Operator. How may I direct your call?"
FreeSWITCH Implementation ideas

"Operator. How may I direct your call?"

Disclaimer: Flying through Linux and OpenSource. You might experience Freedom along with plenty of awesomeness.

I am a curious being and I love the freedom that is offered by Linux. Because of this, you will occasionally find me spending hours on pet projects that have nothing to do with what I do for a living.

In past couple posts, I shared my desire and my efforts to set up my own PBX in my home network. I also shared the discussion I had with a colleague who had successfully setup an intercom system that he used to talk with his family abroad. After spending numerous hours on this feat over past few days, last night I finished my setup and I now have all the functionality that I needed from this setup.

I installed FreeSWITCH on a Debian server that I have on my home network. It had to be compiled from source since PogoPlug houses an ARM processor and Debian repositories didn't have a packages for FreeSWITCH for arm architecture. But the instructions were easily available and installation was a piece of cake. Like I had mentioned in the previous post, the installation came pre-configured with 20 extensions for internal use, an demo IVR menu, and plenty of other features.

I was now able to register soft phone softwares running on our Linux desktops and laptops and my Android phone over WiFi within our home network and test the calling from one soft phone extension to another.
I now needed a sip gateway router that would allow me to connect my home phone line to the FreeSWITCH setup. I found a great deal on a Cisco/Linksys SPA 3102 sip gateway router. SPA 3102 allowed me to connect my incoming phone line on one jack and my home phone unit on the other.
I now had a PBX setup which was accessible to be via the home network for internal calling. I was also connected to my home phone line, which allowed me to make outbound calls and receive incoming calls.
Now one thing to keep in mind that even though SPA 3102 has a jack for phone line (FXO) and a jack to connect a physical phone (FXS) they operate on two separate extensions. However, now that we are in SIP/PBX territory, calls can be bridged and transferred from one extension to another. I was able to configure FreeSWITCH and SPA 3102 so that the calls received on the PSTN line (FXS) would be forwarded to Line 1 (FXO) where my phone was attached. I also configured FreeSWITCH to send the calls originating on internal extensions - Line 1 on SPA 3102 also being one of them - that are not handled internally, to send them outbound via PSTN line. My basic phone setup was restored and I now had the capability to make outbound calls from any computer from within my home network. Think Skype Out without paying an addition cent.

I mentioned earlier that I was able to register and test soft phone on my Android phone to my home FreeSWITCH server. This was done over WiFi. I was able to open ports on my home firewall for FreeSWITCH so that I could connect from an outside network. And I was successfully able to test this by getting on a different WiFi network that had Internet access. The next thing naturally was to do a quick test over 3G we'd be in business. Yeah, right. This was not as quick as I had anticipated it to be. I was able to originate outbound calls and receive incoming calls successfully, but there was no audio. After spending hours researching it, I found the answer hidden in plain sight, mocking me all this time.

SIP Servers and phones use what is called a STUN service to help with port discovery when connecting to other servers and phones behind NAT/firewall. I had already read about it briefly and had configured my server to use stun.freeswitch.org as the STUN service url. From the reviewing the logs, I discovered that the url was not reliable and down most of the time. There are however a number of free STUN services available and I found a webpage that listed quiet a few of those. FreeSWITCH comes with a STUN server testing utility and I was able to find one of the STUN servers that was indeed online. I configured my FreeSWITCH server to use it, and now I had audio on my Android phone over 3G.

All this was a fun and exciting experience overall. Besides the time I put in it, it cost me $43 that I paid for the SPA 3102. What are the practical applications you'd ask. There are plenty, and I plan to dedicate the next article discussing those.


Progress on this topic can be following in the following articles:

Monday, December 5, 2011

Hello!!! We have a dial tone.

Disclaimer: Flying through Linux and OpenSource. You might experience Freedom along with plenty of awesomeness.

After doing some initial reading up on FreeSWITCH. The reviews were promising enough for me to proceed with the installation on the Debian server that I had earlier setup on PogoPlug.

The documentation on the freeswitch.org was plentiful with beginners' guides and quick start manuals readily available and easy to follow. I couldn't install FreeSWITCH from the official debian repositories since they didn't host installation for ARM architecture. However, I was able to simply download the source and compile it on the server without any issues using the instructions that came included with the source code.
Once installed, there was really nothing to configure as I found that the out of the box setup was pretty decent. It came with 20 internal extensions - 1000 through 1019, a conference extension - 888, and a demo IVR menu extension - 5000.

I changed the default password and tested VoIP on the new PBX using QuteCom on my laptop and 3CX on my Android phone over WiFi within the home network. Initial results were very promising. I configured my router to allow SIP traffic through the firewall, again after reading up about it in the documentation. I was able to successfully test connectivity and voice from outside the network as well.

Now I got curious and decided to buy a VoIP gateway hardware that would allow me to connect my phone line in (FXO) and also my home phone device (FXS) and route calls from internal SIP to PSTN and vice versa. Luckily I got a very good deal on Linksys/Cisco SPA3102. After it arrived in the mail, I started the tedious task of connecting and configuring it.

I realized that I had exhausted all four of my Ethernet ports on my home DSL router. I had an old four port Linksys broadband router sitting in the attic. I turned off WiFi on it and bridged it to the home DSL router using an Ethernet cable. Now I had room for two more devices, one of which was going to be this new SPA3201 gateway server.

I began configuring the gateway. First, I tested receiving my home phone calls on my computer. Then I configured making outbound calls using my computer. So far so good.
Calling out using the phone handset was a piece of cake, however, receiving inbound calls on the phone was something else. After spending yet another couple hours on it, I was able to fix the configuration and receive inbound calls as well. I was able to test the IVR menu as well as make calls using my computer to test the scenario.

I'll be experimenting with the PBX setup and the dial-plans in the coming weeks to further explore its power. I had a lot of fun setting it up. Now to come up with ideas to put it to real world use.