Asterisk sip.conf configuration


Below is Open Source Asterisk PBX sip.conf configuration example file. Please edit it for your needs. If you need any help then feel free to put your comments.

; This is the sip.conf file for Opensource Asterisk server. Asterisk can be found on ; ; ; http://www.asterisk.org/
;
; More recent versions of this file can be found on: http://www.syednetworks.com/

; SIP Configuration for Asterisk
;
[general]
;disallow=gsm
;allow=ulaw
port = 5060 ; Port to bind to
bindaddr = 0.0.0.0 ; Address to bind to
context = from-sip ; Default for incoming calls
callerid=No CallID

; These register statements are to REGISTER my Asterisk server
; with certain accounts on remote SIP servers. The inoc-dba,
; FWD, and iconnect (deltathree) registries work, the one for
; coloco does not, due to Vocal problems.
;
; These register= statements must be in context [general]
;
; Note that registering against (some?) Vocal 1.4 servers fails. Bug.
;
; All inbound SIP calls end up in context [from-sip] in extensions.conf
; with the extension of the called number as a match pattern
;
; You can have usernames with “@” signs in them, as the line is parsed
; from rear to front (Thanks, Mark!)
;
register=32767:foo@inoc-dba.pch.net/32767
register=14155551212:9876@sipauth.deltathree.com/14155551212
register=11001:pass-da-word@fwd.pulver.com/11001
register=jtodd:wordtopass@iptel.org/1234567

; Other general settings for the SIP channels that are used
;
; tos=[‘lowdelay’, ‘throughput’, ‘reliability’, ‘mincost’, or ‘none’]
; Sets Type Of Service flags (?)
;
; maxexpirey=3600
; Max duration (seconds) of incoming registration allowed
;
; defaultexpirey=120
; Default length of incoming/outoing registrations
;
;
; Under each peer/user/friend, you can specify some additional notes:
; tos=[‘lowdelay’, ‘throughput’, ‘reliability’, ‘mincost’, or ‘none’]

; The “iconnect” SIP peer is the outbound leg of the iconnecthere.com
; SIP gateway service. Note that the username and password below
; are different than the “register=” line above. I don’t exactly
; know why iconnecthere.com does it this way, but that’s fine with
; me. I only use the “iconnect” peer below to pass outgoing calls
; to their service. Inbound calls are handled out of [general]
;
; The “dtmfmode=inband” is due to the issues that iconnect seems to
; have with RFC2833 DTMF passing, so I send them the tones. I don’t
; know if this works 100% or not; “untested” as of 2003-04-07.
;
[iconnect]
type=friend
secret=9876
username=52671573
host=sipauth.deltathree.com
dtmfmode=inband

; The “fwd” SIP peer is Free World Dialup, run by Jeff Pulver.
; Personally, I haven’t found much use for it, but other people
; swear by it, so I’ve included it…
;
[fwd]
type=friend
secret=pass-da-word
username=11001
host=fwd.pulver.com

; The “iptel” SIP peer is a service provided by IPTEL.org as a
; SIP directory.
;
[iptel]
type=friend
secret=wordtopass
username=jtodd
host=iptel.org

; The “coloco” SIP peer is a Vocal system at Coloco, Inc. in
; Laurel, MD. They are a SIP gateway provider, and I have
; an account with them for local Maryland SIP dialtone.
; http://www.coloco.com/
;
; This simply dumps calls at a Cisco 3640 via SIP. There
; is no username/password required, since this is simply a
; SIP gateway, and not a proxy. Protection provided by
; ACLs on the router.
;
;
[coloco]
context=coloco
type=friend
host=198.180.62.154
dtmf=rfc2833

; INOC-DBA is a terribly useful SIP-only gateway for
; AS# holders. If you don’t know what an AS# is, and if you
; don’t have one, this config subset won’t be useful to you.
; Contact Woody for an extension assignment.
;
; Note: bogus IP address; get from woody yourself
;
[inoc-dba]
type=friend
host=230.61.218.90
username=32767
secret=yoyoyopassword

; My SIP phones in the house/office are listed below
;
; By my own convention (and to save my sanity) I have given
; all the ATA-186 devices in my network “extensions” that
; are numeric. I picked “2200” to start for historical
; laziness. Again, for my sanity, I also made the usernames
; on the phone identical to the extension number of the
; channel.
;
; I distribute IP addresses with a DHCP server to these phones,
; on the network 204.91.156.0/24 or behind a NAT (for some)
;
; All the Cisco ATA-186 units I have are on “real” IP addresses,
; and I haven’t experimented with NAT yet. NAT has been a real
; PITA with the ATA’s, and I don’t relish having to make it work.
;
; Anytime a call is dialed from “2203” or “2204”, it will be
; parsed by the context [intern] in the extensions.conf file
;
; If you want the message waiting light to light up, or stutter
; dialtone, you can set mailbox=[mbox#] – note you can also
; set a comma-delimited list of mailboxes if you want multiples.
;
; You can use “permit=x.x.x.x/yy” lists for hosts that are dynamic
;
; You don’t need to register SIP peers that are static (host=)
;
; Setting “nat=1” is required to get the “Via:” headers to be configured
; correctly so that the Ciscos (and others?) will re-register when
; they are behind a NAT. If nat=1 is set, it will not harm non-NAT
; connections on the Ciscos, but there are reports of other phones
; pingtel) not working if you have nat=1 set and the phone is not
; behind a NAT.
;
[2203]
type=friend
username=2203
secret=c98wh320e
host=204.91.156.6
mailbox=2203
context=intern
canreinvite=yes
dtmfmode=rfc2833

