How to set up a Linksys PAP2 or Sipura SPA-2000 for use with FreePBX

How to set up a Linksys PAP2 or Sipura SPA-2000 for use with FreePBX

Please note that the following assumes that you have a fully functional SPA-2000 or PAP2 that is not locked to any provider.

Step 1: Make sure your adapter is plugged in, connected to the Internet, and that you know the IP address of the adapter on your local network. If you don't know the IP address, you can connect a phone to the Line 1 port, pick it up and dial * * * * (star key four times - try again if it doesn't work the first time) and wait to hear "(Sipura) Configuration Menu", then dial 110# and it will tell you its IP address. Ignore any busy signals or other tones you may hear during this process.

Step 2 (optional but recommended for the PAP2 only - may also work with a SPA-2000 but probably will NOT work correctly with any other model Linksys or Sipura adapter): Go to the page at the "ILovePAP2" site entitled How to perform PSEUDO Factory Reset and follow the instructions there (the instructions are also mirrored in this post). One reason to use this method is that if you happen to have an adapter that was formerly locked to a particular provider, this procedure should not cause it to revert to its previous locked status. N.B. For the more technically astute, note that you could use this XML file as a starting point for building your own custom XML configuration file, but that is beyond the scope of this article. Also, if you are configuring a different model adapter you can look at this file (or load it into an XML file editor) to at least see what the defaults are supposed to be.

Step 3: Make sure you have Javascript enabled in your browser. Go to the adapter's web interface, go to the admin login (which should not require a password at this point), and then switch to advanced view. We will now visit each of the significant tabs in order.

Step 4: Click on the System tab - the defaults are probably okay but you may want to change the time servers to something more appropriate to your part of the world. Go to Public NTP Pool Time Servers and you can find addresses of time servers that are closer to you. As an example, in the United States you might use as the primary and as your secondary. Of course, if there is a reliable time server on the same local network as the adapter, you could point the adapter to that server.

Step 5: Click on the SIP tab. Here all the defaults should be okay with ONE exception. The default of 0.030 for the RTP Packet Size is WRONG for use with the G711 (ulaw or alaw in Asterisk) codecs. Change it to 0.020 at a maximum. If you plan to try and send any kind of data over the adapter (FAX, satellite receiver or TiVO phoning home, etc.) then you may even want to try 0.010 for this setting (note, however, that using the lower value will increase bandwidth usage). If you don't change this and you use the G711 codec, you may hear unnecessary clicks or other noise during calls. This setting applies to all codecs, and lowering the value will increase bandwidth usage but will also yield better sound quality. Keep in mind that bandwidth is probably not an issue if your adapter is on the same local network as your FreePBX server. If you would like to read a discussion of this issue, see this thread at

Step 6: Assuming you did step 2, you should not need to change anything under the Provisioning tab. However you may want to check and make sure that Provision Enable is set to No.

Step 7: Click on the Regional tab: There is quite a bit here that you may wish to change, in order to provide service that better emulates regular wireline telephone service, but several of these are NOT essential settings, and none of them in any way affect call quality. Most of these suggestions were lifted (with slight modification) from the page How to Distribute VoIP Throughout a Home:

In the U.S. and Canada, under Ring and Call Waiting Tone Spec, the Ring Waveform should be set to Sinusoid, the Ring Voltage should be set to 90 and (this is most important) the Ring Frequency to 20 — this not only allows older phones with mechanical bells to work, but it just might help in a few odd cases where Caller ID doesn't seem to work properly on a particular phone. In fact, if you have any weird problems with equipment that worked fine with traditional phone service not working with VoIP, and that equipment is activated by a ring signal, this may be the problem. Linksys and Sipura adapters default to a ring frequency of 25 Hz, which is NOT the frequency usually used in the United States and Canada.

Under the Control Timer Values (sec) section, we suggest setting the Interdigit Long Timer to 20, especially if you also lengthen the dial tone as explained below (it would probably be a good idea for the Interdigit Long Timer and the Dial Tone to be the same length). We also suggest setting the CPC Delay to 10 and CPC duration to 1, because if you have one or more phones with a "hold" button and you ever put a call on hold and then no one picks it up, this will release the hold (freeing the phone line) when the caller hangs up. Note this will not help if you accidentally leave an outgoing call on hold — at present the Linksys/Sipura doesn't have any good way to release outgoing calls accidentally left on hold automatically (perhaps Linksys might consider adding this in a future firmware release — it would great if they would add an "Off Hook Warning Disconnect" signal, which would be like a CPC disconnect, except that it would activate just before the Off Hook Warning Tone plays).

