Friday 20 March 2015

Adding PSTN to LAB

Setting up the lab has been a good exercise, but not being able to interact with the PSTN was disappointing. Fortunately I mentioned this to a colleague and within minutes I had in my hand a Linksys PSA 3102 VOIP Gateway. This is now in my lab and working inbound and outbound from both Asterisk and Lync 2013, so I thought I would document the process.


The PSA itself has 4 ports, Line, Phone, Ethernet, Internet. Software Version 5.1.7(GW), Hardware 1.1.5.


The server running my lab only has two NIC's, one external and one internal, so temporarily to set this up I had to disconnect the external NIC so that I could connect it to the PSA's Ethernet port. I also unplugged my PSTN line from my BIX wall and connected the PSA directly to it via the LINE port.


A few details around getting the PSA up and running. It was a used device with an irretrievable password, so I had to reset to factory defaults. There is no button for this. You need to connect a regular house phone to the PHONE port. When you pickup the phone you go into a prompt. Cisco has the quick start guide on their page for the remaining steps.


PSA Configuration

Once the device was reset, I was able to get onto its Web GUI via 192.168.0.1 and make some configuration changes, many of which I was able to figure out thanks to this excellent post. I set the IP to match my internal network and set the following.

[[Router]]
[Lan Setup]
Networking Service = Bridge
Enable DHCP Server = No

[[Voice]]
[Provisioning]
Provision Enable = No
[Line 1]
Line Enable = No (because I do not have a phone attached to the PHONE port)
[PSTN Line]
Line Enable = Yes
SIP Transport = TCP
SIP Port = 5061
Auth INVITE = No
Proxy = IP of Asterisk Server
Register = Yes
<Subscriber Information>
Display Name = Anything
User ID = 1-pstn (this matches the trunk in Asterisk)
Password = Matches the secret password set on the trunk in Asterisk
Use Auth ID = no
Dial Plan 2 = (S0<:xxxxxxxxxx>) <-- This needs to be your PSTN line # for inbound calls to work
VoIP-To-PSTN Gateway Enable = Yes
PSTN-To-VoIP Gateway Enable = Yes
PSTN Caller Default DP = 2


Asterisk Configuration

Now for the Asterisk configuration, also via WEB GUI.

1. Create a trunk to the SPA

For the Outgoing Settings PEER Details window, enter the following:
allow=ulaw
canreinvite=no
context=from-trunk
dtmfmode=rfc2833
host=dynamic
incominglimit=1
nat=never
port=5061
qualify=yes
secret=Matches the secret password set on the PSA
type=friend
username=1-pstn (this matches the PSA config)

2. Create an Outbound Route to the SPA so that any call coming to Asterisk that matches the dial pattern below will get sent to the SPA.

Dial Pattern = NXXNXXXXXX
Trunk Sequence for matched route = 1-pstn

3. Create an Inbound Route so that you can receive calls from the PSTN that come from the SPA
Description = SPA3102
DID Number = xxxxxxxxxx (Make sure this matches the DID you put into Dial Plan 2 on the SPA)
Set Destination = Wherever you want it to go. I had a 3002 Extension configured in Asterisk and initially sent it there and then I also set up a user within Lync with the DID number and sent it to the Lync trunk which I will cover the setup of in the next part.

To be continued for Lync 2013 configuration...