VoIP Cookbook: Generic SIP configuration

From OnnoWiki
Jump to navigation Jump to search

In [general] section in sip.conf, there are some variables that we can setup, some of which are

allow = <codec> 
; a Codec that is allowed based on preferences. Prior to using this, use disallow=all. 
disallow = all 
;  disallow all codecs to be used. 
allowexternalinvites = yes|no 
; Enable or Disable INVITE & REFER to non-local domain. The default is yes. 
allowguest = yes|no 
; Allows or rejects calls from guest (the default is yes). 
allguest = yes|no 
; Allows or denies the call from guests. The default is yes. 
Autocreatepeer = yes|no 
; If it is set to yes, everyone can easily log in as a peer without a password,
it is usually beneficial for 	operating with SER. The default is no. 
autodomain = yes|no 
; Enable/disable the ability of Asterisk to add local hostnames and
local IP address to domain list. The 	default is no. 
bindaddr = IP_Address 
; IP Address bound as a place for listening to connection. The default is 0.0.0.0 (any interface). 
bindport = Number 
; The UDP port in bind for listening to incoming connections. The default is 5060. 
callerid = <string> 
; Caller ID information that will be used if there is no other information. The default is asterisk. 
canreinvite = update|yes|no 
; The default is yes. 
checkmwi = Number 
; The interval in seconds to check the mailbox. The default is 10 seconds. 
compactheaders = yes|no 
; whether Asterisk will send a SIP header in compact or complete form. The default is no. 
context = <contextname> 
; This is the default context that will be used for telephones that do not have context.
The content of the context can be set in extensions.conf. 
defaultexpirey = Number 
; The default length of time (in seconds) of an incoming or outgoing registration.
The default 120 seconds. 
dtmfmode = inband|info|rfc2833 (global setting) 
; The default is rfc2833. 
domain = domains 
; list of domains separated by comma, a list for which Asterisk is responsible.  
dumphistory = yes|no 
; Enables support for dumping SIP transactions in LOG_DEBUG. The default is no. 
externip = IP_Address or hostnames 
; The address we will place in the SIP messages if we are behind NAT.
If the hostname is used, then the IP address associated with the hostname will be read once
at the time of reading sip.conf. If we want to use the hostname of the dynamic IP,
use externhost parameters. 
externhost = hostname.tld 
externrefresh = Number 
; determines how often (in seconds) DNS checking is carried out for 'externhost'.
The default is 10 seconds. 
ignoreregexpire = yes|no 
; sets whether Contact information from a peer is still used even the information has expired.
The default is no. 
language = <string> 
; The default language used by Playback()/Background(). 
localnet = NetAddress/Netmask 
; Local network and mask. 
fromdomain = <domain> 
; Set default From: domain in SIP message at the time it operates as a SIP ua (client) 
insecure = very|yes|no|invite|port 
; Set how to handle connections with peers. The default is no (authenticate all connections). 
maxexpirey = Number 
: Length of time (in seconds) of incoming registration. The default is 3600 seconds. 
musicclass = one of classes that is used in musiconhold.conf 
musdiconhold = similar to musicclass 
nat=yes|no|never|route 
; The default is no, which means that rfc3581 technique is used. 
notifymimetype = mediatype/subtype 
; Allows to override mime type in MWI NOTIFY used in voicemail online message.
The default is application/simple-message-summary. 
notifyringing = yes|no 
; Call notification is included in ringing stage. The default is yes. 
outboundproxy = IP_address / DNS SRV name (excluding _sip._udp prefix) 
; SRV name, hostname, or IP address of the outbound SIP Proxy. 
outboundproxyport = Number 
; UDP port number for Outbound SIP Proxy. 
pedantic = yes|no 
; enable a slow process to check Call-ID, SIP header with many lines,
and the URI-encoded headers. The default is no. 
port = <portno> 
; The default port for SIP peer. This port is not the port of Asterisk for listening to
incoming calls (see bindport). 
progressinband = never|no|yes 
; whether we should generate in-band ringing. The default is never. 
promiscredir = yes|no 
; Allows support for 302 Redirects; (Note: it will redirect all to local extension available
in contact, not to extension on the final destination).
The default is no. 
qualify = yes|no|milliseconds 
; Check whether the client can be contacted. If set to yes, then the checking will be carried
out every 2000 milliseconds (2 seconds).
The default is no. 
realm = my realm 
; Change authentication realm for the asterisk (default) to what we want. 
recordhistory = yes|no. 
; Enable logging of SIP transactions.
The default is no. 
regcontext = context 
; Default context used to respond to the SIP REGISTER of SIP Registrar. 
register => <username>:<password>:[authid]@<sip client/peer id in sip.conf>/<contact> 
; Register to SIP provider 
registerattempts = Number 
; the number of SIP REGISTER message sent to the SIP Registrar before giving up.
The default is 0 (no limit). 
registertimeout = Number 
; The number of seconds allocated to wait for responds from the SIP Registrar before the SIP REGISTER's  time is up.
The default is 20 seconds. 
relaxdtmf = yes|no 
; The default is no. 
rtautoclear = yes|no|number 
; Auto-Expire friends made while operating. If it is set to yes,
autoexpire will take place in 120 seconds. 
The default is yes. 
rtcachefriends = yes|no 
; Cache realtime friends by adding them to the internal list like friends.
This is added to the config file.
Default is no. 
rtpholdtimeout = Number 
; Length of time in seconds during which there is no activity before disconnecting
a call on hold.
Default is 0 (no limit). 
rtpkeepalive = Number 
; Number of seconds of the interval for RTP keepalive packet if there is no passing traffic.
Default is 0 (no RTP keepalive). 
rtptimeout = Number 
; Number of seconds for waiting for RTP traffic before we hung up.
Default is 0 (no RTP timeout). 
rtupdate = yes|no 
; Send registry updates to the database when using Realtime support. The default is yes. 
sendrpid = yes | no 
; whether the SIP header Remote-Party-ID SIP should be sent.
The default is no. 
sipdebug = yes|no. 
The default setting that determines whether the SIP debug is enabled when loading sip.conf.
The default is no. 
srvlookup = yes|no 
; Enable DNS SRV checks when called upon. The default is no. 
tos = <value> 
; Set QoS of IP parameters for outgoing media streams 
(numeric values are acceptable, such as tos = 	184) 
trustrpid = yes|no 
; whether the SIP header Remote-Party-ID SIP can be trusted. The default is no. 
useclientcode = yes|no: 
usereqphone = yes|no 
; Indicates whether we need to add ";user=phone" to URI. The default is no. 
useragent = <string> 
; Changes the SIP header "User-Agent". The default is asterisk. 
videosupport = yes | no 
; Enables support for SIP video. The default is no. 
vmexten = <string> 
; Dialplan extension to call mailbox. The default  is asterisk. Configuring SIP - peer and client 