Lengthen the dial tone to 20 seconds (some people find the default 10 seconds too short): Change Call Progress Tones | Dial Tone to 350@-19,440@-19;20(*/0/1+2) — if this results in a dial tone that is too low in volume, change the two instances of @-19 to @-16

Lengthen Second Dial Tone, Outside Dial Tone, Prompt Tone, Busy Tone, Reorder Tone, MWI Dial Tone, and Cfwd Dial Tone to 20 seconds: These settings, like the basic dial tone mentioned above, are under Call Progress Tones - in all the existing strings find ;10( and change it to ;20(

Slightly increase the volume of the Call Progress Tones (such as Dial Tone, Second Dial Tone, Outside Dial Tone, Prompt Tone, Busy Tone, Reorder Tone, MWI Dial Tone, and Cfwd Dial Tone): Once again, look under Call Progress Tones - in all the existing strings in that section, find all instances of @-19 (or @-nn where -nn is any negative number less than -16) — note that there will often be more than one instance per line — and change it to @-16 — if that is too loud, try a lower value such as @-17 or @-18 etc., if it is too soft, try a higher value such as @-15 or @-14 etc.

Left a phone off hook accidentally? Found that the adapter's off hook warning tone borders on pathetic? Here's a much better one. This gives you 30 seconds of warning warble tone followed by 30 seconds of the genuine off hook warning tone used by most phone companies: Change Call Progress Tones | Off Hook Warning Tone to 480@-10,620@-16,1400@0,2060@0,2450@0,2600@0;30(.2/0/1,.2/0/2);30(.1/.1/3+4+5+6)

Note that if you want the off-hook warning to continue indefinitely until the phone is placed back on the hook, rather than shutting off after 30 seconds of the loud tone, use this instead: 480@-10,620@-16,1400@0,2060@0,2450@0,2600@0;30(.2/0/1,.2/0/2);*(.1/.1/3+4+5+6)

If you want a phone to ring for more than one minute (the default before a Sipura adapter returns a 480 "Temporarily not available" code to the switch) then look under Distinctive Ring Patterns at the Ringx Cadence settings (e.g. Ring1 Cadence, Ring2 Cadence ... Ring8 Cadence) and change the number of total seconds, which is the number prior to the left parenthesis. For example, by default, the Ring1 Cadence is set to 60(2/4) which means "60 seconds of ringing, 2 seconds on followed by 4 seconds off." If you change the 60 to a higher value, such as 180, then the line would ring for a longer time (in this case three minutes) before failing the call. Note, however, that this setting will have no effect on any other process that might intercept the call (such as a transfer to voicemail before the timeout ends).

If the people you are talking to sometimes complain that they hear their own voices echoed back to them, try changing the FXS Port Output Gain to a slightly lower value. For example, if it is currently set to -3, try changing it to -6 or -9. This will lower the volume that you hear in your telephone's receiver so if you set this too low, you'll have difficulty hearing people, which is why we suggest making only small changes. Note that if you have a telephone with a receiver volume control and you have this set on "high", try turning it down to the "normal" setting and see if that fixes the problem first, before you change this value on the adapter.

If you sometimes hear your own voice echoed back to you, try changing the FXS Port Input Gain to a slightly lower value. For example, if it is currently set to -3, try changing it to -6 or -9. This will lower the volume of your speech going out, so if you set this too low, those you call will have difficulty hearing you, and/or touch tones you enter on your phone's keypad will not be recognized. Unless you are having severe problems with your voice echoing back to you, we don't suggest setting this below about -6.

If you have an answering machine or similar device that accepts touch tones for control functions, and you find that when you call in and try to use tones to activate the unit it does not respond properly, check under the Miscellaneous section to see what the DTMF Playback Level and the DTMF Playback Length are set to. The default DTMF Playback Level is -10.0 which is often too low, while the default DTMF Playback Length is .1 which is very often too short.

In addition to the above, when using an adapter with FreePBX I suggest clearing out the existing Vertical Service Activation Codes (removing the existing *nn codes) for the following settings (because you want FreePBX to handle these functions, not the adapter):

CW Act Code
CW Per Call Act Code
Block CID Act Code
CID Act Code
CWCID Act Code
Dist Ring Act Code
Attn-Xfer Act Code
CW Deact Code
CID Deact Code
CWCID Deact Code
Dist Ring Deact Code
Conference Act Code

Finally, if you are in the United States (and probably Canada) and your location observes Daylight Savings Time, the Daylight Saving Time Rule should be:


Google is your friend for finding the correct rules for other parts of the world. That also applies to things such as Dial and Busy tone frequencies, etc.

Step 8: The Line 1 and Line 2 tabs are pretty much set up the same way (assuming both will go to your Asterisk box). The defaults here are fine except for the following:

Under Network Settings, you may want to stick with the default settings during initial setup, but there is one setting in particular that you may be able to tweak for better performance. According to user DracoFelis, writing in this thread,

..... no matter what you set [the Network Jitter Level] to you will be using the same amount of bandwidth. So the trade-off here, is better sound quality (and less "latency"/echo in the call) if you have a "low jitter" ISP connection, vs being more "conservative" with jitter (at the expense of possible "sound breakup") ..... While it is true that a setting of "low" results in the lowest possible latency/echo (which is "a good thing"), I started having problems with "stuttering sounds" (fraction of a second drop-outs of sound) when I used the "low" setting. So I boosted my setting to "medium" which helped (but didn't eliminate the effect), and eventually put it back to the default of "high" (which works reasonably well with my ISP). Granted, I lost the lower latency/echo that I gained by setting it to "low", but using a setting of "high" also caused me to lose the constant "stuttering" on my VoIP line! So lowering the "Network Jitter Level:" setting is clearly a YMMV setting. It's worthwhile trying, because it will lower latency/echo, but be prepared to set it back up if/when you start getting "stuttering" on the line...

Note that getting the Network Jitter Level right could easily make the difference in whether a data device (FAX machine, satellite receiver or TiVO phoning home, etc.) is able to communicate successfully most of the time. If you find such devices are having problems communicating try a higher jitter level setting - data devices can usually tolerate small delays (latency) much better than actual gaps in the signal.

Under SIP Settings, for Line 2 only change the SIP Port from the default 5060 to 5061 (make sure you also change this on the FreePBX extension configuration page associated with that line). Although multiple devices on the same local network can use the same port with no conflict, you can't use the same port for both lines of the same device if they are connecting to the same server.

Under Proxy and Registration, set the Proxy to the address of your Asterisk server. This should be the dotted IP address if the server is on the same local network, otherwise use the hostname associated with your server. Also, I personally like to set Register Expires to something less than the default 3600 seconds (one hour) because if you have to take your server down, that's potentially how long it might be before the device re-registers. On a local network there's nothing wrong with having it re-register every 300 seconds, but for an external device you may want to set it to something a bit longer, like 900 or 1800. If you have issues with the adapter frequently losing registration and then re-registering, try lowering this value. Note that there are a very few routers that don't "play well" with a PAP2, so if you find that you need to use a very low value for Register Expires (under 300 seconds, particularly if 60 seconds or less), that might indicate that you need to tweak some settings in your router, or even possibly consider replacing the router with something a bit more "VoIP friendly."

Under Subscriber Information, set the Display Name to whatever you like (FreePBX won't use this), and the User ID to the FreePBX extension number. The password must match the "secret" on the FreePBX extension configuration page.

Under Supplementary Service Subscription, I suggest that you set the dropdowns for the following services to No (because you want FreePBX to handle these functions):

Block ANC Serv
Cfwd All Serv
Cfwd No Ans Serv
Cfwd Last Serv
Accept Last Serv
Call Return Serv
Speed Dial Serv
Service Announcement Serv
Block CID Serv
Cfwd Busy Serv
Cfwd Sel Serv
Block Last Serv
DND Serv
Call Back Serv
Secure Call Serv

Note the above are just suggestions for a basic setup - if you know what you are doing and have a good reason to leave one or more of these enabled (or to disable something I didn't mention), by all means do so.

Under Audio Configuration, the defaults are fine except that you may have to tweak the DTMF Tx Method. I have found that INFO seems to work the best. If you have problems accessing services that require touch tone input, I would suggest trying INFO first, then Auto, then InBand (on a SPA-2000 you may also have the option to use InBand+INFO, which seems to work well in some situations, but that setting seems to have disappeared from the PAP2). Keep in mind that InBand probably won't work very well, if at all, with a highly compressed codec, so if you have to resort to using InBand I suggest using only G711u (the default) or G711a as your Preferred Codec - also note that when you use InBand you must change the dtmfmode setting on the associated extension configuration page from rfc2833 to inband, or you will lose the ability to control internal FreePBX functions (such as voicemail) that rely on touch tone input. Note that your FreePBX trunk settings can also affect the passing of touch tones, so if INFO doesn't produce the desired result I'd first check to see if you need to set the dtmf and dtmfmode options in your trunk settings (for example, with one provider I have to add dtmf=inband and dtmfmode=inband to the trunk PEER details before I can reliably access services that rely on touch-tone input). A good tactic to resolve where the problem lies might be to first set up a SIP softphone and configure your trunk so that it will reliably pass tones sent from the softphone, then if necessary try different settings for the DTMF Tx Method in your adapter. I've even seen a situation where setting a trunk to use a different switch from the same provider made tones passed using INFO somewhat more reliable, although ultimately we had to fall back to InBand to get tones to pass reliably via that provider. Sorry, there's just not a single DTMF Tx Method that works reliably in all situations.

Under Dial Plan, I suggest that you set Enable IP Dialing to No. There is some controversy over the Emergency Number field, which only appears in later firmware revisions. Some have suggested that if you place your emergency services number (such as "911") in this field, then when you dial that number it will not allow you to hang up the line until the other end disconnects. If this is true (and I have not tested it), it would be an attempt to emulate how 911 service works in the United States on a PSTN line. But since no one can seem to find documentation on this from Linksys, I can only speculate how it works.

As for the Dial Plan - you will probably want to change it, but to what? This depends on your needs and on how you have FreePBX configured. On our system we do not require a dial prefix for ANY call, and allow the user to just dial the number for calls to any extension. We also allow calls to Free World Dialup numbers (five or six digits in length). This is the plan we've been using:


This first makes an exception for 911, delaying only two seconds after it is dialed (the reason for any delay at all is in case one is dialing a FWD number that happens to begin with 911). Then seven digit or eleven digit numbers that conform to the U.S./Canada numbering plan go through with no delay. Then comes an exception for *67, which goes through immediately - you probably do NOT want that one unless you have implemented the procedure described in How to set up per-use Caller ID blocking (*67). After that is a generic catch-all for every other pattern of two digits or more, which provides for a four-second delay after dialing each digit to see if you are going to dial any more digits (which can be bypassed by hitting the # key after dialing the complete number).

I do NOT suggest you copy the above dial plan verbatim - it's just an example to show you how the various parts of the plan, separated by the | character, are used to define the patterns you want to recognize. When learning how to construct dial plans, Google is again your friend (just be careful that the information was written by someone who knows what they are talking about). You could try a Google search for Linksys "Phone Adapter Administration Guide" (include the quotes where shown), you may find a PDF file that describes all the nuances of setting up a dial plan.

Under FXS Port Polarity Configuration, you don't need to change anything here but some people may wish to set Caller Conn Polarity to Reverse. All this will do for most people is give you an audible "click" when a call you place is connected, and again when the called party hangs up. What it actually happening is that the polarity of the line is reversed when the outgoing call is connected. Some advanced phone systems may be able to use this information to avoid the "line left on hold" problem, but most "hold" buttons on telephones will NOT release just because line polarity reverses (if you are handy with electronics, you may be able to build a circuit that responds to polarity reversals and generates a CPC disconnect signal after a polarity reversal). Also, if you want the line polarity to reverse when you are the called party (so you hear a click when the caller hangs up, perhaps), then you will want to set the Callee Conn Polarity to Reverse.

Step 9: The User 1 and User 2 tabs are set up the same way (assuming both will go to your Asterisk box). The defaults here are fine except that under Ring Settings, you may want to set the VMWI Ring Splash Len to .5 (that is, one-half second). But if you don't want your phone to give you one-half second rings when you have voicemail waiting, then leave this blank or set it to 0.

Step 10 (optional): For added security, you may wish to return to the System tab and set an "Admin Passwd" and "User Password". I have mixed feelings about this for a couple reasons. First, no effort is made to verify the typed passwords, so if you mistype your password in these fields, you could lock yourself out of your device. Second, in most cases you are not going to expose the device's web interface outside your local network. On the other hand, setting passwords here could keep others (employees, family members, a hacker that happens to get into your local network, etc.) from messing around with the device - however, in the event your local network is broken into, I suspect you'll have larger problems than messed-up settings on a VoIP adapter!

Hopefully this information will get you going. If you think I have a wrong value anywhere, or have left out anything that should be included, please leave a comment. I would especially be interested in any comments by those who have found through experience that certain changes improve performance over Internet connections with high latency and/or jitter.