SPA3102 FreeSwitch HowTo

From FreeSWITCH Wiki

Jump to: navigation, search

This is a minimal how-to configuration on setting up a SPA3102 with FreeSwitch so incoming calls will be forwarded to FreeSwitch extension 1001 and will show the incoming call as FreeSwitch extension 1000. Any rule that does not match the dialed number will be dialed on the SPA3102 (aka: not ext 5000, 9999, 1000-1019 ...).


Contents

SPA3102 HowTo ASSUMPTIONS:

You have the default SPA3102 configuration (Factory defaults) with web access enabled

You have the initial FreeSwitch install


SPA3102 DEVICE CONFIGURATION:

NOTE: There is a bug in the default configuration of the SPA-3102 and other Linksys devices that sets the RTP Packet Size to .030, this should be set to .020 to avoid problems.

admin -> advanced -> Voice -> PSTN


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

If you do set this value to 2 or 3 (long enough to wait for caller id lookup), any call with a caller ID name which contains commas (or any other character that should be escaped) will cause FS to send a 400: Bad From: Header back to the SPA with very little to show for it, don't even see it on the fs_cli without cranking sofia debug up. I found it by setting up the SPA to log to a syslog server and getting a TP Parse Error: 32 from the SPA in the logs. The only way I've worked around it thus far is using nfqueue on linux. A script and some tools for doing this are available at: http://gitorious.org/spa3102-invite-packet-scrubber

Inbound PSTN caller ID

If you have read and understood the above warning about the SPA3102 messing up on any PSTN call with a comma in the CID data but you still want to have PSTN caller ID data passed to FreeSWITCH, change the following setting from its default 'no' to 'yes':

PSTN CID For VoIP CID: yes

This setting is on the same page as the FXO Timer value above. Note that you'll need that 3 second "PSTN answer delay" setting for the SPA3102 to get CID data from the PSTN.

RTP Packet Size Setting

When you make outbound call using analog phone attached to the FXS port and the person you call hears choppy voice then you should do the following:

admin -> advanced -> Voice -> SIP

RTP Packet Size: 0.02

International Control

Note:When dialing out if you get a SIP 503 error ([CS_CONSUME_MEDIA] [NORMAL_TEMPORARY_FAILURE]) when dialing out check the Voice->info tab for 'Line Voltage'. I have seen reports where it is as high as 48V, but in my case it was 22V idle, and 6V-7V in use. I got the in-use voltage by calling in then checking the info page again. It defaults to 30V, so I assume it thought the line was always in use (though dial-in still worked) so it would give the 503 error. You may or may not need to change this but changing this to 10V fixed my error.

Line-In-Use Voltage: [value between idle and in-use voltage]

FreeSwitch CONFIGURATION:

The (.*) will match on any number of numbers, there are many examples on how to limit it

edit: conf/dialplan/default/00_spa3102.xml

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

If you want to get the caller ID from the PSTN for incoming (PSTN->SPA3102->FreeSwitch) calls, make sure you remove the

      <variable name="effective_caller_id_name" value="Extension 1000"/>
      <variable name="effective_caller_id_number" value="1000"/>

from the extension definition (1000.xml in this example).

***** Now would be a good time to test your setup before securing it *****

SECURITY:

I have my SPA3102 in bridge setup on a corporate LAN with over 5000 people and my server only accepts low profile PCI cards which I don't have an extra Ethernet for, so I have a security section here to explain my way of locking it down.

There are 3 ways to lock it down, make it so someone trying to dial out has to put in a PIN, HTTP Digets, and IP restriction. The first way is easy enough to set up, sadly it requires that you wait for 3 beeps, put in your pin, then di the actual dial out. HTTP Digest could be setup if you setup a gateway, after 30 minutes I gave up, but perhaps someone could update this how-to some day. The last method be locking by IP seemed the easiest.

NOTE: I have not tested this IP blocking security, but should work in theory. When I do get around to testing it I will update this page

Voice -> PSTN Line

SIP Settings

This one confused me but found some place that it means to only allow the proxy IP/host to connect to the device

Restrict Source IP: yes

VoIP-To-PSTN Gateway Setup

Comma separated list of allowed hosts, shoudl not be needed with the Restrict Source IP set to yes

VoIP Access List: [Freeswitch IP or hostname]
Personal tools
Community
Support FreeSWITCH