howto

You are currently browsing articles tagged howto.

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