You are on page 1of 14

HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

HOME SUPPORT COMMUNITY STORE DEVELOPMENT DOWNLOADS ABOUT US


Join
Username * Password * Password?

Home » Documentation » HOWTOs » HOWTO: Linksys SPA-3102/Sipura SPA-3000 +


FreePBX

How to setup a Linksys SPA-3102 or Sipura SPA-3000 with FreePBX

Here is how you can setup Linksys/Sipura SPA-3000 series devices to work with FreePBX. These
instructions were originally written for the Sipura SPA-3000, but are also applicable to the Linksys
SPA-3102.

It took a lot of work to get the SPA-3000 working, but what finally got it working was very simple
setup.

The FXS port (where you plug in your phone) is set up in the normal manner, just as on the
Linksys PAP2 or a Sipura unit. So when you want to set up that port (labeled "Line 1" in the web Quick Nav
interface), just look for instructions for setting up a Line port on a PAP2 or SPA-2000 (such as Blogs
How to set up a Linksys PAP2 or Sipura SPA-2000 for use with FreePBX) - the setup of the FXS
Forums
port is pretty much identical to those devices. What were are concerned with here is the FXO port,
Recent Site Posts
that is, the port that connects to the PSTN telephone line (appropriately labeled "PSTN Line" in
the web interface).
Report Bug/Feature

Before you begin you may want to make sure you have the latest firmware, which at this writing Recent News Posts
may be available at the Linksys site. Note that the old Sipura site (which is now redirected to the Cyber Monday 50% off FreePBX Commercial
Linksys site) implied that if you had 2.0 hardware you had to use 2.0 series firmware. However, at Modules 1 Day Promotion
least two people have successfully upgraded a 2.0.x series SPA-3000 to firmware revision
Happy Thanksgiving! and "post bird" specials from
3.1.10(GWd). No guarantees, but if you are feeling lucky (and can locate the firmware) you may
the FreePBX Team.
want to try it. Of course if you have the 3.0.x series hardware you can definitely upgrade your
firmware. The upgrade will give you some additional settings but will wipe any current FreePBX Official Training - January 2014 - Special

configuration, so you will want to do that first if you intend to do it. You may want to hold off on Holiday Pricing
the upgrade unless you experience problems - that is up to you. FreePBX PHONE APPS (aka REST APPS) BETA

RELEASED!
FreePBX Trunk setup:
More

For the PSTN setup here is what I did to finally get it working.
Recent Wiki Changes
1) Create a new SIP trunk in FreePBX. 4.211.64 Release Notes
FreePBX-Distro-4.211.64
2) For Caller ID I put my inbound DID there since it's from my BellSouth POTS line.
FreePBX-Distro-3.211.63
3) Max channels: I put 1 since it's only one line. This is important because if you don't do this, and Updating FreePBX Official Distro
this trunk is busy, calls may not fall through properly to the next trunk, due to a combination of FreePBX HA-Fencing
bugs in certain versions of Linksys/Sipura firmware, and a bug in chan_sip in some versions of
EPM-2.11.0.1.X
Asterisk. Even with this set, this bug can still bite you if you have an Asterisk version earlier than
Translating FreePBX
1.2.16, the device is in use for an incoming call and the system attempts to use it for an outgoing
call (the max channels logic only counts outgoing channels, not incoming ones).
Fencing - VMware
Fencing
4) Dialing rules, Dialing Wizard and prefix I left blank. (Remembering to keep it simple at the PBXtended OEM Server Setup
beginning will go a long way). If you want to add or strip a prefix you can change the dialing rules More
later. (Note: If you plan to send out calls with the *67 privacy code prefix, after you get the rest of
this working you can go to the page How to set up per-use Caller ID blocking (*67), and
particularly take note of the section at the bottom of the page, "Additional Instructions if you are
using a SPA-3000/SPA-3102 device...")

5) Trunk name: Call this 1-pstn (again, simple). The reason for starting this trunk name with the
digit "1" is an attempt to make it the first sip trunk listed in /etc/sip_additional.conf, which can
help you avoid a strange bug in Asterisk (more on this in the "Additional information" section
below). IMPORTANT - Note that the Trunk Name must match the User ID in the "Sipura
3000/3102 Device Settings" section below, otherwise you may have registration problems.

6) Outgoing settings - Peer settings (don't enter the comments - the text following the semicolons):

disallow=all ;Starting with FreePBX 2.4 this must be the first statement in the peer settings
allow=ulaw

1 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

canreinvite=no
context=from-trunk ; this is needed here - very important.
dtmfmode=rfc2833 ; you can try inband if you have problems accessing your IVR menus
host=dynamic ; or you may use host= followed by a static IP address, SEE NOTE BELOW
incominglimit=1
nat=never ; if Sipura is not on your local network you may need nat=yes
port=5061 ; we use port 5061 rather than 5060
qualify=yes
secret=XXXXXX ; pick a good password
type=friend
username=1-pstn ; must match the trunk name or registration may fail.

NOTE: The original author of this page had written that the host setting should be host=dynamic
and added the comment "IMPORTANT - use this even if you set the Sipura to use a static IP."
However I (wiseoldowl) found that when the Sipura has a static IP address on the same local
network, you can set the host= to that address (example: host=192.168.0.250) and it works fine
EXCEPT that you will get complaints in your Asterisk log in the form "Peer '1-pstn' is trying to
register, but not configured as host=dynamic". If you use the recommended host=dynamic (to
avoid the log entries, or because the adapter really is on a dynamically assigned IP address), then
you probably should use a fairly short registration interval in the SPA-3000/3102 configuration -
see the section below on Sipura 3000/3102 PSTN settings.

