SIP Configuration Example For Asterisk
SIP Configuration Example For Asterisk
[general]
context=default ; Default context for incoming calls
;allowguest=no ; Allow or reject guest calls (default is
yes)
;match_auth_username=yes ; if available, match user entry using
the
; 'username' field from the
authentication line
; instead of the From: field.
allowoverlap=no ; Disable overlap dialing support.
(Default is yes)
;allowtransfer=no ; Disable all transfers (unless enabled
in peers or users)
; Default is enabled. The Dial() options
't' and 'T' are not
; related as to whether SIP transfers are
allowed or not.
;realm=mydomain.tld ; Realm for digest authentication
; defaults to "asterisk". If you set a
system name in
; asterisk.conf, it defaults to that
system name
; Realms MUST be globally unique
according to RFC 3261
; Set this to your host name or domain
name
udpbindaddr=0.0.0.0 ; IP address to bind UDP listen socket to
(0.0.0.0 binds to all)
; Optionally add a port number,
192.168.1.1:5062 (default is port 5060)
;
; Note that the TCP and TLS support for chan_sip is currently considered
; experimental. Since it is new, all of the related configuration
options are
; subject to change in any release. If they are changed, the changes
will
; be reflected in this sample configuration file, as well as in the
UPGRADE.txt file.
;
tcpenable=no ; Enable server for incoming TCP
connections (default is no)
tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to
(0.0.0.0 binds to all interfaces)
; Optionally add a port number,
192.168.1.1:5062 (default is port 5060)
;tlscafile=</path/to/certificate>
; If the server your connecting to uses a self signed certificate
; you should have their certificate installed here so the code can
; verify the authenticity of their certificate.
;tlscadir=</path/to/ca/dir>
; A directory full of CA certificates. The files must be named
with
; the CA subject name hash value.
; (see man SSL_CTX_load_verify_locations for more info)
;tlsdontverifyserver=[yes|no]
; If set to yes, don't verify the servers certificate when acting
as
; a client. If you don't have the server's CA certificate you can
; set this and it will connect without requiring tlscafile to be
set.
; Default is no.
; Codec negotiation
;
; When Asterisk is receiving a call, the codec will initially be set to
the
; first codec in the allowed codecs defined for the user receiving the
call
; that the caller also indicates that it supports. But, after the caller
; starts sending RTP, Asterisk will switch to using whatever codec the
caller
; is sending.
;
; When Asterisk is placing a call, the codec used will be the first codec
in
; the allowed codecs that the callee indicates that it supports. Asterisk
will
; *not* switch to whatever codec the callee is sending.
;
;disallow=all ; First disallow all codecs
;allow=ulaw ; Allow codecs in order of preference
;allow=ilbc ; see doc/rtp-packetization for framing
options
;
; This option specifies a preference for which music on hold class this
channel
; should listen to when put on hold if the music class has not been set
on the
; channel with Set(CHANNEL(musicclass)=whatever) in the dialplan, and the
peer
; channel putting this one on hold did not suggest a music class.
;
; This option may be specified globally, or on a per-user or per-peer
basis.
;
;mohinterpret=default
;
; This option specifies which music on hold class to suggest to the peer
channel
; when this channel places the peer on hold. It may be specified globally
or on
; a per-user or per-peer basis.
;
;mohsuggest=default
;
;parkinglot=plaza ; Sets the default parking lot for call
parking
; This may also be set for individual
users/peers
; Parkinglots are configured in
features.conf
;language=en ; Default language setting for all
users/peers
; This may also be set for individual
users/peers
;relaxdtmf=yes ; Relax dtmf handling
;trustrpid = no ; If Remote-Party-ID should be trusted
;sendrpid = yes ; If Remote-Party-ID should be sent
;prematuremedia=no ; Some ISDN links send empty media frames
before
; the call is in ringing or progress
state. The SIP
; channel will then send 183 indicating
early media
; which will be empty - thus users get no
ring signal.
; Setting this to "yes" will stop any
media before we have
; call progress (meaning the SIP channel
will not send 183 Session
; Progress for early media). Default is
"yes". Also make sure that
; the SIP peer is configured with
progressinband=never.
; The shrinkcallerid function removes '(', ' ', ')', non-trailing '.',
and '-' not
; in square brackets. For example, the caller id value 555.5555 becomes
5555555
; when this option is enabled. Disabling this option results in no
modification
; of the caller id value, which is necessary when the caller id
represents something
; that must be preserved. This option can only be used in the [general]
section.
; By default this option is on.
;
;shrinkcallerid=yes ; on by default
;
; If regcontext is specified, Asterisk will dynamically create and
destroy a
; NoOp priority 1 extension for a given peer who registers or unregisters
with
; us and have a "regexten=" configuration item.
; Multiple contexts may be specified by separating them with '&'. The
; actual extension is the 'regexten' parameter of the registering peer or
its
; name if 'regexten' is not provided. If more than one context is
provided,
; the context must be specified within regexten by appending the desired
; context after '@'. More than one regexten may be supplied if they are
; separated by '&'. Patterns may be used in regexten.
;
;regcontext=sipregistrations
;regextenonqualify=yes ; Default "no"
; If you have qualify on and the peer
becomes unreachable
; this setting will enforce inactivation
of the regexten
; extension for the peer
;
;--------------------------- SIP timers
----------------------------------------------------
; These timers are used primarily in INVITE transactions.
; The default for Timer T1 is 500 ms or the measured run-trip time
between
; Asterisk and the device if you have qualify=yes for the device.
;
;t1min=100 ; Minimum roundtrip time for messages to
monitored hosts
; Defaults to 100 ms
;timert1=500 ; Default T1 timer
; Defaults to 500 ms or the measured
round-trip
; time to a peer (qualify=yes).
;timerb=32000 ; Call setup timer. If a provisional
response is not received
; in this amount of time, the call will
autocongest
; Defaults to 64*timert1
;domain=mydomain.tld,mydomain-incoming
; Add domain and configure incoming
context
; for external calls to this domain
;domain=1.2.3.4 ; Add IP address as local domain
; You can have several "domain" settings
;allowexternaldomains=no ; Disable INVITE and REFER to non-local
domains
; Default is yes
;autodomain=yes ; Turn this on to have Asterisk add local
host
; name and local IP to domain list.
[authentication]
; Global credentials for outbound calls, i.e. when a proxy challenges
your
; Asterisk server for authentication. These credentials override
; any credentials in peer/register definition if realm is matched.
;
; This way, Asterisk can authenticate for outbound calls to other
; realms. We match realm on the proxy challenge and pick an set of
; credentials from this list
; Syntax:
; auth = <user>:<secret>@<realm>
; auth = <user>#<md5secret>@<realm>
; Example:
;auth=mark:[email protected]
;
; You may also add auth= statements to [peer] definitions
; Peer auth= override all other authentication settings if we match on
realm
;------------------------------------------------------------------------
------
; DEVICE CONFIGURATION
;
; The SIP channel has two types of devices, the friend and the peer.
; * The type=friend is a device type that accepts both incoming and
outbound calls,
; where Asterisk match on the From: username on incoming calls.
; (A synonym for friend is "user"). This is a type you use for your
local
; SIP phones.
; * The type=peer also handles both incoming and outbound calls. On
inbound calls,
; Asterisk only matches on IP/port, not on names. This is mostly used
for SIP
; trunks.
;
; For device names, we recommend using only a-z, numerics (0-9) and
underscore
;
; For local phones, type=friend works most of the time
;
; If you have one-way audio, you probably have NAT problems.
; If Asterisk is on a public IP, and the phone is inside of a NAT device
; you will need to configure nat option for those phones.
; Also, turn on qualify=yes to keep the nat session open
;
; Configuration options available
; --------------------
; context
; callingpres
; permit
; deny
; secret
; md5secret
; remotesecret
; transport
; dtmfmode
; directmedia
; nat
; callgroup
; pickupgroup
; language
; allow
; disallow
; insecure
; trustrpid
; progressinband
; promiscredir
; useclientcode
; accountcode
; setvar
; callerid
; amaflags
; callcounter
; busylevel
; allowoverlap
; allowsubscribe
; allowtransfer
; ignoresdpversion
; subscribecontext
; template
; videosupport
; maxcallbitrate
; rfc2833compensate
; mailbox
; session-timers
; session-expires
; session-minse
; session-refresher
; t38pt_usertpsource
; regexten
; fromdomain
; fromuser
; host
; port
; qualify
; defaultip
; defaultuser
; rtptimeout
; rtpholdtimeout
; sendrpid
; outboundproxy
; rfc2833compensate
; callbackextension
; registertrying
; timert1
; timerb
; qualifyfreq
; t38pt_usertpsource
; contactpermit ; Limit what a host may register as (a neat trick
; contactdeny ; is to register at the same IP as a SIP
provider,
; ; then call oneself, and get redirected to that
; ; same location).
;[sip_proxy]
; For incoming calls only. Example: FWD (Free World Dialup)
; We match on IP address of the proxy for incoming calls
; since we can not match on username (caller id)
;type=peer
;context=from-fwd
;host=fwd.pulver.com
;[sip_proxy-out]
;type=peer ; we only want to call out, not be
called
;remotesecret=guessit ; Our password to their service
;defaultuser=yourusername ; Authentication user for outbound
proxies
;fromuser=yourusername ; Many SIP providers require this!
;fromdomain=provider.sip.domain
;host=box.provider.com
;transport=udp,tcp ; This sets the default transport type
to udp for outgoing, and will
; ; accept both tcp and udp. The default
transport type is only used for
; ; outbound messages until a
Registration takes place. During the
; ; peer Registration the transport type
may change to another supported
; ; type if the peer requests so.
;
; Because you might have a large number of similar sections, it is
generally
; convenient to use templates for the common parameters, and add them
; the the various sections. Examples are below, and we can even leave
; the templates uncommented as they will not harm:
[basic-options](!) ; a template
dtmfmode=rfc2833
context=from-office
type=friend
;[xlite1]
; Turn off silence suppression in X-Lite ("Transmit Silence"=YES)!
; Note that Xlite sends NAT keep-alive packets, so qualify=yes is not
needed
;type=friend
;regexten=1234 ; When they register, create extension
1234
;callerid="Jane Smith" <5678>
;host=dynamic ; This device needs to register
;nat=yes ; X-Lite is behind a NAT router
;directmedia=no ; Typically set to NO if behind NAT
;disallow=all
;allow=gsm ; GSM consumes far less bandwidth than
ulaw
;allow=ulaw
;allow=alaw
;mailbox=1234@default,1233@default ; Subscribe to status of multiple
mailboxes
;registertrying=yes ; Send a 100 Trying when the device
registers.
;[snom]
;type=friend ; Friends place calls and receive calls
;context=from-sip ; Context for incoming calls from this
user
;secret=blah
;subscribecontext=localextensions ; Only allow SUBSCRIBE for local
extensions
;language=de ; Use German prompts for this user
;host=dynamic ; This peer register with us
;dtmfmode=inband ; Choices are inband, rfc2833, or info
;defaultip=192.168.0.59 ; IP used until peer registers
;mailbox=1234@context,2345 ; Mailbox(-es) for message waiting
indicator
;subscribemwi=yes ; Only send notifications if this phone
; subscribes for mailbox notification
;vmexten=voicemail ; dialplan extension to reach mailbox
; sets the Message-Account in the MWI
notify message
; defaults to global vmexten which
defaults to "asterisk"
;disallow=all
;allow=ulaw ; dtmfmode=inband only works with ulaw
or alaw!
;[polycom]
;type=friend ; Friends place calls and receive calls
;context=from-sip ; Context for incoming calls from this
user
;secret=blahpoly
;host=dynamic ; This peer register with us
;dtmfmode=rfc2833 ; Choices are inband, rfc2833, or info
;defaultuser=polly ; Username to use in INVITE until peer
registers
;defaultip=192.168.40.123
; Normally you do NOT need to set this
parameter
;disallow=all
;allow=ulaw ; dtmfmode=inband only works with ulaw
or alaw!
;progressinband=no ; Polycom phones don't work properly
with "never"
;[pingtel]
;type=friend
;secret=blah
;host=dynamic
;insecure=port ; Allow matching of peer by IP address
without
; matching port number
;insecure=invite ; Do not require authentication of
incoming INVITEs
;insecure=port,invite ; (both)
;qualify=1000 ; Consider it down if it's 1 second to
reply
; Helps with NAT session
; qualify=yes uses default value
;qualifyfreq=60 ; Qualification: How often to check for
the
; host to be up in seconds
; Set to low value if you use low
timeout for
; NAT of UDP sessions
;
; Call group and Pickup group should be in the range from 0 to 63
;
;callgroup=1,3-4 ; We are in caller groups 1,3,4
;pickupgroup=1,3-5 ; We can do call pick-p for call group
1,3,4,5
;defaultip=192.168.0.60 ; IP address to use if peer has not
registered
;deny=0.0.0.0/0.0.0.0 ; ACL: Control access to this account
based on IP address
;permit=192.168.0.60/255.255.255.0
;permit=192.168.0.60/24 ; we can also use CIDR notation for
subnet masks
;[cisco1]
;type=friend
;secret=blah
;qualify=200 ; Qualify peer is no more than 200ms
away
;nat=yes ; This phone may be natted
; Send SIP and RTP to the IP address
that packet is
; received from instead of trusting SIP
headers
;host=dynamic ; This device registers with us
;directmedia=no ; Asterisk by default tries to redirect
the
; RTP media stream (audio) to go
directly from
; the caller to the callee. Some
devices do not
; support this (especially if one of
them is
; behind a NAT).
;defaultip=192.168.0.4 ; IP address to use until registration
;defaultuser=goran ; Username to use when calling this
device before registration
; Normally you do NOT need to set this
parameter
;setvar=CUSTID=5678 ; Channel variable to be set for all
calls from or to this device
;setvar=ATTENDED_TRANSFER_COMPLETE_SOUND=beep ; This channel variable
will
; cause the given audio
file to
; be played upon
completion of
; an attended transfer.
;[pre14-asterisk]
;type=friend
;secret=digium
;host=dynamic
;rfc2833compensate=yes ; Compensate for pre-1.4 DTMF
transmission from another Asterisk machine.
; You must have this turned on or DTMF
reception will work improperly.
;t38pt_usertpsource=yes ; Use the source IP address of RTP as the
destination IP address for UDPTL packets
; if the nat option is enabled. If a
single RTP packet is received Asterisk will know the
; external IP address of the remote
device. If port forwarding is done at the client side
; then UDPTL will flow to the remote
device.
context=users
[4002]
type=friend
host=dynamic
secret=xlite
context=users
[4003]
type=friend
host=dynamic
secret=xlite
context=users
register=>bootcamp1:[email protected]
[to_sipprovider]
type=peer
context=users
username=bootcamp1
fromuser=bootcamp1
fromdomain=bootcamp.com
secret=bootcamp
canreinvite=no
insecure=invite,port
host=192.168.1.1
deny=0.0.0.0/0
permit=1.1.1.1/255.255.255.255
disallow=all
allow=gsm
allow=ulaw
allow=alaw
qualify=yes
nat=no