freeswitch

Home VOIP system using FreeSwitch and a Linksys 3102 voice gateway (UK Guide)

This is a basic HOWTO for setting up a home VOIP system using the excellent FreeSwitch telephony platform and a LinkSys SPA3102 voice gateway. (skip to the HOWTO section if you just want to get on with it)

First of all a quick introduction to FreeSwitch for those who haven’t come across it before…

(the following mercilessly wrenched from freeswitch.org)

FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch. It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow.

We support various communication technologies such as Skype, SIP, H.323, IAX2 and GoogleTalk making it easy to interface with other open source PBX systems such as sipXecs, Call Weaver, Bayonne, YATE or Asterisk.

Okay, so we’ve established what FreeSwitch does. The one thing it doesnt do is connect you to your BT telephone line, we need a piece of hardware for that. In this case the Cisco LinkSys SPA3102 which again according to the blurb on the Cisco site ….

The SPA3102 Voice Gateway allows automatic routing of local calls from mobile phones and land lines to Voice over Internet Protocol (VoIP) service providers, and vice versa.

Why would I want to run a home VOIP system?

Well for one as stated in the product blurb line above you can setup the voice gateway to use a VOIP service provider for making calls from your landlines, this is easy to do and will save you a bunch of cash especially if you regularly make long distance calls.

I have other reasons though some important to me and others just hacks i want to play around with here’s a short list

* When I’m working at home I want to be able to make and receive all my landline calls from the softphone I have running on my laptop (I’m using X-Lite) , then i can use my headset which i find most comfortable especially when on long conference calls. Using a softphone on my laptop allows me more freedom to change volume levels which can vary a lot on international conference calls.

* If I’m away from home and with internet access somewhere i want to still be able to answer my home phone.

* I want control of the time of day our phone rings, my daughter Lucy gets put to bed at around 7pm and frequently wakes up when the phone rings in the evening.

* I want control over who rings, with held numbers will go straight to voicemail hopefully cutting out the dreaded sales calls.

* Most of the rest is covered by fun hacks i have in mind

ok discussion over.

HOWTO

(disclaimer this is a UK guide for BT landlines, plus if you break anything don’t blame me)

What you’ll need

1. a Cisco Linksys SPA3102 (cost £50-£60)

2. An RJ11 socket to BT plug adaptor, Maplins code AR34M

3. An RJ11 plug to BT master socket adaptor with ring capacitor, Maplins code VD36P

4. An ethernet cable

Install FreeSwitch

FreeSwitch needs to be installed on a machine on your home network. You can install it on pretty much any platform Windows,Linux, Mac etc.

Follow the install guide on the FreeSwitch site.

When you have FreeSwitch installed start it up with the default configuration and use a softphone such as X-lite to check the install. In X-lites SIP Acount settings enter the IP address details for the server you installed FreeSwitch on. Use 1001 as the username and 1234 as the password (this is a default account that comes already set up with FreeSwitch), save these settings and X-Lite should register with FreeSwitch. Now dial 3000 on the X-Lite number pad and you should be connected to the default conference call number on your FreeSwitch server.

Setup the Linksys 3102 voice gateway

For this section I mostly refered to Andrew Oakley’s excellent setup guide in addition to the FreeSwitch SPA3102 HOWTO however I’m regurgitating bits from both here for the sake of completeness.

Firstly as with Andrews guide i’m assuming you already have a wireless broadband router.

Now get out the instructions that came with your SPA3102, put them in a drawer, do not look at them they are evil and will confuse you (disclaimer – read the safety stuff in there first)