7) Incoming settings - User settings

From wiseoldowl: It turns out that these are not needed at all as long as you set the type=friend in
the Peer Settings. The original author of this page had placed some settings in this section but I do
not believe they were actually being used and in fact may have been causing problems. Other
Sipura 3000/3102 configuration pages on the net don't include a User context or User settings so I
strongly advise leaving these blank.

No Register String is used. Click Submit Changes and remember to click the orange bar to
update your system.

FreePBX Outbound Route setup:

You now are ready to setup your outbound routing.

1) Name the route whatever you like. I called my route spa3000; again this is to keep it simple.

2) No password for the route; keep it simple

3) I only want calls to my area code and 911 via this route so under dial pattern I have:

911
305NXXXXXX
786NXXXXXX

The point here is to use dial patterns that will allow only those calls that you wish to go out via the
Sipura - don't just copy the above verbatim!

4) Trunk sequence: I have it going to the trunk associated with the Sipura (SIP/1-pstn) first. Then,
to my Voipjet settings.

5) Submit Changes and remember to click the orange bar for the update.

FreePBX Inbound Route setup:

This is easy to set up, but necessary if you want to receive incoming calls!

1) Give the Inbound Route any name you like, such as 1-pstn or spa3000 - it's totally up to you.

2) For DID number, keep it simple and use the phone number associated with the line connected
to the Sipura. The most important thing to remember is that this must EXACTLY match the
number you put in "Dial Plan 2" while configuring the Sipura, as shown in the instructions below.

3) Skip down to the bottom of the page and set a destination for incoming calls - this can be a
particular extension, your IVR, or any destination you like.

4) Submit Changes and remember to click the orange bar for the update.

Skip the other Inbound Route options for now - once you get it working you can come back and
make changes if you like.

Sipura 3000/3102 Device Settings:

Next you need to setup your actual Sipura 3000/3102 PSTN settings.

The person who originally started this page said, "Ok here is where I was playing for 3 days to get
this part working. It's strange that when I just removed everything and kept it very simple and

2 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

logical it started to work just fine." So if possible, start with a Sipura 3000 or Linksys 3102 set to
the factory default configuration and go from there, because other than the changes specifically
mentioned below you'll probably want the default settings.

To begin the setup, login to the device, click on admin (if prompted, enter "admin" as the
username and the password, if you have set one up), and then click on advanced. Some of the
following settings may not be visible if you are only logged in as a user, or have not clicked on the
advanced link.

Check the RTP Packet Size!!!


VERY IMPORTANT: Before you do anything else, go to the SIP tab. Look under RTP Parameters
and check the RTP Packet Size. Linksys has set this to 0.030 by default, which is not correct for
use on ulaw (G711u codec) connections. Change it to 0.020 instead (or 0.02 on older Sipura
devices). If you don't do this, you may experience strange problems with "choppiness" or random
clicks on some calls but not others, and you may also experience problems when playing Asterisk
sound files. By the way, this applies to all Linksys/Sipura adapters, not just the SPA-3000/3102.

Next go to the PSTN Line tab - I am only putting what needs to change.

1) Sip settings: Just make sure the SIP Port is set to port 5061 (I did not need to change mine).

2) Proxy and Registration:

Proxy: The numeric IP address of your Asterisk box if both the Sipura and the Asterisk box are
on the same local network, or the address of your Asterisk server if it is elsewhere on the Internet.
Make Call Without Reg: Yes
Ans Call Without Reg: Yes
Register Expires: 300 (if Asterisk box is on same local network and you used host=dynamic in the
FreePBX Trunk settings), or see discussion in note below

Notes on Proxy and Registration section: Some people have reported that they had to set Make
Call Without Reg and Ans Call Without Reg to Yes before things would work - it apparently
doesn't hurt anything to change those two settings, and it may save you some grief. Also, if you
used host=dynamic in the FreePBX Trunk settings (as discussed above), then you will probably
want to make the Register Expires: setting something fairly low, especially if the SPA-3000/3102 is
on the same local network as the Asterisk box - for example, Register Expires: 300 would make
the unit re-register at five minute intervals, while a setting of 900 would probably be a good
choice if the device and the Asterisk Server are not on the same local network. The reason for the
shortened timeout is that when you use host=dynamic in the FreePBX Trunk settings, if
registration is lost for any reason (such as a server reboot) then the SPA-3000/3102 will be
inaccessible until the next time it re-registers. This has led some people to conclude that
host=dynamic doesn't work, when in fact it does but is just waiting for the adapter to re-register.

3) Subscriber Information:

Display name: Put something here that will identify this line - this is only displayed on your
phones if you get a call with no Caller ID information (or you don't subscribe to Caller ID). Keep
it at 15 characters or shorter. You could use something like LOCAL PSTN CALL.
User ID: 1-pstn ; very important - this must exactly match the FreePBX Trunk name and username
in the trunk configuration!
Password: XXXXXX (same as you used in FreePBX Trunk settings).

4) Audio Configuration (if you don't see all these settings, you forgot to click on "advanced"):

DTMF Process INFO: Yes


DTMF Process AVT: Yes
DTMF Tx Method: Auto

Note: The DTMF Tx Method is the one you especially need to check if your IVR is not receiving
DTMF from your callers reliably. Also, in this section you may want to check to make sure that
the Preferred Codec is set to the default G711u (assuming you placed "allow=ulaw" in the
FreePBX Trunk configuration as shown above).

5) Dial Plans:

Under Dial Plans it's important not to change the default (xx.) on any except Dial Plan 2. I put it
very simple to go to my inbound so FreePBX takes care of my calls:

(S0<:1234567890>)

