Sip.conf

Synopsis
The sip.conf file contains parameters relating to the configuration of sip client access to the Asterisk server. Clients must be configured in this file before they can place or receive calls using the Asterisk server.

Arrangement
The sip.conf file is read from the top down.  The first section is for general server  options, such as the IP address and port number to bind to.  The following sections define client parameters such as the username, password, and default IP address for unregistered clients. Sections are delineated by a name in brackets.  The first section is called general (which cannot be used as a client name.) The following sections begin with the client name in brackets, followed by the client options.

Keywords
The following keywords are defined in sip.conf.

In the general section:

port: The port Asterisk should listen for incoming SIP connections.  The default is 5060, in keeping with standards. Takes as an argument a port number (which must not be in use by any other service.)

bindaddr: The IP address Asterisk should listen on for incoming SIP connections.  If the machine has multiple real or aliased IP addresses, this option can be used to select which IP addresses Asterisk listens on.  The default behavior is to listen on all available interfaces and aliases. Takes as it's argument an IP address (which must be an interface available on the system.)

context: Sets a default context all further clients are placed in, unless overridden within their client definition.

Client options:

type: The type option sets the connection class for the client.  Options are 

peer: A device which recieves calls from the asterisk server.
user: A device that makes calls through the asterisk server.
friend: a device that can both recieve and send calls through the asterisk server.  This makes sense for most desk handsets and other devices.  If unsure, you should probably set type to this value.
secret:  Sets the password for the client.  Takes an alphanumeric string.

host: Sets the IP address or resolvable host name of the device.  This can alternately be set to 'dynamic'  in which case the host is expected to come from any IP address.  This is the most common option, and normally necessary within a DHCP network.

defualtip: This option can be used when the host keyword is set to dynamic.  When set, the Asterisk server will attempt to send calls to this IP address when a call is received for a SIP client that has not yet registered with the server.  

?username: This option sets the username the Asterisk server attempts to connect when a call is received.  Used when for some reason the value is not the same as the username the client registered.

canreinvite: This option is used to tell the server to never  issue a reinvite to the client.  This is used to interoperate with some (buggy) hardware that crashes if we reinvite, such as the common Cisco ATA 186.

context: When defined within a client definition, this keyword sets the default context for this client only.

Complete File Example:

The following is a complete example of a workable sip.conf file.

[general]
port=5060
bindaddr=192.168.0.10
context=default

[snom]
type=friend
secret=snom100
host=dynamic
defaultip=192.168.0.15

[cisco]
type=friend
secret=mysecret
host=192.168.0.20
canreinvite=no
context=trusted