It's time for my final installment of this tutorial, finally what we've been heading towards -
calling from a cellphone via a cheap PSTN (Public switched telephone network) in simple words, land line.
I assume you have:
- The SPA3102 unpacked and ready to setup.
- A router which has at least a one free RJ45 jack.
Setting SPA3102 IP
The first thing that needs to be done is to setup a LAN IP for the SPA3102 so trixbox
will be able to access it directly through LAN.
- Connect the SPA3102 to a power outlet.
- Connect the RJ45 supplied with the SPA3102 via the Ethernet jack and to a computer:
- In the computer, open up a browser and go to the SPA's Web based
configuration UI via http://192.168.0.1 - Once there, click Wan Setup and then Advanced at the top of the page:
- Once in Wan Setup make the following changes:
- Connection type - Static IP, the IP entered here will remain permanent.
- Static IP - An IP of your choosing which matches your router's IPs,e.g, my router gives IPs formatted 10.x.x.x (due to the netmask255.0.0.0 and it's gateway),
I chose 10.0.0.8. - Gateway - Your router's IP, to figure that one outyou can type
ipconfig in cmd and get the Default Gateway from
the NIC you're getting your network from. - Netmask - Match to your router's netmask, mine is 255.0.0.0
- Enable WAN Web Server - Set this to Yes since we'll need access to the web ui.
Click the Submit All Changes when done: - Disconnect the RJ45 cable from both the computer and the SPA.
Reconnect the cable in the following manner:
From the SPA's Internet jack to a free ethernet
port in router:
When this is done, test out the connection, try and access from your browser
to the IP you've setup e.g http://10.0.0.8.
In case you fail, redo the steps above.
NOTE: If you by mistake misconfigure you SPA3102 and unable to connect to it at all you can reset it using a phone - connect
a phone to the phone jack in the spa, and hit **** 73738# 1
this will reset the device.
SPA 3102 Configuration
Now we're going to configure the SPA3102 so asterisk will be able to connect to it.
- Open a browser and go to http://[your-spa3102-ip]/admin/voice/advanced (e.g http://10.0.0.8/admin/voice/advanced) or alternatively
go to the Voice tab, then choose Admin Login and Advanced on the top right corner of the page: - Now, we need to disable the port which corresponds to the phone jack in the SPA
because we don't want to get any connected phone ringing when a call comes in.
Go to the Line 1 tab and set Line Enable to No: - Head into the PSTN Line tab and set the following settings:
- Proxy and Registration
- Proxy - This is the trixbox IP you've setup in section 2 of this tutorial, mine is 10.0.0.4.
- Ans Call Without Reg - Set this to yes.
- Dial Plans
- Dial Plan 1: (x.<:@gw0>)
- VoIP-To-PSTN Gateway Setup
- Line 1 Fallback DP: 1
- VoIP Caller Default DP: none
- FXO Timer Values (sec)
- PSTN Answer Delay: 1
- PSTN Disconnect Detection
- If you live in israel set Disconnect Tone: 400@-6,400@-19;3(.5/.5/1+2)
- International Control
- FXO Port Impendance: 220+820||120nF (Works well in Israel, leave as is if problematic)
- PSTN To SPA Gain (I've changed to to increase volume coming from the land line): 12
- Proxy and Registration
- Now, click Submit All Changes.
Adding SPA3102 to trixbox
In this stage we'll let trixbox know of our SPA3102 by adding it as a 'trunk'.A trunk is basically a device which gives certain VoIP service.
- Open up the trixbox web ui using http://[trixboxip] e.g http://10.0.0.4, go to
PBX>PBX Settings via the top menu: - From the left menu choose Trunks and the on the right choose Add SIP Trunk:
- Fill in the following fields:
- Outbound Caller ID: SPA3102 (or anything you want, either way it's not really used)
- Maximum Channels: 1
- Dial Rules: X. (including the dot at the end)
- Trunk Name: SPA3102
- PEER Details:
canreinvite=no
context=from-internal
host=[spa ip address - e.g 10.0.0.8]
nat=no
port=5061
type=friend
qualify=yes
dtmfmode=rfc2833
- Click Submit Changes when done.
- In order to use the newly added trunk we'll create an Outbound route which will say the following: each number which begins with 0 will be passed on to the SPA3102.
Go to Outbound Routes from the left menu and fill the following fields:- Route Name: bezeq (anything you like)
- Dial Patterns: 0. (zero dot)
- Trunk Sequence: SIP/[trunk name] - e.g SIP/SPA3102
- Commit the new configuration and restart asterisk by clicking the orange
Apply Configurations Settings bar at the top of the page and confirm restart:
Calling Cheap
Now we're set to go, open up sipdroid and dial any number which begins with a zero,call your friends and tell them what you just accomplished.
Opening NAT Ports
If you wish to use this system outside of your local home network (which is the whole point)and you are behind NAT (which you most likely are) then you'll have to open the following ports
and direct them to trixbox's IP address:
- 5060 UDP - This is the standard port for the SIP protocol.
- Range: 10000 - 20000 UDP - RTP ports, it's the protocol responsible transferring voice, if
these ports are closed you or the party you call won't hear a thing.
Final Words
Thanks for bearing with me on this long tutorial, if you've reached thus far it means you'veaccomplished something pretty cool.
If you like this tutorial pass it on.
If you encounter any problems don't hesitate to leave comments and ask.
Cheers, Max.