Replace 1234567890 with the telephone number of the PSTN line coming into the device. Note
that this must exactly match the DID number in your FreePBX Inbound Route setting for this
device. If the number here and in the Inbound Route don't match exactly, you won't receive
incoming calls.

6) VoIP-To-PSTN Gateway Setup:

This is another important settings section.

3 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

VoIP-To-PSTN Gateway Enable: yes


VoIP Caller Auth Method: None ; use "None" to start, you can change later for added security (see
below).
VoIP PIN Max Retry: 3 ; I did not change this.
One Stage Dialing: Yes ; very important
Line 1 VoIP Caller DP: none
VoIP Caller Default DP: none
Line 1 Fallback DP: none

7) VoIP Users and Passwords (HTTP Authentication):

During the initial setup, leave all of these blank (the drop-downs can be left set to 1). After you get
everything working you can revisit this section to add security, as will be discussued later.

PSTN-To-VoIP Gateway Setup:

Here is another section that made me pull my hair out.

PSTN-To-VoIP Gateway Enable: Yes


PSTN Caller Auth Method: none
PSTN Ring Thru Line 1: no ; I use Asterisk for my routing.
PSTN Pin Max Retry: 3
PSTN CID for VoIP CID: Yes if you subscribe to CallerID service on your PSTN line, otherwise
No
PSTN CID Number Prefix: (Leave Blank)
PSTN Caller Default DP: 2 ; important - here is where it sends the calls to.
Off Hook While Calling VoIP: No
Line 1 Signal Hook Flash To PSTN: Disabled
PSTN CID Name Prefix: (Leave Blank)

Leave everything else in this section blank. We are almost finished now.

9) FXO Timer Values (sec):

Just change 2 items here.

Voip Answer Delay: 0 (The original recommendation was 1, but this can cause a spurious half ring
on outgoing calls, before actual ringing from the called line commences, so 0 is now the
recommended value).

PSTN Answer Delay: If you do not subscribe to CallerID service on your PSTN line, this can be
set to 0. Most users will want to set it to at least 3 so that the incoming CallerID data is captured. In
rare situations you may need a slightly longer delay (5 should be more than enough).

10) PSTN Disconnect Detection:

Skip the PSTN Disconnect Detection section unless you know what type of PSTN disconnect
signal(s) are used on your PSTN line and wish to change the settings so that those signals (and
only those signals) are detected. Generally you should only tweak this section if the Sipura isn't
properly detecting disconnected calls on the PSTN side. The "Disconnect Tone" is by default set to
detect the "fast busy" signal usually sent after a call has ended in North America - you may wish to
tweak this setting if the switch serving your PSTN line sends a different tone after disconnect.

11) International Control

Check the settings here - each country uses different values for PSTN lines. If you live in
Australia, Canada, the United States or most other countries with modern telephone systems you
probably won't have to change anything except perhaps the gain levels, so we'll only deal with
them for now. The default values for both the SPA To PSTN Gain and the PSTN To SPA Gain are
0 (zero), and that's where you should leave them when you're first setting up the SPA-3000/3102.
But just so you know, here's some information on those settings:

If the SPA to PSTN gain is set too low, the parties on the PSTN side of the connection will
probably complain about your volume being too low, or will ask you to speak up or talk closer to
the phone. If it is set too high, however, you are more likely to hear echo, and outgoing calls may
fail because the level of DTMF tones sent by the SPA-3000/3102 will be too "hot" to register
properly at the PSTN switching equipment.

If the PSTN To SPA Gain is set too low, you'll hear low volume levels on PSTN calls. If it's set
too high, the people on the PSTN side of the connection will be more likely to hear echo (they
may hear their own voices echoed back from your end). Also, any echo that has been reflected
back to you will be heard at a higher volume level, and will therefore be more objectionable.

While the default levels are usually adequate, we found that boosting both values up to 3
produced a more "natural" sounding volume level in both directions. However, this is very much
dependent on the characteristics of the PSTN line - if you're on a very short loop, values of 0 may
be adequate for both settings, if on a very long loop you may need to go even higher than 3. The

4 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

valid range is -15 dB to 12 dB in 1 dB increments (but just enter a numeric value, do not enter
"dB" in the text field). If you have actual test equipment available you can fine-tune the volume
settings for best results.

