The SIP configuration file (sip.conf) contains configuration information for SIP channels. The headings for the channel definitions are formed by a word framed in square brackets ()—again, with the exception of the [general] section, where we define global SIP parameters. Don’t forget to use comments generously in your sip.conf file.
General SIP Parameters
The following options are to be used within the [general] section of sip.conf:
If set to no, this setting disables INVITE and REFER messages to non-local domains.
If set to no, this disallows guest SIP connections. The default is to allow guest connections. SIP normally requires authentication, but you can accept calls from users who do not support authentication (i.e., do not have a secret field defined).
Certain SIP appliances (such as the Cisco Call Manager v4.1) do not support authentication, so they will not be able to connect if you set allowguest=no
If set to no, overlap dialing is disabled
Specifies whether or not to allow external devices to subscribe to extension status (as set in the hint priority). Defaults to yes
If set to no, transfers are disabled for all SIP calls, unless specifically enabled on a per-user or per-peer basis
If this option is enabled, whenever Asterisk rejects an INVITE or REGISTER, it will always reject it with a 401 Unauthorized message instead of letting the caller know whether there was a matching user or peer for his request:
Set this option to yes to have Asterisk add the local hostname and local IP addresses to the domain list
These optional parameters allow you to control the IP interface and port on which you wish to accept SIP connections. If omitted, the port will be set to 5060, and all IP addresses in your Asterisk system will accept incoming SIP connections. If multiple bind addresses are configured, only those interfaces will listen for connections.
The address 0.0.0.0 tells Asterisk to listen on all interfaces:
This setting allows Asterisk to send a message-waiting indication to certain Cisco SIP phones with firmware that doesn’t fully support the message-waiting Internet RFC. Enable this option to avoid getting error messages when sending MWI messages on phones with this bug
Set this to yes when you want SIP to generate Manager events. This will be important if you have external programs that use the Asterisk Manager interface, such as the Flash Operator Panel
This option specifies the default amount of time, in seconds, between mailbox checks for peers
You can set compactheaders to yes or no. If it’s set to yes, the SIP headers will use a compact format, which may be required if the size of the SIP header is larger thanthe maximum transmission unit (MTU) of your IP headers, causing the IP packet to be fragmented. Do not use this option unless you know what you are doing
This sets the default SIP registration expiration time, in seconds, for incoming and outgoing registrations. A client will normally define this value when it initially registers, so the default value you set here will be used only if the client does not specify a timeout when it registers. If you are registering to another user agent server (UAS), this is the registration timeout that it will send to the far end
This setting configures the direct RTP setup between two endpoints without the need for RE-INVITEs. As of the time that this book was written, directrtpsetup was still considered experimental, and as such should not be enabled unless you fully understand the consequences. This option will not work for video calls and cases where the called party sends RTP payloads and FMTP headers in the 200 OK response that do not match the caller’s INVITE request.
Sets the default domain for this Asterisk server. If configured, Asterisk will allow INVITE and REFER messages only to nonlocal domains. You can use the CLI command sip show domains to list the local domains
You can set dumphistory to yes or no to enable or disable the printing of the SIP history report at the end of the SIP dialog. The SIP history is printed to the DEBUG logging channel
externhost takes a fully qualified domain name as its argument. If Asterisk is behind NAT, the SIP header will normally use the private IP address assigned to the server.
If you set this option, Asterisk will perform periodic DNS lookups on the hostname and replace the private IP address with the IP address returned from the DNS lookup
The use of externhost is not recommended in production systems, because if the IP address of the server changes, the wrong IP address will be set in the SIP headers until the next lookup is performed.The use of externip is recommended instead.
externip takes an IP address as its argument. If Asterisk is behind NAT, the SIP header will normally use the private IP address assigned to the server. The remote server will not know how to route back to this address; thus, it must be replaced with a valid, routeable address
If externhost is used, externrefresh configures how long, in seconds, should pass between DNS lookups
This parameter can be set when dealing with peers that incorrectly use the wrong encoding for the G.726 codec. This setting tells Asterisk to use AAL2 packing order instead of RFC3551 packing order if the peer negotiates G726-32 audio. Ordinarily, that would be contrary to the RFC3551 specification, as the peer should be negotiating AAL2-G726-32 instead. You may need to set this option if you’re usinga Sipura or Grandstream device
If ignoreregexpire is set to yes, Asterisk could do one of two things, for:
When their registration expires, the information will not be removed from memory or the Asterisk database. If you attempt to place a call to the peer, the existing information will be used in spite of it having expired.
When the peer is retrieved from realtime storage, the registration information will be used regardless of whether it has expired or not; if it expires while the realtime peer is still in memory (due to caching or other reasons), the information will not be removed from realtime storage
Enables the use of an RTP jitter buffer on the receiving side of a SIP channel. Defaults to no. An enabled jitter buffer will be used only if the sending side can create and the receiving side cannot accept jitter. The SIP channel can accept jitter; thus a jitter buffer on the receiving side will be used only if it is forced and enabled
Forces the use of the RTP jitter buffer on the receiving side of a SIP channel. Defaults to no
This setting is used to specify which jitter buffer implementation to use, the fixed jitter buffer or the adaptive jitter buffer. If the fixed jitter buffer is used, it will always be the size defined by jbmaxsize. If the adaptive jitter buffer is specified, then the jitter buffer will vary in size up to the maximum size specified by jbmaxsize. This setting defaults to fixed
Specifies whether or not to enable jitter buffer frame logging. Defaults to no
Sets the maximum length of the jitter buffer, in milliseconds
Jump in the frame timestamps over which the jitter buffer is resynchronized. This is useful to improve the quality of the voice, with big jumps in/broken timestamps that are usually sent from exotic devices and programs. Defaults to 1000
This setting tells Asterisk to apply call limits to peers only. This will improve call limits and status notification for devices set to type=friend because the peer limit will be checked, and not create a separate limit for the user and peer portions of a friend
localnet is used to tell Asterisk which IP addresses are considered local, so that the address in the SIP header can be translated to that specified by externip or the IP address can be looked up with externhost. The IP addresses should be specified in CIDR notation:
Specifies that Asterisk should substitute the externip or externhost setting only if it matches your localnet setting. Unless you have some sort of strange network setup you will not need to enable this
This sets the maximum amount of time, in seconds, until a peer’s registration expires,allowed for a registration or subscription.
This takes as its argument a string specifying the MIME type used for the messagewaiting indication (MWI) in the SIP NOTIFY message. The most common setting for this field is text/plain, although it can be customized if need be
Specifies whether Asterisk should notify subscriptions on RINGING state
Specifies whether Asterisk should notify subscriptions on HOLD state
You can set pedantic to yes or no. Setting it to yes enables slow pedantic checking for phones that require it, such as the Pingtel, and enables more strict SIP RFC compliancy.
This option sets the realm for digest authentication. Set realm to your fully qualified domain name, which must be globally unique
You can set recordhistory to yes or no to enable or disable SIP history recording for all channels
Specifies how many times Asterisk will attempt its outbound registrations before giving up. This setting defaults to 0, which means that Asterisk will retry indefinitely
Specifies how often Asterisk should attempt to re-register to other devices
You can set relaxdtmf to yes or no. Setting it to yes will relax the DTMF detection handling. Use this if Asterisk is having a difficult time determining the DTMF on the SIP channel. Note that this may cause “talkoff,” where Asterisk incorrectly detects DTMF when it should not
This specifies whether or not Asterisk should auto-expire friends created on the fly on the same schedule as if they had just registered. If set to yes, when the registration expires, the friend will vanish from the configuration until requested again. If set to an integer, friends expire within that number of seconds instead of the normal registration interval
If rtcachefriends is turned on, Asterisk will cache friends that come from the realtime engine, just as if they had come from sip.conf. This often helps with items such as message-waiting indications on realtime peers
Specifies whether or not Asterisk should save the systemname in the realtime database at the time of registration
If set to yes Asterisk will update the IP address, origination port, and registration period of a peer upon registration. Defaults to yes
Specifies whether or not Asterisk should turn on SIP debugging from the time that Asterisk loads the SIP channel driver
Specifies whether or not Asterisk should send a Remote-Party-ID header
DNS SRV records are a way of setting up a logical, resolvable address where you can be reached. This allows calls to be forwarded to different locations without the need to change the logical address. By using SRV records, you gain many of the advantages of DNS, whereas disabling them removes the ability to place SIP calls based on domain names.
Currently, the support for SRV records in Asterisk is somewhat lacking. If multiple SRV records are returned, Asterisk will use only the first record.
Using DNS SRV record lookups is highly recommended. To enable them, set
srvlookup=yes in the [general] section of sip.conf
This is the minimum round-trip time for messages to monitored hosts in milliseconds. Defaults to 100 milliseconds
Limits SUBSCRIBE requests to the specified context. This is useful if you want to limit subscriptions to internal extensions, for example.This option may also be set on a per-user or per-peer basis
Setting t38pt_udptl to yes enables T.38 fax (UDPTL) passthrough on SIP-to-SIP calls, provided both parties have T.38 support. This setting must be enabled in the general section for all devices to work. You can then disable it on a per-device basis.
T.38 fax passthrough works only in SIP-to-SIP calls, without any local or agent channel being used. Asterisk cannot currently originate or terminate T.38 fax calls; it can only passthrough UDPTL from one device to another.
tos_sip, tos_audio, and tos_video
Asterisk can set the TOS bits in the IP header to help improve performance on routers that respect TOS bits in their routing calculations. The tos_sip, tos_audio, and tos_video settings control the TOS bits for the SIP messages, the RTP audio, and RTP video respectively. Valid: CS0, CS1, CS2, CS3, CS4, CS5, CS6, CS7, AF11, AF12, AF13, AF21, AF22, AF23, AF31, AF32, AF33, AF41, AF42, AF43, and ef (expedited forwarding). You may also use a numeric value for the TOS bits. For more information, see the doc/ip-tos.txt file in the Asterisk source directory.
Specifies whether or not Asterisk should trust the value in the Remote-Party-ID header
useragent=Asterisk PBX v1.4
useragent takes as its argument a string specifying the value for the useragent field in the SIP header. The default value is asterisk
The usereqphone option tells Asterisk to add ;user=phone to SIP URIs that contain a valid phone number
You can set videosupport to yes or no. You can turn it off on a per-peer basis if general video support is enabled, but you can’t enable it for one peer only without enabling it in the general section
This option sets the dialplan extension to reach the voicemailbox, and will be sent in the Message-Account section of the MWI NOTIFY message. Set this if your SIP device supports the Message-Account setting. This option defaults to asterisk