Asterisk sip.conf Setup

 

Sip.conf setup

 

If you followed my last guide Simple Asterisk Installation you should now be ready to get into the fine details of setting up your Asterisk box!

We are now going to configure:

  • sip.conf

I will post my sample configurations (obviously i will edit out my password) that work with your server behind a router that is in DMZ (A physical or logical subnetwork that contains and exposes an organization’s external services to a larger untrusted network, usually the Internet) Typically I wouldn’t open up my server to that but I only have a few ports open using iptables. Anyways here it is.

Remember that this file is located in “/etc/asterisk/” after you edit the default file (I recommend backing up the original first with just a simple “sudo cp /etc/asterisk/sip.conf /etc/asterisk/sip.conf.orig”.

You can edit this file using a command like “sudo vi /etc/asterisk/sip.conf”

If you have no idea how to save with vi you first press “ESC” than let go. Now Hold “Shift+:” let go again, and now type “wq!” followed by pressing enter. Should look like this:

Asterisk sip.conf

Remember to restart asterisk or reload it after editing the sip.conf by typing either: “sudo asterisk -rx reload” or “sudo asterisk -r” (followed by typing “reload” when in the CLI of asterisk).

To stop, start, restart asterisk from the init side you can type this, respectfully: “sudo /etc/init.d/asterisk start

A few things to note about this configuration below:

Anything related to [voipms] is configuration details from my registrar, it is nothing other than a phone number I bought to use as a way to speak to the PSTN (Public switched telephone network).

Also anything related to [700x] are the extensions I use on different vo-ip phones or clients on my computers. You could download a software called “X-Lite” and login with the extension and IP of your Ubuntu Asterisk server or domain name if you have one.

If not using a Vo-IP registrar remove any test that looks like THIS

Remember to edit anything BOLDED, it can be passwords, domain names (if using one) or the localnet.

sudo vi /etc/asterisk/sip.conf

[general]
context=internal
register => userid:[email protected]:5060
allowguest=no
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
disallow=all
allow=ulaw
alwaysauthreject=yes
canreinvite=no
nat=yes
session-timers=refuse
externhost=domainname.com
externrefresh=15
localnet=192.168.1.0/255.255.255.0

[voipms]
canreinvite=no
context=internal
host=cityname.voip.ms
secret=password
type=friend
username=553
disallow=all
allow=ulaw
fromuser=553
trustrpid=yes
sendrpid=yes
insecure=invite
nat=yes

[7001]
type=friend
host=dynamic
secret=password
context=internal

[7002]
type=friend
host=dynamic
secret=password
context=internal

[7003]
type=friend
host=dynamic
secret=password
context=internal

[7004]
type=friend
host=dynamic
secret=password
context=internal

[7005]
type=friend
host=dynamic
secret=password
context=internal

[7006]
type=friend
host=dynamic
secret=password
context=internal

[7007]
type=friend
host=dynamic
secret=password
context=internal

[7008]
type=friend
host=dynamic
secret=password
context=internal

 

Extra

  • Remember to review your router settings when setting asterisk (Port forwarding)