Just as with IAX, 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. Precede
the comment text with a semicolon; everything to the right will be
ignored.
The following options are to be used within the [general] section of
sip.conf:
allowexternalinvitesIf set to no, this setting
disables INVITE and REFER messages to non-local domains. See the
domain setting.
allowexternalinvites=yes|no
allowguestIf 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.
allowguest=no|yes
allowoverlapIf set to no, overlap
dialing is disabled.
allowoverlap=no|yes
allowsubscribeSpecifies whether or not to allow external devices to
subscribe to extension status (as set in the hint priority).
Defaults to yes.
allowsubscribe=yes|no
allowtransfersIf set to no, transfers
are disabled for all SIP calls, unless specifically enabled on a per-user or per-peer basis.
allowtransfers=no|yes
alwaysauthrejectIf 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 their request.
alwaysauthreject=no|yes
autodomainSet this option to yes
to have Asterisk add the local hostname and local IP addresses to
the domain list.
autodomain=yes|no
bindaddr and bindportThese 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.
bindaddr=0.0.0.0
bindport=5060
buggymwiThis setting allows Asterisk to send 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 with this bug.
buggymwi=no|yes
calleventsSet 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.
callevents=yes
checkmwiThis option specifies the default amount of time, in seconds, between mailbox checks for peers.
checkmwi=30
compactheadersYou 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 than the 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.
compactheaders=no
defaultexpiryThis 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.
defaultexpiry=300
directrtpsetupThis setting configures the direct RTP setup between two endpoints without the need for RE-INVITEs.
![]() |
Warning |
|---|---|
As of the time that this book was written, this feature was still
considered experimental, and as such should not be enabled unless you fully understand the
consequences. This Will not work for video calls and cases where the called party sends
RTP payloads and fmtp headers in the |
directrtpsetup=yes|no
domain
Sets the default domain for this Asterisk server.
If configured, Asterisk will only allow
INVITE and REFER
messages to non-local domains. You can use the CLI command
sip show domains to list the local domains.
domain=example.com
dumphistoryYou 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.
dumphistory=yes
externhostexternhost 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.
externhost=my.hostname.tld
externipexternip 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, routable address.
externip=216.239.39.104
externrefreshIf externhost is used,
externrefresh configures how
long, in seconds, should pass between DNS lookups.
externrefresh=30
g726nonstandardThis parameter can be set when dealing with peers that incorrectly use the wrong encoding for the G.726 codec. This setting tells Asterisk 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 negociating AAL2-G726-32 instead. You may need to set this option if you're using a Sipura or Grandstream device.
g726nonstandard=yes
ignoreregexpire
(global)If ignoreregexpire is set
to yes, Asterisk will do two things:
For non-realtime peers, 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.
For realtime peers, 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.
ignoreregexpire=yes|no
jbenable
Enables the use of an RTP jitterbuffer on the receiving side of a
SIP channel. Defaults to no.
An enabled jitterbuffer will be used only
if the sending side can create and the receiving
side can not accept jitter. The SIP channel can accept jitter,
thus a jitterbuffer on the receiving side will be used only
if it is forced and enabled.
jbenable=yes|no
jbforceForces the use of the RTP jitterbuffer on the receive side of a SIP channel. Defaults to "no".
jbforce=yes|no
jbimplThis setting is used to specify which jitterbuffer implementation
to use, the fixed jitterbuffer or the
adaptive jitterbuffer. If the
fixed jitterbuffer is used, it will
always be the size defined by jbmaxsize. If the
adaptive jitterbuffer is specified, then
the jitterbuffer will vary in size up to the maximum size specified by
jbmaxsize. This setting defaults to
fixed.
jbimpl=fixed|adaptive
jblogSpecifies whether or not to enable jitterbuffer frame logging. Defaults
to no.
jblog=yes|no
jbmaxsizeSets the maximum length of the jitterbuffer, in milliseconds.
jbmaxsize=200
jbresyncthresholdJump in the frame timestamps over which the jitterbuffer is resynchronized. Useful to improve the quality of the voice, with big jumps in/broken timestamps, usually sent from exotic devices and programs. Defaults to 1000.
jbresyncthreshold=1000
limitonpeers
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,
as the peer limit will be checked, and not a seperate limit for the user and peer portions
of a friend.
limitonpeers=yes|no
localnetlocalnet 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.
localnet=192.168.1.0/24
localnet=172.16.0.0/16
matchexterniplocallySpecifies that Asterisk should only substitute the externip or externhost setting if it matches
your localnet setting. Unless you have some sort of strange network
setup you will not need to enable this.
matchexterniplocally=yes|no
maxexpiryThis sets the maximum amount of time, in seconds, until a peer's registration expires.
maxexpiry=3600
minexpiryThis sets the minimum amount of time, in seconds, that we allow for a registration or subscription.
maxexpiry=3600
notifymimetypeThis takes as its argument a string specifying the MIME type
used for the message waiting notification (MWI) in the SIP
NOTIFY message. The most common
setting for this field is text/plain, although it can be
customized if need be.
notifymimetype=text/plain
notifyringingSpecifies whether Asterisk should notify subscriptions on RINGING state.
notifyringing=yes|no
notifyholdSpecifies whether Asterisk should notify subscriptions on HOLD state.
notifyringing=yes|no
pedanticYou 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. In an effort to improve performance,
SIP RFC compliance is not normally strictly adhered to.
pedantic=yes
realmThis option sets the realm for digest authentication. Set
realm to your fully qualified
domain name, which must be globally unique.
realm=mybox.example.com
recordhistoryYou can set recordhistory
to yes or no to enable or disable SIP history
recording for all channels. (See the
sip history and sip no history
CLI commands for more information.)
recordhistory=yes
registerattemptsSpecifies how many times Asterisk will attempt its outbound registrations before giving up. This setting defaults to zero, which means that Asterisk will retry indefinitely.
registerattempts=0
registertimeoutHow often Asterisk should attempt to re-register to other devices.
registertimeout=30
relaxdtmfYou 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.
relaxdtmf=yes
rtautoclear
(global)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.
rtautoclear=yes|no|seconds
rtcachefriends
(global)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.
rtcachefriends=yes|no
rtsavesysname
(global)Specifies whether or not Asterisk should save the systemname in the Realtime database at the time of registration.
rtsavesysname=yes|no
rtupdate
(global)If set to yes Asterisk will update the
IP address, origination port, and registration period of a peer upon
registration. Defaults to yes.
rtupdate=yes|no
sipdebugSpecifies whether or not Asterisk should turn on SIP debugging from the time that Asterisk loads the SIP channel driver.
sipdebug=yes|no
sendrpidSpecifies whether or not Asterisk should send a Remote-Party-ID header.
sendrpid=yes|no
srvlookupDNS 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.
![]() |
Warning |
|---|---|
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.
srvlookup=yes
t1minMinimum roundtrip time for messages to monitored hosts in milliseconds. Defaults to 100 milliseconds.
subscribecontextLimits 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.
subscribecontext=internal
t38pt_udptlSetting t38pt_udptlto 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.
![]() |
Warning |
|---|---|
T.38 fax passthrough only works 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 pass through UDPTL from one device to another. |
t38pt_udptl=yes|no
tos_sip,
tos_audio, and
tos_videoAsterisk can set the Type of Service (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.
trustrpidSpecifies whether or not Asterisk should trust the value in the Remote-Party-ID header.
trustrpid=yes|no
usereqphoneThe usereqphone
option tells Asterisk to add ;user=phone
to SIP URIs that contain a valid phone number.
useragent=Asterisk PBX v1.4
usereqphoneuseragent takes as its
argument a string specifying the value for the useragent field in the SIP header. The
default value is asterisk.
useragent=Asterisk PBX v1.4
videosupport
(both)You can set videosupport
to yes or no. You can turn it off on a
per-peer basis if the general video support is enabled,
but you can't enable it for one peer only without
enabling in the general section.
videosupport=yes
vmextenThis option sets the dialplan extension to reach the voice mailbox,
as 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.
vmexten=8500