System information
has taken over the VoIP/telecom industry and been implemented in thousands of de-
vices and PBXs. If you look through the sip.conf.sample file in the ./configs subdirectory
of your Asterisk source you will notice a wealth of options available. Fortunately, the
default options are normally all you need, and therefore you can create a very simple
configuration file that will allow most standard SIP telephones to connect with Asterisk.
The first thing you need to do is create a configuration file in your /etc/asterisk directory
called sip.conf.
Paste or type the following information into the file:
[general]
context=unauthenticated ; default context for incoming calls
allowguest=no ; disable unauthenticated calls
srvlookup=yes ; enabled DNS SRV record lookup on outbound calls
udpbindaddr=0.0.0.0 ; listen for UDP requests on all interfaces
tcpenable=no ; disable TCP support
[office-phone](!) ; create a template for our devices
type=friend ; the channel driver will match on username first, IP second
context=LocalSets ; this is where calls from the device will enter the dialplan
host=dynamic ; the device will register with asterisk
nat=yes ; assume device is behind NAT
; *** NAT stands for Network Address Translation, which allows
; multiple internal devices to share an external IP address.
secret=s3CuR#p@s5 ; a secure password for this device -- DON'T USE THIS PASSWORD!
dtmfmode=auto ; accept touch-tones from the devices, negotiated automatically
disallow=all ; reset which voice codecs this device will accept or offer
allow=ulaw ; which audio codecs to accept from, and request to, the device
allow=alaw ; in the order we prefer
; define a device name and use the office-phone template
[0000FFFF0001](office-phone)
; define another device name using the same template
[0000FFFF0002](office-phone)
Open the sip.conf file you’ve just created, and we’ll go over each item.
We’ve created four sections, the first one being the [general] section. This is a standard
section that appears at the top of the configuration file for all channel modules, and
must always be named in this way. The [general] section contains general configura-
tion options for how that protocol relates to your system, and can be used to define
default parameters as well.
For example, we’ve defined the default context as unauthenticated, to ensure that we
have explicitly declared where unauthenticated guest calls will enter the dialplan (rather
than leaving that to chance). We’ve named it unauthenticated to make it obvious that
calls processed in this context are not trusted, and thus should not be able to do things
such as make outbound calls to the PSTN (which could potentially cost money, or
represent identity theft). You should be aware that we could have used any name we
90 | Chapter 5: User Device Configuration