Using an Android Phone as an Asterisk extension
Think about using your Android phone, connected through 3G or through WiFi as a telephone extension.
What do you need?
- An Asterisk server (can be set up very easily)
- A DID (VoIP phone line which usually costs very little)
- An Android phone (or multiple phones)
Why?
Of course, Android is a phone, but using the cellular network costs money. If you configure your smart phone to register to Asterisk, the calls to your home/office are free and the calls to other numbers cost the same as if you were calling from the home/office.
Diagram
Here is my home network topology:
Steps
On your home network:
- If your network does not have an static IP, either get one or register with DynDNS.com and follow the instructions.
- If your Asterisk server faces the Internet, ensure that ports 10000-20000 are open in your firewall.
If your Asterisk server is behind another firewall, ensure that those ports are forwarded to the Asterisk box and add the following to the [general] section in sip.conf
externip=<my domain name>
localnet=<IP base for my network>/255.255.255.0e.g.
externip=mynetwork.homeip.net
localnet=192.168.1.0/255.255.255.0 - Setup an extension in sip.conf (you can use whatever extension you prefer):
[103]
type=friend
secret=complexPassword ;NOTE it is important to set up a complex password
qualify=no ; Will not drop the connection
nat=yes ; This phone may be outside the network
host=dynamic ; This device registers with us
canreinvite=no ; Asterisk by default tries to redirect
context=default ; Or whatever context you want to define in Asterisk
mailbox=103@default ; only if you are configuring voicemail. - Add a dial plan for the new extension in extensions.conf
For example:
exten => 103,1,Dial(SIP/103)
- Restart your Asterisk Server
$sudo /etc/init.d/asterisk restart
On the Android Phone:
- Download and install a SIP softphone application.
The one that has worked for me is CSIPSimple. I tried 3CX but it had a lot of echo. - Create a new account using the basic settings:
Account name: Whatever you want, I use "home"
Server: The IP address of your Asterisk server
User name: 103 (or the corresponding extension)
Password: the extension password defined in sip.conf
And that's it! your phone should be able to register and dial other extensions regardless of being inside or outside your network. If you have already registered your Asterisk with a DID provider, then you can start making calls.