SIP/2.0 401 Unauthorized

voipnoob
Joined: Sat 12 of Nov, 2011

SIP/2.0 401 Unauthorized

Posted:Sat 12 of Nov, 2011 (10:42 UTC)
Please guys help me solve this problem.

I can dial outbound calls from trunk1 and trunk2 of my Asterisk 1.8 server.
But I'm getting 401 on SIP INVITEs from trunk1.
What's going on? How can I fix that?

Here are my sip.conf and extensions.conf:

;---sip.conf---
[general]
port=5060
dtmfmode=rfc2833
progressinband=never
allow=alaw
allow=ulaw
allowguest=no
alwaysauthreject=yes
context=trunk1-out
register=>t1username:t1password@sip.voip1.com/trunk1-in
register=>sip.voip2.com/trunk2-in

[trunk1]
type=peer
username=t1username
secret=t1password
host=sip.voip1.com
port=5060

[trunk2]
type=peer
host=sip.voip2.com
port=5060

[101]
type=friend
secret=u1password
dtmfmode=rfc2833
canreinvite=no
host=dynamic
nat=yes
port=5060
context=trunk1-out

[102]
type=friend
secret=u2password
dtmfmode=rfc2833
careinvite=no
host=dynamic
nat=yes
port=5060
context=trunk2-out
;---sip.conf---

;---extensions.conf---
[trunk1-in]
exten => _X.,1,Dial(SIP/101)

[trunk1-out]
exten => _X.,2,Dial(SIP/${EXTEN}@trunk1)

[trunk2-in]
exten => _X.,1,Dial(SIP/102)

[trunk2-out]
exten => _X.,1,Dial(SIP/${EXTEN}@trunk2)
;---extensions.conf---