title: Asterisk: Connecting an Asterisk System To SIP Provider
body: <p>Setup:<br>
  Centos 6<br>
  OS: Linux CentOS 64-Bit<br>
  CPU: Intel® Core™ i7 - 4 cores</p>
  
  <p>Asterisk 11<br>
  libpri 1.4<br>
  dahdi 2.9.1<br></p>
  
  <p><hr>
  I want to send calls to my SIP provider via asterisk. I want to use a softphone to make outgoing calls, when I make outgoing calls on the softphone it needs to route through my asterisk server and then out to the SIP Provider. Currently when I make an outbound call it produces a "Failed to authenticate" and status is 'CONGESTION' notices.</p>
  
  <p>My question is simple: Since my softphone is calling from "User1" (as shown below) What do I need to write in my sip.conf and extensions.conf files in order for the SIP provider to make the outgoing call for me?</p>
  
  <p>My Thoughts: <br>
  I feel like I am missing a part of the process, like how User1 is set up to handle outgoing calls...</p>
  
  <p>See an overview of how I set these two files up currently:</p>
  
  <p>notes: <br>- all username and passwords have been removed for this post.<br> - sip.us is the sip provider</p>
  
  <p>sip.conf:</p>
  
  <pre><code>[general]
  transport=udp
  register =&gt; username:password@gw1.sip.us
  
  [myprovider]
  
  type=peer
  insecure=port,invite
  host=gw1.sip.us
  port=5060
  dtmfmode=rfc2833
  canrevinvite=no
  disallow=all
  allow=ulaw
  qualify=yes
  qualifyfreq=30
  nat=force_rport,comedia
  trustrpid=yes
  fromdomain=gw1.sip.us
  username=*****
  secret=*****
  context=from-trunk
  rfc2833compensate=yes
  session-timers=refuse
  
  
  [friends_internal](!)
  type=friend
  host=dynamic
  context=users
  disallow=all
  allow=ulaw
  allow=alaw
  
  [user1](friends_internal)
  secret=****
  [user2](friends_internal)
  secret=****
  </code></pre>
  
  <p>now the extensions.conf:</p>
  
  <pre><code>...
  ...    
  exten=&gt;_1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@gw1.sip.us)
  
  [users]
  exten=&gt;6001,1,Dial(SIP/user1,20)
  exten=&gt;6002,1,Dial(SIP/user2,20)
  </code></pre>
  
  <p>now the asterisk cli output when i try making an outgoing call using softphone:</p>
  
  <pre><code>  == Using SIP RTP CoS mark 5
    -- Executing [12015550155@users:1] Dial("SIP/user1-0000001e",
    "SIP/12015550155@gw1.sip.us") in new stack
    == Using SIP RTP CoS mark 5
    -- Called SIP/12015550155@gw1.sip.us
    [May  4 10:02:13] NOTICE[28935][C-0000002a]: chan_sip.c:23094 
    handle_response_invite:    Failed to authenticate on INVITE to 
    '&lt;sip:user1@501.62.174.2&gt;;tag=as798e5009'
    -- SIP/gw1.sip.us-0000001f is circuit-busy
    == Everyone is busy/congested at this time (1:0/1/0)
    -- Auto fallthrough, channel 'SIP/user1-0000001e' status is 'CONGESTION'
  </code></pre>
  
  <p>asterisk cli> sip show registery</p>
  
  <pre><code>Host               dnsmgr Username       Refresh State      Reg.Time                 
  gw1.sip.us:5060    N      username       105     Registered  Sun, 04 May 2014 10:28:05
  1 SIP registrations.
  </code></pre>
  
  <p>asterisk cli> sip show peers</p>
  
  <pre><code>Name/username     Host     Dyn Forcerport Comedia  ACL Port  Status                     
  user1/user1       68.198.. D   Auto (No)   No          55461 Unmonitored                                  
  user2/user2         68.198..   D   Auto (No)   No      55461 Unmonitored                                  
  myprovider/username 65.254.44.194 Yes     Yes           5060 OK (42 ms)             
  </code></pre>