The following variables can be used in every peer definition

accountcode = <string> 
; the users who can be associated to accountcode. It is recommended
that you read the concept on Asterisk billing. 
allow = <codec> 
; the CODEC which is allowedbased on order preferences. 
Use first disallow = ALL before allowing CODEC. 
disallow = all 
; Disallow all the CODECs to a given peer or user definition. 
allowguest = yes|no 
; Allow or reject calls from unknown person.
The default is yes. “OSP” can also be set if Asterisk is compiled to support OSP. 
auth = <authname> 
; The content of the Digest username= on a SIP header. 
callerid = <string> 
; The caller ID in use if no information is available. The default is asterisk. 
call-limit = number 
;The number of simultaneous telephone connections that can be made to a specific use/peer. 
callgroup = num1, num2-num3 
; Defines a call group that can call this tool. 
callingpres = number| descriptive_text 
; Set appearance of Caller-ID of a connection/call.
Descriptive text values that can be filled in are 	allowed_not_screened,
allowed_passed_screen, allowed_failed_screen, allowed, prohib_not_screened,
prohib_passed_screen, prohib_failed_screen, prohib, and unavailable.
The default is Allowed_not_screened.
canreinvite = update|yes|no 
; whether the client is able to support SIP re-invites. The default is yes. 
context = <context_name> 
; If type=user, context is for the call going to the SIP user definition.
If type = peer, context in the dialplan is for outbound call of a SIP peer definition.
If type = friend, context is used for all inbound and 	outbound connections to
the SIP entity definition. 
defaultip = ip.add.res.s 
; The default IP address for the client host = if not specified as DYNAMIC. 
This is used if the client had never been registered to use different IP address.
Only valid if the type=peer. 
dtmfmode = inband|info|rfc2833 
; How the client handles DTMF signal. Default is rfc2833. 
fromuser = <from_ID> 
; Determines the user tobe put in "from" other than the callerid (override callerid)
when conducting calls_to_peer  (to another SIP proxy). Valid only for type=peer. 
fromdomain = <domain> 
; Set default From: domain in SIP message when conducting calls _to_ peer.
Valid only in the [general] or type = peer section. 
fullcontact = <sip:uri_contact> 
; SIP URI contact for realtime peer. Valid only for realtime peers. 
host = dynamic|hostname|IPAddr 
; Client - IP address or hostname. If you want the phone to register itself,
use dynamic keywords instead of host IP. 
incominglimit and outgoinglimit = Number 
; Limitation of the number of simultaneous active calls that can be performed by
a SIP client. Valid only for type = peer. 
insecure = very|yes|no|invite|port 
; Determines how to deal with peer connection.
The default is no (authentication for all connections). 
ipaddr = ip.addr.from.peer 
; Valid only for realtime peer. 
language = language code as defined in indications.conf 
; Defining a language for greetings 
mailbox=mailbox 
; Extension for Voicemail. Valid only for type = peer. 
md5secret = MD5-Hash of "<user>: asterisk: <secret>" 
; Can be used as a substitute to secret. 
Musicclass = determines one of classes written in musiconhold.conf 
name = <name> 
; The name of the realtime peer. Valid only for realtime peer only. 
nat = yes | no 
; This variable determines the action pattern of Asterisk for clients behind the NAT.
But it still does not 	solve the problem if Asterisk is behind NAT.
The default is no, which means using the RFC3581 technique. 
outboundproxy = IP_address or DNS SRV name 
; SRV name, hostname, or IP address of the outbound SIP Proxy.
Valid only in the [general] and type = peer section. 
progressinband = never|no|yes 
; Do we generate ring in in-band. The default is never. 
promiscredir=yes|no 
; Allows support for 302 Redirects. The default is no. 
qualify=yes|no|milliseconds 
; Check whether the client can be reached.
If yes, a check will be done every 2000 milliseconds (2 seconds).
Valid only in the [general] and type=peer section. 
regseconds = seconds 
; Time in seconds between SIP REGISTERS. Valid only for realtime peer only. 
rtpkeepalive=seconds 
; The time, in seconds, of sending RTP keepalive packet if there is
no RTP traffic on the connection. Default 0 (no RTP keepalive).
Valid only for the [general] and type=peer section. 
rtptimeout=seconds 
; Disconnect a connection if within x seconds there is no RTP activity and
we are not in on hold position.
Valid only in the [general] and type=peer section. 
rtpholdtimeout = seconds 
; Disconnect a connection if within x seconds there is no RTP activity and
we are in on hold position.
Valid only for the section [general] and type=peer. 
secret=password 
; If Asterisk functions as a SIP Server, then SIP client must login using "password".
If Asterisk functions as a SIP client to a remote SIP server,
it requires SIP INVITE authentication, then the contents of secret 	is used
for SIP INVITE authentication that is sent by Asterisk to the remote server. 
sendrpid=yes|no 
; whether Remote-Party-ID SIP header should be sent. Default is no. 
setvar=variable=value 
; Variable channel which should be set for all connections to this peer / user. 
subscribecontext = <context_name> 
; Set a specific context for SIP SUBSCRIBE requests 
trustrpid=yes|no 
; whether Remote-Party-ID SIP header can be trusted. The default is no. 
type = user|peer|friend 
; connection to the client, outbound provider or a full client? 
usereqphone=yes|no 
; Showing whether to add "; user=phone" to the URI. Default no.
Valid only for the [general] and type=peer section. 
username=<username[@realm]> 
; If functioning as a SIP client to a remote SIP server that requires
SIP INVITE authentication, then this parameter is used for SIP INVITE authentication,
which is sent by Asterisk to a remote SIP server; for peers who will register to Asterisk,
the username is used in INVITE until they are registered. 
vmexten = <string> 
; Dialplan extension to reach mailbox. Default asterisk.
Only valid in the [general] or type=peer section. 



See Also