[2204]
type=friend
username=2204
secret=c82ncc8e9w
mailbox=2203
host=204.91.156.6
context=intern
canreinvite=yes
dtmfmode=rfc2833

[2205]
type=friend
username=2205
secret=nonc282dwa
mailbox=2205
host=dynamic
context=intern
dtmfmode=rfc2833
nat=1

[2206]
type=friend
username=2206
secret=cno2o093
mailbox=2206
host=dynamic
context=intern
canreinvite=yes
nat=1

[2207]
type=friend
username=2207
secret=mhh32c02n
host=dynamic
context=intern
canreinvite=yes
nat=1

Be Sociable, Share!

12 Responses to Asterisk sip.conf configuration

  1. vishu gaddi January 6, 2009 at 2:44 am #

    i m having hunderads of sip users in sip.conf.
    is it necessary to write code for all even they are using same functionality.

    is there any way to define variables for users like my users accounts are fron 201 to 290 and 301 to 380

    as :
    [5xx]
    username=5xx
    type=friend

    kindly suggest

  2. admin March 5, 2009 at 11:09 am #

    Wishu, I don’t think if you can use such variables in sip.conf. However I’d like to suggest go for ARA solution and you have huge sip account list. using ARA you will feel easy to manage sip accounts from database in realtime.

  3. Fozia March 19, 2009 at 1:03 pm #

    Hi,

    My Asterisk PBX technical team is facing some problem. We just upgrade from 1.4 to 1.6 and now we see on CLI that insecure=yes/invite is not supported by Asterisk 1.6 version.
    Here is output on CLI:

    [Mar 19 16:14:48] WARNING[4841]: chan_sip.c:20115 set_insecure_flags: Unknown insecure mode ‘very’ on line 1605
    [Mar 19 16:14:48] WARNING[4841]: chan_sip.c:20115 set_insecure_flags: Unknown insecure mode ‘yes’ on line 1622
    [Mar 19 16:14:48] WARNING[4841]: chan_sip.c:20115 set_insecure_flags: Unknown insecure mode ‘yes’ on line 1641
    [Mar 19 16:14:48] WARNING[4841]: chan_sip.c:20115 set_insecure_flags: Unknown insecure mode ‘very’ on line 1653

    Please suggest what should we use instead?
    Thanks in advance

  4. Adhya June 23, 2009 at 8:58 am #

    Hi,

    How to configure for dynamic users? the registrations succeeds but call fails with a “404 response”.
    Kindly assist in this effort.

    Thanks

  5. admin June 23, 2009 at 2:48 pm #

    Adhya, Can you please explain your question in little more detail? Do you mean you can successfully registered your SIP clients with Asterisk but that client is unable to make call? when does this call fail? when someone dial this ext or when you make outbound call from this ext?

  6. Ziv July 20, 2009 at 8:07 am #

    Hi,

    I guess I’m having a similar problem. SIP users register at the Asterisk OK, but how can I forward calls that arrive for dynamically registered users to their remote address?

    I mean that the incoming request-URI is arriving user@asterisk. I need to change the request-uri to contact-uri-of-the-register-request and to forward the message for that remote URI.

    Thanks!

  7. Ceison November 13, 2009 at 9:55 pm #

    I installed new Asterisk version 1.6.1.9. the problem is when i dial an extension that setup in dialplan doesn’t work and i see the following on CLI.

    Using SIP RTP CoS mark 5

    Not sure what does it mean, and how i can fix this issue.

  8. Nalini February 10, 2010 at 11:58 am #

    Hi, I am using asterix1.4 server and x-lite as SIP clients. I have made all the changes in sip.conf and extensions.conf. I am able to register the agents as well. But, when I try to make a call, call is getting established, buut I am unable to hear the voice in the call. Don't know what is the reason for this. Somebody, please help.

  9. admin February 13, 2010 at 7:32 pm #

    Guys, I was alot busy with family and I couldn't answer the question, however i'll try to answer the question that i can.

    vishu gaddi, Your question about if you can use variables in Asterisk sip.conf? I don't think you can use variables in sip.conf, if you have 100 accounts, then you would need to create different account parameter for each sip individual account.

    Please share with others if you find any solution to use variables in sip.conf

  10. admin February 13, 2010 at 7:37 pm #

    Nalini, 

    Can you please share your sip.conf and extensions.conf lines for this user/call. That would be better if you little explain your network diagram. In first guess i think it is NAT issue. But would be able to help once you provide more information.

  11. Thomas Simon April 1, 2011 at 9:10 am #

    Hi Asterisk Users!

    I have found a new software invention for Asterisk. It is a compatible software, which maches perfectly to Asterisk.
    The name of the software: Ozeki Webphone. I have experienced they compose an excellent IT system. You can check the solution
    here: http://www.ozekiphone.com/index.php?owpn=110
    Share your opinion!

  12. Salvin April 17, 2012 at 10:59 am #

    Hi Guys

    I am very new to Asterisk and linux, i just would like to know if Asterisk can act as a mediator to receive calls from one carrier and push that across to another. This is specifically for VoIP and not any other services that run via E1/T1 or bri’s. So let’s say for example i have 3 different carriers(x,yand Z). Let’s say x has an IP address 192.168.17.20, y has an IP address 195.20.1.30, and z has an IP address of 202.62.124.40, and our Asterisk server has an IP address of 207.42.23. So how do i go about first creating all the different peers in Asterisk and then receive and send calls from one peer to another keeping the Asterisk server as the mediator doing call routing. Note the calls are generated from different carrier ends and i also would like to allocate let’s say x number of trunks for each peer.

    I have successfully installed Asterisk on a ubuntu server, with all the required libraries, but now need help in setting this scenario.

    Can i please get some assistance.

Leave a Reply