We'll talk a bit more about settings in this section under "Troubleshooting", below. For now, that's
it. Submit and it should register and you should be able to use the PSTN port on the Sipura. Note
that if you used host=dynamic in the FreePBX Trunk setting, the adapter may take some time to
register, and it will not be accessible until it does (as discussed above). If you're in a hurry, you
can power-cycle the adapter to force it to re-register (but make sure that you have first submitted
your changes, and that the adapter's web page has refreshed!).

Troubleshooting

If you are connecting VoIP adapters back-to-back (SPA-3000 PSTN port to a line port on another
device, perhaps because you are wanting to access a line from a commercial VoIP provider that
insists you use a VoIP device that they provide) and if their device ever sends caller ID names
with a single quotation mark, those calls will either simply ring and never answer, or will be
answered but then disconnected after a few seconds, due to a bug in the SPA-3000 firmware. This
problem usually presents itself if the other device is a Cisco ATA-186. You can either have your
provider send you a newer device (they may charge you for this) OR you can disable CallerID
passthru (which will throw away the incoming Caller ID). To do the latter, set PSTN CID for VoIP
CID to NO, and you may as well set PSTN Answer Delay to 0 since there will be no need to wait
for CallerID. A third option involves patching Asterisk itself but that is beyond the scope of this
article (however, see the added comment at the bottom of this article).

If you have problems getting the SPA-3000 to register with your Asterisk box, try setting the
Sipura up on a static IP address instead of letting your router assign it one via DHCP. Go to the
System tab, and the Internet Connection Type settings:

DHCP: No
Static IP: (pick an address on your local network that will not conflict with your router's DHCP
assignments, such as 192.168.0.250)
NetMask: (usually 255.255.255.0 unless you have a large network)
Gateway: (usually either 192.168.0.1 or 192.168.1.1, unless your local net is numbered differently -
for home users, this is generally the same address you use to get to your router's configuration
page)

Skip down to Primary DNS: (you will probably want to put the same address as you used in
Gateway here - usually both functions are handled by your router. Or, you can use a third-party
DNS service such as OpenDNS).

While you are here you may want to set a Primary NTP Server so that your Sipura will know the
time. Usually you can point this to any NTP server on your local network (such as your Asterisk
box) and it will be close enough, but you could also use a public "pool" NTP server. But if you do
this you will also want to set a time zone, and that setting is found under the "Regional" tab at the
bottom of the page (if you have the latest firmware you can also include a Daylight Savings Time
rule). It is NOT necessary to set up a time server to get this unit to operate as a PSTN gateway; I
only mention this so that people who do want to set the time will know where the settings are.

There are two other settings under the PSTN tab, in the International Control section that you
should be aware of if you are having problems. If you can't seem to get calls to go out (and in
particular, if Asterisk reports that there are no circuits available), try setting the Line-In-Use
Voltage to a lower value, such as 15. Some telephone companies use "pair gain" or "subscriber
carrier" equipment to put multiple subscribers on the same loop. If you have the great misfortune
to receive telephone service through such equipment, your on-hook line voltage may be less than
30 volts, and if that is true the Sipura will think the line is always in use unless the Line-In-Use
Voltage setting is lowered. In the U.S.A. and Canada, nominal on-hook voltage is about 45 to 48
volts, and in that situation the 30 volt setting is correct. But if you are "served" using pair gain or
subscriber carrier equipment (or are unsure of the telephone line voltages used in your locality),
you may want to use a voltmeter to measure both PSTN on-hook voltage and off-hook voltage
(the latter being the voltage on the line when a phone is taken off-hook), and set the Line-In-Use
Voltage setting to a value about halfway between those two measured voltages. That's also a report
that a particular fixed cellular terminal designed for making calls over GSM only produces 14
volts on-hook voltage - one user had to set the SPA-3102 Line-In-Use Voltage to 10 to get it to
work properly with that device.

Also, the FXO Port Impedance default setting is 600 ohms is correct for many places in the world.
Some places use 900 ohms. You really should try to find out the standard impedance setting for
the PSTN line you are connected to, since an improper setting can cause some frequencies to be
higher or lower in volume than others. Mismatched impedance can also be a source of echo and
DTMF recognition problems. However, determining the best/most correct setting can be
something of a black art, as this Cisco document illustrates. That said, if you don't know the
correct impedance, the 600 ohm setting will generally work well, especially on loops of about one
mile/1.5 km or less. If you have noticeable echo, try also the 900 ohm setting to see if that reduces
or eliminates the echo.

5 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

Adding security

Once you have it working satisfactorily using the above instructions (test it with both incoming
and outgoing calls), you can try adding additional security - most users seem to have had success
doing this, but occasionally someone has problems, however it's easy to reverse the procedure if
you do have any issues. Go to the adapter's PSTN Line tab and make the following changes:

In the VoIP-To-PSTN Gateway Setup section, change VoIP Caller Auth Method to HTTP Digest.

In the VoIP Users and Passwords (HTTP Authentication) section, change the following:

VoIP User 1 Auth ID: 1-pstn


VoIP User 1 DP: none
VoIP User 1 Password: XXXXXX (same as you used in trunk settings).

After making the above changes test to make sure that both incoming and outgoing calls still work
as expected. That's all the security changes under the PSTN tab.

However, the Sipura's web pages are still wide open (unless you have already set up passwords)
and if anyone on your local network goes there (or someone manages to hack their way in) they
can go to the Sipura's web pages, and see and change all your settings. So you will probably want
to password protect the settings pages. Note that there are separate user and admin passwords -
you can set these in the System Configuration section of the page accessed through the System
tab. BE CAREFUL - take your time and think about what you are doing here, because if (for
example) you make a typo in a password and don't catch it, you could lock yourself out of your
Sipura!

Additional information

If your adapter is at a remote location, or for some other reason you would like incoming calls on
the PSTN line to ring through directly to "line 1" (the phone port) WITHOUT first passing through
Asterisk (but still having the ability to send the call to voicemail if no one answers), set PSTN
Ring Thru Line 1 to Yes, set PSTN Answer delay to whatever number of seconds delay you wish
before the call goes to voicemail, and then set PSTN Caller Default DP to 1 and set Dial Plan 1 as
(<:*extensionnumber@asterisk_ip:port>) - the * in front of the extension number tells FreePBX
to send the call directly to that extension's voicemail without building a inbound route. So,
incoming calls from the PSTN should ring directly into any telephones connected to the phone
port, but if not answered in the specified time they will still get transferred to the extensions
voicemail (thanks to "cyberglobe" for suggesting this in the IRC channel).

