1

When I attempt to connect to the Asterisk server from CSipSimple, over a Cisco router, on the same network, Asterisk logs show the attempted connection:

<------------->
[Mar 23 20:01:34] VERBOSE[4067] chan_sip.c: [Mar 23 20:01:34] --- (8 headers 0 lines) ---
[Mar 23 20:01:34] NOTICE[4067] chan_sip.c: Outbound Registration: Expiry for nat5.babytel.ca is 55 sec (Scheduling reregistration in 40 s)
[Mar 23 20:01:34] VERBOSE[4067] chan_sip.c: [Mar 23 20:01:34] Really destroying SIP dialog '5e070a0021f200c72308ddad6fe2521c@192.168.0.99' Method: REGISTER
[Mar 23 20:02:01] VERBOSE[20423] manager.c: [Mar 23 20:02:01]   == Manager 'sendcron' logged on from 127.0.0.1
[Mar 23 20:02:01] VERBOSE[20423] manager.c: [Mar 23 20:02:01]   == Manager 'sendcron' logged off from 127.0.0.1
[Mar 23 20:02:06] VERBOSE[20436] manager.c: [Mar 23 20:02:06]   == Manager 'sendcron' logged on from 127.0.0.1
[Mar 23 20:02:06] VERBOSE[20436] manager.c: [Mar 23 20:02:06]   == Manager 'sendcron' logged off from 127.0.0.1
[Mar 23 20:02:10] VERBOSE[4067] chan_sip.c: [Mar 23 20:02:10]
<--- SIP read from UDP:192.168.0.15:39462 --->
REGISTER sip:192.168.0.99 SIP/2.0
v: SIP/2.0/UDP 99.99.99.99:39462;rport;branch=z9hG4bKPjiUEFUHN08Wvs9xG2Q9tzRMOxFYJ323dO
Route: <sip:192.168.0.99;transport=udp;lr>
Max-Forwards: 70
f: <sip:201@192.168.0.99>;tag=HVPwJ.kg.9MW6PypcpObrVPGC3l3B-Uh
t: <sip:201@192.168.0.99>
i: QIsF0rZ0wYvzKC9S2P0rWhnYGsQ9FQbI
CSeq: 56288 REGISTER
User-Agent: CSipSimple_v1-16/r2457
m: <sip:201@99.99.99.99:39462;ob>;+sip.ice
Expires: 900
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
l: 0

<------------->
[Mar 23 20:02:10] VERBOSE[4067] chan_sip.c: [Mar 23 20:02:10] --- (13 headers 0 lines) ---
[Mar 23 20:02:10] VERBOSE[4067] chan_sip.c: [Mar 23 20:02:10] Sending to 192.168.0.15:39462 (NAT)
[Mar 23 20:02:10] VERBOSE[4067] chan_sip.c: [Mar 23 20:02:10]
<--- Transmitting (NAT) to 192.168.0.15:39462 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 99.99.99.99:39462;branch=z9hG4bKPjiUEFUHN08Wvs9xG2Q9tzRMOxFYJ323dO;received=192.168.0.15;rport=39462
From: <sip:201@192.168.0.99>;tag=HVPwJ.kg.9MW6PypcpObrVPGC3l3B-Uh
To: <sip:201@192.168.0.99>;tag=as0986faf4
Call-ID: QIsF0rZ0wYvzKC9S2P0rWhnYGsQ9FQbI
CSeq: 56288 REGISTER
Server: Asterisk PBX 1.8.29.0-vici
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="10600450"
Content-Length: 0

CSipSimple itself fails to connect to the local Asterisk server.

Because Jitsi shows similar errors, it doesn't seem to be client specific. Because both Jitsi on a Mac and CSipSimple on an Android phone can make voice calls out, that, to my mind, positively eliminates a firewall on the router as a cause.

In the meantime, I've disabled the firewall on the server to eliminate that as a potential issue, which, admittedly, probably, wasn't necessary.

When Asterisk replies with 401 Unauthorized how do I know why the connection is unauthorized?

The full log is too large to post here. While sip set debug on didn't provide any output, the output from that command is here, although that was with Jitsi.

1

The 401 Unauthorized isn't an error: is how authentication mechanism works on SIP (see this answer)

The line:

[Mar 23 20:02:10] NOTICE[4067] chan_sip.c: Registration from '<sip:201@192.168.0.99>' failed for '192.168.0.15:39462' - Wrong password

Seems clear: the password in your SIP client is wrong and the authentication doesn't succeed. SIP password in sip.conf by the "secret" parameter inside your peer definition (201).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.