Hooking up all the cabley stuff

  • Do not connect the SPA3102 to the mains yet.
  • Unplug your phones/extension wiring from your BT master wall socket (the first BT wall socket where the telephone line first enters your house).
  • Connect your SPA3102′s LINE socket to your BT master wall socket, using either a known-good RJ11-BT cable (eg. an old modem cable) OR using the supplied RJ11-RJ11 cable plus an RJ11-BT adaptor (eg. Maplins code AR34M).
  • Plug the master socket adaptor (eg. Maplins code VD36P) into the SPA3102′s PHONE socket.
  • Plug your BT phone(s) into the master socket adaptor.
  • Check to make sure your SPA3102 is turned off (unplugged from the mains). When turned off, the SPA3102 connects the LINE to the PHONE socket directly, and we are going to test this connection.
  • Lift the phone handset. You should hear a dial tone. Try calling a telephone number. If this doesn’t work, your cabling is wrong.
  • Use a mobile phone to ring your normal home landline number. Your landline phone should ring as normal.If this is all working you can now plug in the power adaptor and turn on the router
  • Connecting the SPA3102 to your network


    Connect an ethernet cable from your computer to the SPA3102′s ethernet socket.

    In a browser go to 192.168.1.1 you should see the SPA3102′s web interface, if not check your computer is set to use DHCP to get its ip address.

    In Router – WAN Setup change Connection Type to Static IP. Change the Static IP, Netmask, Gateway and Primary DNS to the correct values. For instance, on my networks all computers are 192.168.0.something and the broadband router is 192.168.0.1, so I use 192.168.0.7 as my Static IP, 255.255.255.0 as the netmask, 192.168.0.1 as both the gateway and primary DNS.

    click on advanced then WAN Setup again. set Enable WAN Web Server to YES.

    Now Submit All Changes.

    Unplug the ethernet cable you used and reconnect your computer to your home network.

    Use the ethernet cable to connect the SPA’s internet port up to a spare ethernet port on your home broadband router.

    Now from your browser you should be able to connect to the SPA3102 admin panel by using the static IP address you set. In my case 192.168.0.7

    in the SPA web interface Click Admin login – Advanced – Voice – Regional and make the following changes:

    Dial tone: 350@-19,440@-22;10(*/0/1+2)
    Ring back: 400@-20,450@-20;*(.4/.2/1+2,.4/2/1+2)
    Busy tone: 400@-20;10(.375/.375/1)
    Reorder tone: 400@-20;10(*/0/1)
    SIT 1 tone: 950@-16,1400@-16,1800@-16;20(.330/0/1,.330/0/2,.330/0/3,0/1/0)
    MWI dial tone: 350@-19,440@-22;10(.75/.75/1+2)
    CWT1 cadence: 30(.1/2)
    CWT2 cadence: 30(.25/.25,.25/.25,.25/5)
    CWT frequency: 400@-10
    Ring 1 cadence: 60(.4/.2,.4/2)
    Ring 2 cadence: 60(1/2)
    Ring 3 cadence: 60(.25/.25,.25/.25,.25/1.75)
    Ring 4 cadence: 60(.4/.8)
    Ring 5 cadence: 60(2/4)
    Time Zone: GMT
    FXS Port Impedance: 370+620||310nF
    Caller ID Method: ETSI FSK With PR(UK)
    Daylight Saving Rule: start=3/1/7/2:0:0;end=10/1/7/2:0:0;save=1:0:0

    now go to admin->advanced->Voice->PSTN and set the following…

    Proxy and Registration

    Proxy: [FreeSwitch host name or IP]

    Subscriber Information

    Display Name: PSTN Line

    The FreeSwitch user ID

    User ID: 1000

    The FreeSwitch password for the user

    Password: 1234

    Dial Plans

    If you want a different extension than 1001 to be dialed change it here

    Dial Plan 1: (<:1001>S0)

    (xx.) basically means dial on the phone line of the SPA3102

    Dial Plan 2: (xx.)

    VoIP-To-PSTN Gateway Setup

    I want incoming VoIP requests to be dialed on the phone line aka: the (xx.) rule

    Line 1 VoIP Caller DP: 2

    VoIP Caller Default DP: 2

    FXO Timer Values (sec)

    I read some place to set this to 3 for caller ID to work, but I just wanted it to instantly forward and start ringing ext 1001

    PSTN Answer Delay: 0

    PSTN-To-VoIP Gateway Setup

    set PSTN CID For VoIP CID to Yes so that caller-id is forwarded

    FreeSwitch Configuration

    FreeSwitch on linux and Mac gets installed under /usr/local/freeswitch by default, im not sure where it goes on Windows so i’ll use $FREESWITCH_HOME for examples

    Create a file called 00_spa3102.xml  in the directory $FREESWITCH_HOME/conf/dialplan/default/

    The contents of this file are…

    <include>
    <extension name=”To PSTN”>
    <condition field=”destination_number” expression=”(.*)”>
    <action application=”bridge” data=”sofia/internal/${destination_number}@[IP address of your SPA3102]:5061″ />
    </condition>
    </extension>
    </include>

    Edit the file $FREESWITCH_HOME/conf/directory/default/1000.xml

    remove the following lines to ensure the caller id is passed through

    <variable name=”effective_caller_id_name” value=”Extension 1001″/>
    <variable name=”effective_caller_id_number” value=”1001″/>

    Now you can start up FreeSwitch with $FREESWITCH_HOME/bin/freeswitch

    Testing

    You should have a softphone such as X-Lite configured with the user 1001 from when you tested your FreeSwitch install earlier.

    To test everything is setup correctly dial your house phone from your mobile. The call should come through to X-Lite for you to answer.

    Try using X-lite to dial your mobile too, this should also go through.

    Next steps

    When you have everything working your next steps depend on what you want to acheive. Most of the config you’ll need will involve changes to the FreeSwitch dialplan that we created above. A next easy step would be to add a voicemail service, there are examples of doing voice mail amongst many other things on the FreeSwitch Dialplan wiki page

    39 thoughts on “Home VOIP system using FreeSwitch and a Linksys 3102 voice gateway (UK Guide)

    1. Very cool, FreeSWITCH is the best and the future of telephony.

      Keep up the great work ;) .

    2. hello
      How I can run Freeswitch at multihomed environment for 3 ip ?
      I want, that FS learned (on port 5060) 3 ip addresses.
      (server with 3 interfaces)
      Thank you for your answer.

    3. I tried to install on my G4 MMD – OSX 10.5.7.
      I downloaded the tar and ran all the cli instructions. It took sometime to compile and make. However,after all was done there was no /usr/local/freeswitch folder. I then created one and repeat the install/compile instructions and again there was no freeswitch. I did a search and found only the folder freeswitch_1.0.3 with the uncompressed files.

      Do you know where the files are loaded/copied once compiled?

      My goal is to use this older G4 as a pbx server.

      Thanks,
      -Gary

    4. Hi Gary, the /usr/local/freeswitch folder should get created when you do the final ‘make install’ command. Were there any errors when you did this ?

      You might need to do ‘sudo make install’ in case your regular user account hasn’t got permissions.

    5. Thanks, Rob for your response. I was able to install freeSwitch (v1.0.4 xxx) on my mac and got it to work on my internal network.

      Do you know if it is possible to do the following:
      -Create a webhop address on dyndns.org that will allow others from the internet to communicate with your internal pbx.
      i.e. my pbx is on my local network which I should be able to access via port forwarding.

      I have an account setup on dyndns.org where I setup a webhop to point to my account (myVerisionDHCPIpaddres:5060). On my router I forward port 5060 to my computer’s ip, that I have the pbx installed.

      I tried configuring the vars.xml domain to reflect my webhop address and set the softphone setting to match. However, the softphone will only register the UA if I use the local ip address for my pbx.

      Basically, I am thinking since the PBX is a SIP server then I should be able to access it form anywhere on the internet, providing I enter the correct IP address & port (5060), user & password, into the clients that wants access. Am I correct in thinking that this could work?

      Thanks again,
      -Gary

    6. Hi,
      I have similar configuration SPA2102 behind Freeswitch connected to the VOIP provider. One thing that I did not figure so far is how to configure Freeswitch to support MWI indicator on my phone.
      I have decided to lat my VOIp provider to handle voicemail.
      When I am connected with my SPA2102 to the VOIP provider directly, everything is working, but when I am connected through Freeswitch, MWI indicator stop working.
      I suspect I have to somehow configure FreeSwitch to handle MWI event from the VOIP provider and inside MWI event handler to configure FReeswitch to set it for the extension (SPA2102).

      Do you know by chance how to achieve it or may be give me some recommendations how to solve this problem?

      Thank you,

      Svetik

    7. Hello,

      Ive been trying to setup my voip SPA for days but still unable to make it right.

      Please help me. The difference in my setup is that my SPA is natted and have private IP.

      Thanks and more power

    8. For those that need some help please join #freeswitch at irc.freenode.net.

      There are plenty of helpful people over there, and they can answer your questions in real time.

      There is also the mailing list of course :) .

      FreeSWITCH rocks!

    9. Hi Rob,

      I’m trying to get FreeSwitch working as you’ve described.

      I seem to have a fatal problem with the 00_spa3102.xml
      When I enter the file as shown, I FreeSwitch won’t start. If I rename the file until after startup and then do a reloadxml, it reports a warning
      +OK [[error near line 3379]: missing >]

      (I am running under windows). Any ideas what the problem might be and how I can fix it please ? I am very new to FreeSwitch, so any help would be greatly appreciated,
      regards
      Dave

    10. Hi Dave, it sounds like there is an unmatched < bracket in your 00_spa3102.xml file. Try opening the file in internet explorer and it should show you more precisely where the missing > bracket is.

    11. Rob,

      thanks a lot for the reply. I found out what the problem was, self inflicted wound creating the 00_spa3102.xml file. I’ve made some prgress, but have hit a brick wall. I don’t have a VOIP supplier, I’m just setting up VOIP for internal extensions and using the SPA3102 to interface with the PSTN.

      I think that I have followed then instructions as given, but can’t make outgoing calls by dialing the number. I can dial 1000 and get to the BT line, or dial O and get connected to the BT Line by freeswitch, then I can manually dial out. If I try to dial the exernal number from XLite (extension 1001), the Gateway Reports CALL_REJECTED.

      (I can get incoming calls OK)

      Do you have any idea where I could look to try to isolate the problem please ?
      regards
      Dave

    12. Rob – problem solved !

      Anoher self inflicted wound :-(

      I thought that I had copied & pasted the code from this page into the 00_spa3102.xml file. I’d spent ages comparing my file with this page and not noticed that I had somehow changed :-

      <action application=”bridge” data=”sofia/internal/${destination_number}

      to :-

      <action application=”bridge” data=”sofia/internal/$(destination_number)

      With the small font that I am using on my display, I don’t think that I would ever have noticed the typo, but someone very quickly spotted my numpty mistake when I posted in on the freeswitch IRC.

      What a huge difference “(” instead of “{” makes ! !

      Anyway, thanks for the article, it’s working now, so off to play with the mysteries of freeswitch dialplans !

      regards
      Dave

    13. Hi Rob,

      things are working pretty well now, but I have just come accross another wee problem. It’s with DTMF tones, either getting my end (FreeSWITCH) to recognise tones or getting remote parties to recognise DTMF from my end.

      Can you please tell me if you have any problems in these areas ? Are able to control IVR menus when you call out ?

      If don’t see any problems with DTMF, have you modified any of the DTMF settings on the 3102 to make things work for you ?

      regards
      Dave

    14. Hi Dave,

      DTMF is working fine on my setup I haven’t changed the default setting on my 3102 which is set to

      Line 1/PSTN Line – Audio Config

      DTMF Process Info -> yes
      DTMF Process AVT -> yes
      DTMF Tx Method -> Auto

      SIP
      DTMF Relay MIME Type:application/dtmf-relay

      Regional – Miscellaneous
      DTMF Playback Level: -16
      DTMF Playback Length: .1

      From a quick google it seems there are quite a few people experiencing DTMF problems, though i havent had any myself and i do frequently dial up conference calls where i have to use DTMF.

      This post suggests a solution but i’m not sure if it will help

      http://www.dslreports.com/forum/r19579575-SPA3102-DTMF-Tones-not-Recognized-Elp

      I wonder if the SIP phone used is factor in this ?

    15. Nice!

      Just what I was looking for, now let’s see if we can do the same here. Thanks man!

      OT:
      Imagine my surprise when I find that you are aware of Grendizer and Duke Fleet! I was intrigued when I saw “arabic” in your tags list (I myself am half-Arab half-Canadian, married to a half-Arab half-English woman). You now have me trawling the interwebs trying to find more vids :)

    16. Thanks for all these information. They are all very useful. And you are right; the voip system has a lot of advantages and purposes. It can help you save a lot of money.

    17. I think this is such a major plus “If I’m away from home and with internet access somewhere i want to still be able to answer my home phone.”

      Everyone wants this – a landline number which they can answer anywhere. A great money and time saver..

    18. So, does this mean I can cancel my phone service with my POTS, like AT&T? If so, can I keep my plain old phone as long as it is connected to the SPA 3102?

      Thanks!

    19. Hi there! I know this is somewhat off topic but I was wondering
      which blog platform are you using for this website?
      I’m getting tired of WordPress because I’ve had issues with
      hackers and I’m looking at options for another platform. I would be awesome if you could point me in the direction of a good platform.

    20. Have you ever thought about creating an ebook or guest authoring on other
      blogs? I have a blog centered on the same ideas you
      discuss and would love to have you share some stories/information.
      I know my readers would value your work. If you’re even remotely interested, feel free to shoot me an e-mail.

    21. Wow that was odd. I just wrote an really long
      comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m
      not writing all that over again. Anyhow, just wanted
      to say superb blog!

    22. Have you ever considered creating an e-book or guest
      authoring on other websites? I have a blog based on
      the same topics you discuss and would love to have you share some stories/information.
      I know my readers would value your work. If you’re even remotely interested, feel free to shoot me an email. Thank you!

    23. Hmm it seems like your website ate my first comment (it
      was extremely long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your
      blog. I too am an aspiring blog blogger but I’m still new to everything. Do you have any tips for beginner blog writers? I’d
      certainly appreciate it. Regards!

    24. whoah this blog is magnificent i really like studying your articles.
      Keep up the good work! You already know, lots of persons are hunting around
      for this info, you can aid them greatly.

    25. Greetings from Florida! I’m bored at work so I decided to browse your blog on my iphone during lunch break. I enjoy the information you provide here and can’t wait
      to take a look when I get home. I’m amazed at how quick your blog loaded on my phone .. I’m not even using WIFI,
      just 3G .. Anyhow, great blog!

    26. Hey there! I know this is kinda off topic however , I’d figured I’d ask.
      Would you be interested in trading links or maybe guest writing a blog post or
      vice-versa? My blog addresses a lot of the same topics as yours and I believe we could greatly benefit from each other.
      If you are interested feel free to shoot me an e-mail.

      I look forward to hearing from you! Terrific blog by the way!

    27. Appreciating the persistence you put into your site and detailed
      information you provide. It’s nice to come across a blog
      every once in a while that isn’t the same unwanted rehashed information.
      Excellent read! I’ve bookmarked your site and I’m
      including your RSS feeds to my Google account.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>