Showing posts with label FXO. Show all posts
Showing posts with label FXO. Show all posts

Monday, December 12, 2011

"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.

PogoDebian + FreeSWITCH + Linksys 3102 VoIP Gateway = Pure Bliss - Part 1

It was few years ago - around the year 2000 - when I had first toyed with the idea. The modem driver installation CD came with free PBX software that was IVR capable. I was amazed at what I had in my presence. Even back then, I was well aware of the possibilities. I was later reinitiated to Linux and orientation to Free Software came much later. Few months ago I discovered Asterisk but was put away by the expensive Digium hardware that it would need to operate, while still unware of what all Asterisk could offer.

Few weeks ago, I was in Florida for work and after learning that one of my colleagues also used Linux for a pet-projects of his, we both got into discussing how we had implemented our Linux setups. I told him about my Kubuntu laptops and the Debian server I was running on PogoPlug (I call it PogoDebian) and he told me about his SIP gateway server that he setup for VoIP telephony for his family in Sri Lanka. He uses it to talk with his family in US and in Sri Lanka. Moreover, he had a SIP phone application on his Android phone that he could use to connect to his server and make calls via his gateway at home over WiFi, even over 3g. He also mentioned about a VoIP gateway server from Linksys/Cisco that allowed him to connect a regular PSTN phone line to the SIP server and route his land line phone calls to his cell phone and vice versa. Spiked your interest? Yeah! I had the same feeling.

I made up my mind about it. I wanted to setup PBX like functionality in my house. A couple IVR menus would be neat as well. Some intelligent schedule based call routing and we'd be in business.
When I got back from that trip, I started my research on SIP servers and VoIP gateway. I found FreeSWITCH and was impressed by what it had to offer. It was capable of everything I had on my mind. As for the VoIP Gateway, Linksys/Cisco 3102 was ideal. It provision for 1 PSTN line and 1 phone/fax device. One key requirement that I had was even with the 3102 now in between our phone line and the phone itself, the existing phone configuration should not be lost and our home phone connect to the PSTN line should not change in the way it behaved.

Progress on this topic can be following in 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