The reason we used a trunk name starting with the digit "1" is an attempt to make it the first sip
trunk listed in /etc/sip_additional.conf (which seems to have trunk names sorted
alphanumerically). This can help some users avoid a strange bug in Asterisk. In some versions of
Asterisk, if there are one or more SIP trunks configured and Internet connectivity is lost, it
becomes impossible to place any SIP call, including calls between SIP extensions that are on the
same local network as the Asterisk server (and which therefore should be unaffected by the
Internet outage - sadly, that is not the case)! Note that calls using protocols other than SIP are
unaffected. There have been some reports that if the first SIP trunk (listed in
/etc/sip_additional.conf) is accessible, Asterisk will be happy and continute to complete calls on
the local network. Therefore, we suggested using 1-pstn so that the adapter would be the first SIP
trunk and (assuming it's on the same local network as the Asterisk server) always accessible, even
during an Internet service outage, thereby (hopefully) avoiding the issues when the Internet
connection goes down. If you have more than one adapter, or don't need this attempted protection
against Internet service outages, then you can change ALL instances of 1-pstn to some other
string, but just make sure that ALL instances mentioned above are changed to the EXACT SAME
string (otherwise the adapter will not be able to register with Asterisk).

Other pages with Sipura 3000/3102 setup instructions

Different people have different ways of setting up any particular piece of hardware. Here are some
alternative approaches to setting up a SPA-3000/3102:

Asterisk@Home Handbook Wiki

SPA3102 and FreePBX HOWTO

Voipspeak - Guide to the SPA-3102

Added comment about Caller ID name problem

As mentioned above, if the SPA-3000 receives a CallerID name from the PSTN line that contains
only one quotation mark, the call will fail. This issue, or a very similar one, has been raised in
Digium Issue Tracker report 0007333: Malformed callerid string causes SIP clients to silently drop
packets. The report contains a patch to an older version of callerid.c that MAY or MAY NOT have
solved this problem. It is extremely doubtful whether this patch would work with any recent
version of callerid.c, but if you are a very proficient coder you may be able to figure out how to
do the same thing in a more recent version. We do NOT recommend that anyone attempt to apply

6 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

this patch as shown, it is included here only to illustrate the problem, and one attempt at a
solution:

656c659

< /* Just trim off any trailing spaces */

---

> /* Just trim off any leading spaces or quotes */

658,661c661,664

< while(!ast_strlen_zero(instr) && (instr[strlen(instr) - 1] < 33))

< instr[strlen(instr) - 1] = '\0';

< /* And leading spaces */

< *name = ast_skip_blanks(*name);

---

> while(*(*name) && ((*(*name) < 33) || (*(*name) == '\"'))) (*name)++;

> /* And trailing spaces or quotes */

> ne = *name + strlen(*name) - 1;

> while((ne > *name) && ((*ne < 33) || (*ne == '\"'))) { *ne = '\0'; ne--; }

‹ HOWTO: Free Directory Assistance up HOWTO: MythTV CallerID OSD ›


in the USA

Printer-friendly version Log in or register to post comments

Comments
Your Awesome
I just wanted to say that your document worked to the T. It worked
for my doorebell installation and works great. Thank you Thank
sstevens you Thank you.
Sat, 06/21/2008 -
03:07 -s
permalink
Log in or register to post comments

The way all guides should be


This guide works as advertised. My only issue is with setting the
security to HTTP digest. I get "all circuits are busy" when I
change that setting.

discodave1977
Log in or register to post comments
Sat, 07/19/2008 -
19:29
permalink

Just Perfect. Thx, And One Querry Regarding Caller


ID
It is a lot of work to config even with your excellent guide.
adorah1 However, one problem I faced is that the caller ID of the callee
Sat, 10/11/2008 - didn't pass thru. Is there a way to pass the caller ID from the SPA to
06:19
permalink
the server/extension?

Log in or register to post comments

I have a problem with this box :(


i followed this guide but nothing to do
i think that the registration doesn't work and i don't understand why
rymfiltre (the light of the PSTN on the box remains off) but i am not sure that
Thu, 01/22/2009 is the problem
- 03:07 when i try to call my phone number from my cell phone the box
permalink
transfert the call to the elastix server (i can see on the CLI the
activity and the IVR take the call) but my cell phone continue to ring
it like that the box or the server don't put the two ends call together

7 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

or something like that.


i want to know what did i do wrong ?
thank you for all this very good work and for the quick answer

Log in or register to post comments

Please don't post requests


Please don't post requests for help under the documentation
sections. If you need help post them in the help sections. People do
fskrotzki not go looking under the documentation sections to help people but
Thu, 01/22/2009 read the doc's. Comments are allowed here so that improvements
- 09:40 and additions to the documentation can be added.
permalink

When you ask for help you need to provide us with the information
needed to help you. see http://freepbx.org/forum/freepbx/installation
/so-you-have-a-problem-and-want-help

Log in or register to post comments

i didn't know :)
i am sorry but i didn't know that.

rymfiltre Log in or register to post comments


Sat, 01/24/2009 -
23:39
permalink

host=dynamic
I can confirm that host=dynamic is required, even when the SPA is
statically addressed. At least, possibly, in older asterisks (mine's
tin currently 1.2.17 which I believe is quite old now)
Sun, 01/25/2009
- 17:08 host= just causes the device to be "404 not found" whenever it tries
permalink to register. My SPA is on the same LAN and IP range as the
Asterisk. Although I did not see the log messages mentioned above.

Thanks for this document btw!!!

Log in or register to post comments

Security
OK, great article!! I finally got this thing working. The only issue
I had was that I had to change the settings as shown in the
"Adding Security" section before the SPA3102 would register.

J_Gat Linksys software 5.1.10(GW)


Thu, 04/02/2009 -
13:02 Asterisk 1.4.21.2
permalink
Log in or register to post comments

VOIP Provider (SIP)


Could you expand on your guide to include a setup for Line 1 for a
VOIP provider. Most of the write-ups I have seen on asterisk and
Fala SPA3102 focus exclusively on the PSTN side of things. I have been
Tue, 06/02/2009 at it for a couple of days and cannot get the SIP trunk to registered.
- 16:57
permalink
Log in or register to post comments

The Line 1 tab is either


The Line 1 tab is either very close to or exactly the same as on
a Linksys PAP2 or Sipura SPA-2000, so just use this guide:
How to set up a Linksys PAP2 or Sipura SPA-2000 for use
with FreePBX. And bear in mind, this is a FreePBX
wiseoldowl
documentation site, not a provider support forum, so if you
Wed, 06/03/2009 -
02:17 mean that you are trying to get Line 1 to work with some
permalink provider that's not using FreePBX, you may need to obtain
their suggested settings for a Linksys PAP2 and apply those.

Log in or register to post comments

8 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

It works on spa400 too!!!


I have a Linksys spa400 and it works. Thank you.

jcbb Log in or register to post comments


Wed, 06/03/2009
- 14:49
permalink

Cannot get inbound call


I followed those instructions and got ALMOST working.
My FreePBX box is located in US and SPA3102 - abroad.
Belatra I could not get 3102 registered. I tried all conceivable and
Mon, 09/21/2009 inconceivable ways playing with settings but no success. However
- 23:12 both gateways seem to be working. I can reach any remote phone
permalink
number using VoIP-to-PSTN gateway calling from my extensions.
The party calling to PSTN number gets Asterisk dial tone and can
dial extension number and reach it. So PSTN-to-VoIP gateway is
working as well. The only issue is that no inbound route starts when
SPA3102 calling to Asterisk box. I tried to set the Inbound Route
using specific DID related to SPA3102 I also tried to set
AnyDID/AnyCID - no success. All another trunks working with no
problem.

Log in or register to post comments

help please, I cannot make outgoing calls


Hello world,
I have an Asterisk server in local network, with SPA3102 to the POTS
westial line.
Mon,
12/21/2009
- 04:43 I'm going crazy, a lot of days fighting against it. I have followed this
permalink tutorial and finally I can receive incoming calls.

Little times I can make outgoing calls, but normally, before tone call
hangs. In the destination phones appear the calls like lost call, but
doesn't ring there. Other times "all circuits are busy".

I have tested to decrease the Line-in-use-voltage to 20, and 10, to sync


with my spanish POTS (I have reader in some blog)

Please if anyone can help me... I have nightmares with trunks and
extensions!!

On accept links and complementary tutorials.

My asterisk server is 192.168.2.100 and the spa3102 is 192.168.2.60. The


caller user is the extension 101, bria and x-lite too, softphone

The spa3102 is the same as this tutorial, dialplan


(S0<:POTSlinenumber>)

Results and config:

[root@localhost asterisk]# cat var/log/asterisk/full

[Dec 18 17:10:02] VERBOSE[8278] logger.c: -- Executing [h@macro-


dialout-trunk:1] Macro("SIP /101-095bca58", "hangupcall|") in new
stack
[Dec 18 17:10:02] VERBOSE[8278] logger.c: -- Executing [s@macro-
hangupcall:1] ResetCDR("SIP /101-095bca58", "w") in new stack
[Dec 18 17:10:02] DEBUG[8278] app_macro.c: Executed application:
ResetCDR
[Dec 18 17:10:02] VERBOSE[8278] logger.c: -- Executing [s@macro-
hangupcall:2] NoCDR("SIP/10 1-095bca58", "") in new stack
[Dec 18 17:10:02] DEBUG[8278] app_macro.c: Executed application:
NoCDR
[Dec 18 17:10:02] VERBOSE[8278] logger.c: -- Executing [s@macro-
hangupcall:3] GotoIf("SIP/1 01-095bca58", "1?skiprg") in new stack
[Dec 18 17:10:02] VERBOSE[8278] logger.c: -- Goto (macro-
hangupcall,s,6)
[Dec 18 17:10:02] DEBUG[8278] app_macro.c: Executed application:
GotoIf
[Dec 18 17:10:02] VERBOSE[8278] logger.c: -- Executing [s@macro-
hangupcall:6] GotoIf("SIP/1 01-095bca58", "1?skipblkvm") in new

9 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

stack
[Dec 18 17:10:02] VERBOSE[8278] logger.c: -- Goto (macro-
hangupcall,s,9)
[Dec 18 17:10:02] DEBUG[8278] app_macro.c: Executed application:
GotoIf
[Dec 18 17:10:02] VERBOSE[8278] logger.c: -- Executing [s@macro-
hangupcall:9] GotoIf("SIP/1 01-095bca58", "1?theend") in new stack
[Dec 18 17:10:02] VERBOSE[8278] logger.c: -- Goto (macro-
hangupcall,s,11)
[Dec 18 17:10:02] DEBUG[8278] app_macro.c: Executed application:
GotoIf
[Dec 18 17:10:02] VERBOSE[8278] logger.c: -- Executing [s@macro-
hangupcall:11] Hangup("SIP/ 101-095bca58", "") in new stack
[Dec 18 17:10:02] VERBOSE[8278] logger.c: == Spawn extension
(macro-hangupcall, s, 11) exited non-zero on 'SIP/101-095bca58' in
macro 'hangupcall'
[Dec 18 17:10:02] VERBOSE[8278] logger.c: == Spawn h extension
(macro-dialout-trunk, h, 1) ex ited non-zero on 'SIP/101-095bca58'
[Dec 18 17:10:02] VERBOSE[8278] logger.c: == Spawn extension
(macro-dialout-trunk, s, 19) exi ted non-zero on 'SIP/101-095bca58' in
macro 'dialout-trunk'
[Dec 18 17:10:02] VERBOSE[8278] logger.c: == Spawn extension
(from-internal, 123620798635, 4) exited non-zero on 'SIP/101-095bca58'
[root@localhost asterisk]#

[root@localhost asterisk]# cat sip_additional.conf


;--------------------------------------------------------------------------------;
; Do NOT edit this file as it is auto-generated by FreePBX. All
modifications to ;
; this file must be done via the web gui. There are alternative files to
make ;
; custom modifications, details at: http://freepbx.org/configuration_files ;
;--------------------------------------------------------------------------------;
;

[1-pstn]
disallow=all
allow=ulaw
canreinvite=no
context=from-pstn
dtmfmode=rfc2833
host=192.168.2.60
incominglimit=1
nat=never
port=5061
qualify=yes
secret=xxxxxxxxxx
type=friend
username=1-pstn

[100]
type=friend
secret=xxxxxxxxxxx
qualify=yes
port=5061
pickupgroup=
nat=yes
mailbox=100@device
host=dynamic
dtmfmode=rfc2833
dial=SIP/100
context=from-internal
canreinvite=no
callgroup=
callerid=device
accountcode=
call-limit=50

[101]
type=friend
secret=xxxxxxx
qualify=yes
port=5061
pickupgroup=
nat=yes

10 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

mailbox=101@device
host=dynamic
dtmfmode=rfc2833
dial=SIP/101
context=from-internal
canreinvite=no
callgroup=
callerid=device
accountcode=
call-limit=50

thank you in advance

Log in or register to post comments

my last post SOLVED


Some minuts after write this post I have found the solution:

westial I have disabled "PSTN Line/Detect CPC"


Mon,
12/21/2009
- 06:02
thank's to post http://forums.linksysbycisco.com/linksys/board
permalink /message?board.id=VoIP_Adapters&thread.id=3889

Log in or register to post comments

No inbound route
Thank you so much for this perfect guide!
All works, except inbound route.
Monska I set up this Dial Plan:
Thu, 01/21/2010 (S0<:3333>)
- 08:48 And this inbound route:
permalink
Description: Spa3102
DID Number: 3333
Destination Extension: 4001
But when SPA3102 receive call i don't ear nothing and asterisk cli
write this:
== Spawn extension (from-trunk, h, 1) exited non-zero on 'SIP/1-
pstn-09e5ffd8'
-- Executing [3333@from-trunk:1] Set("SIP/1-pstn-09e5ffd8",
"__FROM_DID=3333") in new stack
-- Executing [3333@from-trunk:2] Gosub("SIP/1-pstn-09e5ffd8",
"app-blacklist-check|s|1") in new stack
-- Executing [s@app-blacklist-check:1] LookupBlacklist("SIP/1-
pstn-09e5ffd8", "") in new stack
-- Executing [s@app-blacklist-check:2] GotoIf("SIP/1-
pstn-09e5ffd8", "0?blacklisted") in new stack
-- Executing [s@app-blacklist-check:3] Return("SIP/1-
pstn-09e5ffd8", "") in new stack
-- Executing [3333@from-trunk:3] ExecIf("SIP/1-pstn-09e5ffd8", "0
|Set|CALLERID(name)=1-pstn") in new stack
-- Executing [3333@from-trunk:4] Set("SIP/1-pstn-09e5ffd8",
"FAX_RX=1010") in new stack
-- Executing [3333@from-trunk:5] Set("SIP/1-pstn-09e5ffd8",
"FAX_RX_EMAIL=monska13@gmail.com") in new stack
-- Executing [3333@from-trunk:6] Answer("SIP/1-pstn-09e5ffd8",
"") in new stack
-- Executing [3333@from-trunk:7] PlayTones("SIP/1-
pstn-09e5ffd8", "ring") in new stack
== Spawn extension (from-trunk, 3333, exited non-zero on
'SIP/1-pstn-09e5ffd8'
-- Executing [h@from-trunk:1] Hangup("SIP/1-pstn-09e5ffd8", "")
in new stack
== Spawn extension (from-trunk, h, 1) exited non-zero on 'SIP/1-
pstn-09e5ffd8'

How i can fix this problem?


Thank's so much, sorry for my bad english.

Monska

Log in or register to post comments

11 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

Spa 8800
Thanks alot, excellent guide!!! , the "keep it simple" theory
worked on SPA 8800 (4fxo,4fxs ports) over a Trixbox -
Shadowkeeper
Thu, 05/13/2010 - sometimes we cant see the simple things in front of our eyes and
01:43 we need someone to guide us where to look
permalink
Thanks Again!

Log in or register to post comments

My sincere and profound thanks!


I tried setting up an SPA-3000 a number of years ago using the
tutorials available at the time and it was extremely confusing and
rymes difficult. On the other hand, this tutorial was concise, accurate, and
Wed, 09/22/2010 effective. I followed it word for word and it all just works. THANK
- 10:05 YOU!
permalink

As a note, it seems that some who expressed problems making this


work were trying to connect to an SPA-3000 that was not on the
same local subnet. Chances are that your problems were not with
the configuration, but with NAT traversal. I would HIGHLY
RECOMMEND that you try this first with the Sipura device on the
same subnet and get it working that way. Then, once you have it up
and working on the local subnet, you can place it remotely and fight
with NAT settings. At least that way you will know that the Sipura
and FreePBX configs are correct and that you have a
connectivity/NAT problem.

Tom

Log in or register to post comments

Some additions to this guide


This great guide worked for me. I just wanted to add several quick
observations:
AdHominem
Sun, 03/13/2011 - 1. If, in the Freepbx Trunk settings for the SPA3102 Trunk, you use
23:09
permalink Host=Static IP Address of SPA3102

Then it is not necessary for the SPA3102 to register to your


FreePBX at all. The purpose of "registration" is to supply you PBX
with the SPA3102's IP address. If you've already done that,
registration is irrelevant. In fact, you can go to the PSTN tab on the
SPA3102, and under "Proxy and Registration" and change
"Register" to "OFF."

2. If you are routing your calls through Freepbx, the the best dial
plan to use on the SPA3102 for Line 1 (on the Line 1 page) is:

(*x.| xx. | 0. )

The first part of the plan allows feature codes (like *72, etc) to
work. The second one allows any regular numbers to work. The
third entry allows users to dial 0.

Why not just use x., without the two x's? Because if you do, the
dialing timeout timers won't work properly. Don't ask why, they just
won't. If you just use (x.), the SPA3102 will always use the
interdigit short timer, even if you haven't dialed anything. This
leads me to my next point.

3. You can change how long the SPA3102 waits for you to dial on
the regional page. If you set your dial-plan as I suggested above,
the

Interdigit Long Timer:

Is how long it will wait for you to dial the very first digit.

The

Interdigit Short Timer:

12 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

Is how long it will wait for you to dial *AFTER* the first digit.

NOTE: If you set your dial plan to (x.) or (.), the SPA3102 will only
wait for the short timer period, even if you haven't dialed anything.

4. It is usually wise to go to the regional page and delete all the *


codes under "Vertical Service Activation Codes." Many of them
intefere with the * codes used in FreePBX.

5. There is a new undocumented feature on the regional page. At


the very bottom, the "More Echo Suppression:" option has proven
useful to some people in getting rid of echo problems.

Other stuff that I've written:


Prepaid Wireless FAQ: http://goo.gl/CkZcf - Straight Talk Wireless
FAQ!: http://goo.gl/Sn0Pk
Choosing the best Wifi Channel: http://goo.gl/0s3Rj

Log in or register to post comments

Thanks a Lot !!
I followed your guide , it worked first time.

nbowling Log in or register to post comments


Mon, 05/09/2011
- 06:37
permalink

My sincere and profound thanks too!!! But CID


= SPA's user id
Thank you very much for this amazing guide.
newbefreepbxuser
Mon, 01/16/2012 - 05:16 I need to use my SPA-3102 for receiveing calls from an
permalink analog line to my Freepbx (Asterisk).
I'm still having problems with the Caller ID.
If I connect a telephone directly to the line, the CID is ok.
But when I connect the 3102, the CID doesn't reach my
asterisk, and I get the SPA's user id instead of the correct
CID.

I've tested all settings that people comment, but still doesn't
work.
Sometimes after many attempts the CID apears OK in my
Cisco SPA504G (inbound route directly to my extension just
for test),and then instead of getting the caller's CID, I get
again the SPA's user id ...

Any suggestions will be highly appreciated.


Thank you very much.

Nice to share knowledge...

Log in or register to post comments

SPA 3102 ring and dial


Hy all,
I have setup my SPA3102 with 3.3.6 firmware , to use with my
achim_alexandru asterisk server.
Mon, 03/12/2012 - I setup a new outgoing trunk , following the specification on
08:33 this page.
permalink
But there is a litle problem : the asterisk dial out ok to
SPA3102 , but the device don't notify asterisk if is ringing , just
open channel directly even on PSTN line is really ringing.The
user , ok , hear ringing , but asterisk open channel and is
counting the seconds..wich is not good :)
Thanks a lot
Alex

Log in or register to post comments

Spa3102 and PBX behind NAT and PSTN Line1


registration Failed

13 of 14 03.12.2013 12:29
HOWTO: Linksys SPA-3102/Sipura SPA-3000 + FreePBX | FreePBX http://www.freepbx.org/support/documentation/howtos/howto-linksys-s...

paradigm thanks for your solution.I tested on the LAN and was OK. But when
Tue, 06/26/2012 devices are behind NAT as you mentioned, there is a PSTN Line
- 14:36 registration problem.my PBX is behind the router (Mikrotik router)
permalink
with static IP and dstnat to my PBX.but my SPA3102 get a dynamic
IP from ISP. I did not change any configurations mentioned above .
but the PSTN Line Trunk did not register. would you please give
some recommendations about this situation on the WAN .
thanks

Log in or register to post comments

SPA-3102 SIP to PSTN not working


My SPA IP 192.168.1.102 (WAN IP)
Settings "PSTN Line" as recomend in the forum.
chinthake
Mon, 10/22/2012 I am sending sip invite
- 19:50
permalink XXXXXXX@192.168.1.102
port 5061

Call establish when I check SIP signalling but call not coming out
from PSTN.

Log in or register to post comments

PSTN Line 1 Registration Failed


Hi guys,
I made all the settings as shown. Sincerely work both outgoing calls
costaxs that incoming calls but I see PSTN Line 1 Registration Failed.Can
Mon, 03/18/2013 someone explain why this happens?
- 15:24
permalink
Log in or register to post comments

Support Community Store Development Downloads About Us


Paid Support Blogs & News Paid Support Plans FreePBX Issue Tracker Download FreePBX Trademark Policy
Training Forums FreePBX Appliances Distro Issue Tracker FreePBX Distro Screenshots
Forums Wiki Training Get Involved Privacy Policy
Wiki Distro Installation VOIP Services Roadmap Terms of Use
Videos Distro Upgrades Commercial Modules Sponsors
Distro First Steps OEM Program History
Reseller Program Hosted FreePBX
Certified Manufacturers Sign Up for Portal

Copyright © 2013, Schmooze Com Inc FreePBX is a Registered Trademark of Schmooze Com Inc All Rights
Reserved.

14 of 14 03.12.2013 12:29

You might also like