System information

Any SIP requests to your domain will be referred to your Asterisk server, which will be
responsible for handling incoming SIP connections.
If your dialplan does not understand the name/resource/endpoint portion of the SIP
URI, calls will fail. This means that if you want to be able to offer resources in your
Asterisk system by name, you will need relevant dialplan entries.
Accepting Calls to Your System
When a SIP URI comes into your Asterisk system, the resource portion of the URI will
arrive in the dialplan as an ${EXTEN}. So, for example, leif@shifteight.org would arrive
in the dialplan as leif within the ${EXTEN} channel variable in whatever context you
use to handle unauthenticated SIP calls (if you are building your dialplan using the
examples in this book, that will be the unauthenticated dialplan context).
Modifying sip.conf
Once you are familiar with the security implications of allowing unauthenticated SIP
connections, you will need to ensure that your sip.conf file allows for them. While
Asterisk allows them by default, in earlier chapters of this book we have instructed you
to disable unauthenticated SIP calls. The logic for this is simple: if you don’t need it,
don’t enable it.
Since we are now interested in allowing calls from the Internet, we will need to allow
unauthenticated SIP calls. We do that by setting a general variable in the /etc/asterisk/
sip.conf file, as follows:
[general]
context=unauthenticated ; default context for incoming calls
allowguest=yes ; enable unauthenticated calls
After making this change, don’t forget to reload SIP, using this command from the
command line:
$ sudo asterisk -rx "sip reload"
or this one from the Asterisk CLI:
*CLI> sip reload
You can verify that the changes have succeeded using the Asterisk CLI command sip
show settings. What you want to see is Allow unknown access: Yes under the Global
Settings section, and Context: unauthenticated under the Default Settings header.
Standard dialplan
In order to handle an incoming name, your dialplan needs to contain an extension that
matches that name.
This could just as easily be a proxy server, or any other server capable of handling incoming SIP connections.
240 | Chapter 12:Internet Call Routing