In order for our two phones to communicate with each other, we need to configure an account for each phone in the channel driver which corresponds to the protocol they'll be using. Since both the phones are using the SIP protocol, we'll configure accounts in the SIP channel driver configuration file, called sip.conf. (This file resides in the Asterisk configuration directory, which is typically /etc/asterisk.) Let's name your phones Alice and Bob, so that we can easily differentiate between them.

Open sip.conf with your favorite text editor, and spend a minute or two looking at the file. (Don't let it overwhelm you — the sample sip.conf has a lot of data in it, and can be overwhelming at first glance.) Notice that there are a couple of sections at the top of the configuration, such as [general] and [authentication], which control the overall functionality of the channel driver. Below those sections, there are sections which correspond to SIP accounts on the system. Scroll to the bottom of the file, and add a section for Alice and Bob. You'll need to choose your own unique password for each account, and change the permit line to match the settings for your local network.

[demo-alice]
type=friend
host=dynamic
secret=verysecretpassword ; put a strong, unique password here instead
context=users
deny=0.0.0.0/0
permit=192.168.5.0/255.255.255.0 ; replace with your network settings

[demo-bob]
type=friend
host=dynamic
secret=othersecretpassword ; put a strong, unique password here instead
context=users
deny=0.0.0.0/0
permit=192.168.5.0/255.255.255.0 ; replace with your network settings
Icon
Be Serious About Account Security

We can't stress enough how important it is for you to pick a strong password for all accounts on Asterisk, and to only allow access from trusted networks. Unfortunately, we've found many instances of people exposing their Asterisk to the internet at large with easily-guessable passwords, or no passwords at all. You could be at risk of toll fraud, scams, and other malicious behavior.

For more information on Asterisk security and how you can protect yourself, check out http://www.asterisk.org/security/webinar/.

After adding the two sections above to your sip.conf file, go to the Asterisk command-line interface and run the sip reload command to tell Asterisk to re-read the sip.conf configuration file.

server*CLI> sip reload

Reloading SIP

server*CLI>
Icon
Reloading Configuration Files

Don't forget to reload the appropriate Asterisk configuration files after you have made changes to them.

Comments:

With the default freepbx install for 1.6, the sip.conf file is not located in /etc/asterisk anymore.

I show it at :
/usr/src/freepbx-2.7.0/amp_conf/htdocs/admin/modules/core/etc/sip.conf

Posted by dawaves at Jan 04, 2011 22:58

Read the part: "which is typically /etc/asterisk"

FreePBX is a Linux Distribution that includes many pieces of software. Asterisk supports having its config files in many different places.

Posted by lathama at Jan 05, 2011 05:00

why are we using type=friend for the phones ?

Posted by obeliks at Jun 15, 2011 03:52