System information

Now put the following entry in /etc/asterisk/sip.conf on serverB. It is nearly identical to
the contents of the entry we put on serverA, but the name of the peer and the IP address
were changed:
[serverA]
type = peer
host = 192.168.1.101
username = serverB
secret = apples
context = incoming
disallow = all
allow = ulaw
At this point you should be able to verify that the configuration has been successfully
loaded into Asterisk using some CLI commands. The first command to try is sip show
peers. As the name implies, it will show all SIP peers that have been configured:
*CLI> sip show peers
Name/username Host Dyn Forcerport ACL Port Status
serverB/serverA 192.168.1.101 5060 Unmonitored
1 sip peers [Monitored: 0 online, 0 offline Unmonitored: 1 online, 0 offline]
You can also try sip show peer serverB. That command will show much
more detail.
The last step in setting up SIP calls between two Asterisk servers is to modify the dialplan
in /etc/asterisk/extensions.conf. For example, if you wanted any calls made on serverA
to extensions 6000 through 6999 to be sent over to serverB, you would use this line in
the dialplan:
exten => _6XXX,1,Dial(SIP/${EXTEN}@serverB)
When you sign up for a SIP provider, you may
have service for sending and/or receiving phone calls. The configuration will differ
slightly depending on your usage of the SIP provider. Further, the configuration will
differ between each provider. Ideally, the SIP provider that you sign up with will provide
Asterisk configuration examples to help get you connected as quickly as possible. In
case they do not, though, we will attempt to give you a common setup that will help
you get started.
If you will be receiving calls from your service provider, the service provider will most
likely require your server to register with one of its servers. To do so, you must add a
registration line to the [general] section of /etc/asterisk/sip.conf:
[general]
...
register => username:password@your.provider.tld
...
Connecting an Asterisk system to a SIP provider.
VoIP | 149