Once you have asterisk installed and running you need to configure it, to be able to use it as PBX.
Asterisk has a lot of features, and we will start to explore some of them here step by step, in this first post about configuring Asterisk, I will only show you how to configure a single two internals and make them be able to call each other, you may add more than one, as you will see later, and all of them will be able to call each others.
So lets start: Asterisk has two main configuration files, and those are:
On the first one we will configure the extensions, properties, and on the second one we will configure the dial plans, and how they will be able to reach each other.
Here is a simple example of
/etc/asterisk/sip.conf file, with two extensions.
 type=friend username=5010 secret=123456 host=dynamic context=default  type=friend username=5020 secret=123456 host=dynamic context=default
This will create two extensions, 5010 and 5020, this is assuming they are not behind a nat, if that is the case, this could the configuration file instead.
 type=friend nat=yes username=5010 secret=123456 host=dynamic context=default  type=friend nat=yes username=5020 secret=123456 host=dynamic context=default
Well now, lets explain a little the fields in this configuration file:
- type: Defines the role the extension will have, and we have three options: - peer: Where the device will only be able to receive calls from the PBX - user: Where the device will only be able to make calls to the PBX - friend: Where the device will be able to both make and receive calls through the PBX
- nat: Defines, if the connecting device that will use that profile, is or is not behind nat.
- username: Defines the username to be used to connect to the PBX
- secret: Is the password to be able to connect to the PBX
- host: The IP that the device will have, if it is set to dynamic, that device will be able to log into the PBX from any IP
- default: This is very important and defines the group at which that profile belongs, and it is used in the
/etc/asterisk/extensions.conffile. Now, lets configure the second file:
[default] exten => 5010,1,Dial(SIP/5010) exten => 5020,1,Dial(SIP/5020)I am keeping this as simple as possible, for now, and this will only make possible to call from one extension to the other one, this file, contains the rules about dialing, and what to do, when the PBX "sees" the numbers dialed by a remote user. What we see here, is that to reach extension 5010, the PBX should dial 5010 using SIP, and as you can see, those rules belong to the default profile, so you can create a lot of profiles, and each telephone attached to the PBX, will belong to one of them and will be able to do only what this file is allowing it to do, so is more or less like having VLANs, or in this case Virtual PBXs, and later we will see how to permit to call from one VPBX to the other. Well, with this simple configuration you now have a running and working PBX, I will show you later, how to configure Ekiga to use this asterisk configuration.