401 UnAuthorized

Hi, can anyone help me with this issue, I set the Asterisk server up on a local network, where it has been on test, all was working fine until I connected the server directly to the internet, now ALL extenions (hard or soft coded) get 401 ?

II’ve checked and update sip.conf, I’ve disablled the firewall, still no joy,

can anyone suggest a place to start?

Thanks

<-- SIP read from 87.81.189.65:5060:
REGISTER sip:dwt4.co.uk SIP/2.0
Via: SIP/2.0/UDP 192.168.0.2:5060;branch=z9hG4bKiBdzzNed96oBX3Yw;rport
Max-Forwards: 70
User-Agent: DexWeb Telecom V1.54.004 CFG0
From: “721020” sip:721020@dwt4.co.uk;tag=8mBSSnsSzb2YT1ln
To: “721020” sip:721020@dwt4.co.uk
Call-ID: cYXq6znLxXky0fdj@192.168.0.2
CSeq: 8502 REGISTER
Contact: sip:721020@192.168.0.2:5060
Expires: 110
Content-Length: 0

— (11 headers 0 lines) —
Using latest REGISTER request as basis request
Sending to 192.168.0.2 : 5060 (NAT)
Transmitting (NAT) to 87.81.189.65:5060:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.0.2:5060;branch=z9hG4bKiBdzzNed96oBX3Yw;received=87.81.189.65;rport=5060
From: “721020” sip:721020@dwt4.co.uk;tag=8mBSSnsSzb2YT1ln
To: “721020” sip:721020@dwt4.co.uk
Call-ID: cYXq6znLxXky0fdj@192.168.0.2
CSeq: 8502 REGISTER
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Contact: sip:721020@87.117.208.70
Content-Length: 0


Transmitting (NAT) to 87.81.189.65:5060:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.0.2:5060;branch=z9hG4bKiBdzzNed96oBX3Yw;received=87.81.189.65;rport=5060
From: “721020” sip:721020@dwt4.co.uk;tag=8mBSSnsSzb2YT1ln
To: “721020” sip:721020@dwt4.co.uk;tag=as65da2e1b
Call-ID: cYXq6znLxXky0fdj@192.168.0.2
CSeq: 8502 REGISTER
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
WWW-Authenticate: Digest algorithm=MD5, realm=“dwt4.co.uk”, nonce="49468c34"
Content-Length: 0

can you show us you sip.conf (only one account if you want…)

I am having the same problem. New asterisk setup and none of the sip phones can connect to it.
here is my sip.conf for one account:
[123]
type=friend
secret=secret
record_out=Adhoc
record_in=Adhoc
qualify=yes
port=5060
nat=yes
mailbox=123@device
host=dynamic
dtmfmode=rfc2833
dial=SIP/123
context=from-internal
canreinvite=no
callerid=device <123>

I get exactly the same sip messages as the original poster, so I didn’t want to start a new thread.

Thanks

Thanks for the responses, I have several Asterisk servers but this is the first that refuses to register any SIP phones,

I now copied the database, Asterisk files and IPtables from another server which is working, I have phones taht log on without any problem to other servers, but not to this one. Yet in the workshop this server worked well,

Here is a static sip

[752000]
type=friend
username=752000
secret=51fkpy45468uYt
host=dynamic
callerid=Test <752000>
canreinvite=no
qualify=no
port=5060
context=default
dtmfmode=rfc2833
mailbox=752000
nat=1

Thanks again

I figured out what my problem was.
Since the phones are behind NAT, the SIP messages from server only get to the phone if they are sent from the IP address phone is sending messages to. On my new server IP block was routed through the different IP, so phone was sending SIP message to one IP and getting response from the other, since asterisk just used the first IP from server card config.
All started working when I specified IP address to bind to in sip.conf instead of “bind to all” (used the same address phone is trying to connect to).