simple Asterisk setup for LAN

Oraclecow picture Oraclecow · Jun 18, 2013 · Viewed 9.8k times · Source

I have been going back and forth trying out wanting to find a way for a way to communicate via LAN / WiFi easily, and making a call via LAN network would be great, so i tried asterisk a few times and lost in the way, i cant seem make it work, and the e-book i purchased endorsed me to purchase a Digium hardwares to proceed, it's not possible for me to do so, i live halfway around the world from america and a day's flight from a big city.

I'm willing to learn, but it seems each time i went in it, i got lost somehow. i know basics of linux and virtualbox, but not too much though, and this asterisk felt it's still another level for me.

My question is, is it possible to use asterisk or asterisknow by digium without their hardwares if it's only for LAN usage ? is it even a viable thing to do ?

Answer

mirkobrankovic picture mirkobrankovic · Jun 18, 2013

Of course it is possible.
All you need is one server and two sip phones, SW or HW to make them talk to each other.

so on the server where you installed asterisk set two peers in /etc/asterisk/sip.conf:
(this is just an example)

[101]
disallow=all
host=192.168.1.3 ; IP address of your first phone
;secret=101 ;uncomment if you want to use host=dynamic, less secure, use 'bigger' secret
type=friend
dtmfmode=rfc2833
allow=alaw
qualify=yes
canreinvite=yes
insecure=port
context=dial-local

[102]
disallow=all
host=192.168.1.4 ; IP address of your second phone
;secret=102 ;uncomment if you want to use host=dynamic, less secure, use 'bigger' secret
type=friend
dtmfmode=rfc2833
allow=alaw
qualify=yes
canreinvite=yes
insecure=port
context=dial-local

than in your /etc/asterisk/extensions.conf set context dial-local like:

[dial-local]
exten => _X.,1,n,Dial(SIP/${EXTEN})

Than you need to reload your new configurations from asteriskCLI> dialplan reload and sip relaod or execute in terminal:

asterisk -rx "dialplan reload";
asterisk -rx "sip reload";

all you need to do now is to register your 2 phone to server
You can chose from many free SW phone out there, I recommend 3CX for Win/Android and Linphone for Linux.

On the softphone all you need to configure is username (101 and 102), secret (101 and 102) and server IP (192.168.1.2 in this case).
Now start up server and both phones, and if you see them 'on hock', dial 102 or 101 :)