# Failed to authenticate on INVITE - SIP/2.0 403 Forbidden

**URL:** <https://community.asterisk.org/t/failed-to-authenticate-on-invite-sip-2-0-403-forbidden/46416>\
**Category:** Asterisk Support\
**Created:** [June 16, 2014, 12:04pm UTC](https://community.asterisk.org/t/failed-to-authenticate-on-invite-sip-2-0-403-forbidden/46416 "2014-06-16T12:04:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jilirio](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@jilirio](https://community.asterisk.org/u/jilirio)\
**Post date:** [June 16, 2014, 12:04pm UTC](https://community.asterisk.org/t/failed-to-authenticate-on-invite-sip-2-0-403-forbidden/46416/1 "2014-06-16T12:04:10Z")

</div>

I have two telephony servers running on the same subnet, TS1 (172.19.57.42/255.255.255.252.0) and TS2(172.19.57.44/255.255.255.252.0) Asterisk running and a SIP trunk (totelephony) between them.

There are no problems when dialling SIP extensions belonging to the same TS but I cannot call SIP extensions from TS2 to TS1 or in the other way around. During this test I used: 4755 extension registered in TS1 and 4811 registered in TS2 and tried to make a call from 4811 to 4755, here is the outcome:

On both sites, TS1 and TS2 in SIP.conf:  
[totelephony]  
type=peer  
host=172.19.57.44 -\> in TS1  
host=172.19.57.42 -\> in TS2  
context=dialler  
disallow=all  
allow=alaw  
canreinvite=no  
insecure=port,invite

On TS1 in sip.conf  
[4755]  
type=friend  
secret=4811  
port=5060  
host=dynamic  
dtmfmode=rfc2833  
context=from-internal  
canreinvite=no  
disallow=all  
allow=alaw

On TS2 in sip.conf:  
[4811]  
type=friend  
secret=4811  
port=5060  
host=dynamic  
dtmfmode=rfc2833  
context=from-internal  
canreinvite=no  
disallow=all  
allow=alaw

On both sites, TS1 and TS2, in extensions.conf  
[from-internal]  
exten =\> \_554XXX,1,Dial(SIP/totelephony/${EXTEN:2})  
exten =\> \_554XXX,2,Hangup()

exten =\> \_4XXX,1,Dial(SIP/${EXTEN})  
exten =\> \_4XXX,2,Hangup()

SIP logs:

[Jun 16 11:53:11] VERBOSE[13585] logger.c:  
\<— SIP read from 172.19.41.195:5060 —\>  
INVITE [sip:554755@172.19.57.44](mailto:sip:554755@172.19.57.44);transport=UDP SIP/2.0  
Via: SIP/2.0/UDP 172.19.41.195:5060;branch=z9hG4bK-d8754z-2463e75d7bf86691-1—d8754z-;rport  
Max-Forwards: 70  
Contact: sip:4811@172.19.41.195:5060;transport=UDP  
To: sip:554755@172.19.57.44;transport=UDP  
From: sip:4811@172.19.57.44;transport=UDP;tag=1620a86d  
Call-ID: YjQ3OTI4MjIxNmQ5NDA3MmIzZmQ4YzjU.  
CSeq: 1 INVITE  
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO  
Content-Type: application/sdp  
User-Agent: Zoiper for Windows rev.2875  
Content-Length: 208

[Jun 16 11:53:11] VERBOSE[13585] logger.c:  
\<— Reliably Transmitting (no NAT) to 172.19.41.195:5060 —\>  
SIP/2.0 407 Proxy Authentication Required  
Via: SIP/2.0/UDP 172.19.41.195:5060;branch=z9hG4bK-d8754z-2463e75d7bf86691-1—d8754z-;received=172.19.41.195;rport=5060  
From: sip:4811@172.19.57.44;transport=UDP;tag=1620a86d  
To: sip:554755@172.19.57.44;transport=UDP;tag=as65fb9e7d  
Call-ID: YjQ3OTI4MjIxNmQ5NDA3MmIzZUzZjU.  
CSeq: 1 INVITE  
User-Agent: Asterisk PBX  
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO  
Supported: replaces  
Proxy-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="4e769d22"  
Content-Length: 0

[Jun 16 11:53:11] VERBOSE[13585] logger.c:  
\<— SIP read from 172.19.41.195:5060 —\>  
ACK [sip:554755@172.19.57.44](mailto:sip:554755@172.19.57.44);transport=UDP SIP/2.0  
Via: SIP/2.0/UDP 172.19.41.195:5060;branch=z9hG4bK-d8754z-275d7bf86691-1—d8754z-;rport  
To: sip:554755@172.19.57.44;transport=UDP;tag=as65f9e7d  
From: sip:4811@172.19.57.44;transport=UDP;tag=162a86d  
Call-ID: YjQ3OTI4MjIxNmQ5NDA3MmIzZmQ4YzMxMjYzMGUzZjU.  
CSeq: 1 ACK  
Content-Length: 0

[Jun 16 11:53:11] VERBOSE[13585] logger.c:  
\<— SIP read from 172.19.41.195:5060 —\>  
INVITE [sip:554755@172.19.57.44](mailto:sip:554755@172.19.57.44);transport=UDP SIP/2.0  
Via: SIP/2.0/UDP 172.19.41.195:5060;branch=z9hG4bK-d8754z-96682b7d500ec-1—d8754z-;rport  
Max-Forwards: 70  
Contact: sip:4811@172.19.41.195:5060;transport=UDP  
To: sip:554755@172.19.57.44;transport=UDP  
From: sip:4811@172.19.57.44;transport=UDP;tag=1620a86d  
Call-ID: YjQ3OTI4MjIxNmQ5NDA3MmIzZmQ4YzMxMjYzMGUzZjU.  
CSeq: 2 INVITE  
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO  
Content-Type: application/sdp  
Proxy-Authorization: Digest [username=“4811”,realm=“asterisk”,nonce=“4e769d22”,uri="sip:554755@172.19.57.44](mailto:username=%224811%22,realm=%22asterisk%22,nonce=%224e769d22%22,uri=%22sip:554755@172.19.57.44);transport=UDP",response=“d203e3bdedc3a37f78ffddd6eb9a225e”,algorithm=MD5  
User-Agent: Zoiper for Windows rev.2875  
Content-Length: 208

[Jun 16 11:53:11] VERBOSE[13585] logger.c: Looking for 554755 in from-internal (domain 172.19.57.44)  
[Jun 16 11:53:11] VERBOSE[13585] logger.c: list\_route: hop: sip:4811@172.19.41.195:5060;transport=UDP  
[Jun 16 11:53:11] VERBOSE[13585] logger.c:  
\<— Transmitting (NAT) to 172.19.41.195:5060 —\>  
SIP/2.0 100 Trying  
Via: SIP/2.0/UDP 172.19.41.195:5060;branch=z9hG4bK-d8754z-96682b32f7d500ec-1—d8754z-;received=172.19.41.195;rport=5060  
From: sip:4811@172.19.57.44;transport=UDP;tag=1620a86d  
To: sip:554755@172.19.57.44;transport=UDP  
Call-ID: YjQ3OTI4MjIxNmQ5NDA3MmIzZmQ4YzMzMGUzZjU.  
CSeq: 2 INVITE  
User-Agent: Asterisk PBX  
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO  
Supported: replaces  
Contact: sip:554755@172.19.57.44  
Content-Length: 0

[Jun 16 11:53:11] VERBOSE[19077] logger.c: – Executing [554755@from-internal:1] Dial(“SIP/4811-00000f40”, “SIP/totelephony/4755”) in new stack  
[Jun 16 11:53:11] VERBOSE[19077] logger.c: Audio is at 172.19.57.44 port 14942  
[Jun 16 11:53:11] VERBOSE[19077] logger.c: Adding codec 0x8 (alaw) to SDP  
[Jun 16 11:53:11] VERBOSE[19077] logger.c: Adding non-codec 0x1 (telephone-event) to SDP  
[Jun 16 11:53:11] VERBOSE[19077] logger.c: Reliably Transmitting (no NAT) to 172.19.57.42:5060:  
INVITE [sip:4755@172.19.57.42](mailto:sip:4755@172.19.57.42) SIP/2.0  
Via: SIP/2.0/UDP 172.19.57.44:5060;branch=z9hG4bK4fe655ba;rport  
From: “device” sip:4811@172.19.57.44;tag=as54fef7f4  
To: sip:4755@172.19.57.42  
Contact: sip:4811@172.19.57.44  
Call-ID: [1609872a73662819562bafc20875be5a@172.19.57.44](mailto:1609872a73662819562bafc20875be5a@172.19.57.44)  
CSeq: 102 INVITE  
User-Agent: Asterisk PBX  
Max-Forwards: 70  
Date: Mon, 16 Jun 2014 09:53:11 GMT  
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO  
Supported: replaces  
Content-Type: application/sdp  
Content-Length: 213

[Jun 16 11:53:11] VERBOSE[13585] logger.c:  
\<— SIP read from 172.19.57.42:5060 —\>  
SIP/2.0 407 Proxy Authentication Required  
Via: SIP/2.0/UDP 172.19.57.44:5060;branch=z9hG4bK4fe655ba;received=172.19.57.44;rport=5060  
From: “device” sip:4811@172.19.57.44;tag=as54fef7f4  
To: sip:4755@172.19.57.42;tag=as1c71ac32  
Call-ID: [1609872a73662819562bafc20875be5a@172.19.57.44](mailto:1609872a73662819562bafc20875be5a@172.19.57.44)  
CSeq: 102 INVITE  
User-Agent: Asterisk PBX  
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO  
Supported: replaces  
Proxy-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="290a924f"  
Content-Length: 0

\<-------------\>  
[Jun 16 11:53:11] VERBOSE[13585] logger.c: — (11 headers 0 lines) —  
[Jun 16 11:53:11] VERBOSE[13585] logger.c: Transmitting (no NAT) to 172.19.57.42:5060:  
ACK [sip:4755@172.19.57.42](mailto:sip:4755@172.19.57.42) SIP/2.0  
Via: SIP/2.0/UDP 172.19.57.44:5060;branch=z9hG4bK4fe655ba;rport  
From: “device” sip:4811@172.19.57.44;tag=as54fef7f4  
To: sip:4755@172.19.57.42;tag=as1c71ac32  
Contact: sip:4811@172.19.57.44  
Call-ID: [1609872a73662819562bafc20875be5a@172.19.57.44](mailto:1609872a73662819562bafc20875be5a@172.19.57.44)  
CSeq: 102 ACK  
User-Agent: Asterisk PBX  
Max-Forwards: 70  
Content-Length: 0

* * *

[Jun 16 11:53:11] NOTICE[13585] chan\_sip.c: Failed to authenticate on INVITE to ‘“device” sip:4811@172.19.57.44;tag=as54fef7f4’  
[Jun 16 11:53:11] VERBOSE[19077] logger.c: – SIP/totelephony-00000f41 is circuit-busy  
[Jun 16 11:53:11] VERBOSE[19077] logger.c: == Everyone is busy/congested at this time (1:0/1/0)  
[Jun 16 11:53:11] VERBOSE[19077] logger.c: – Executing [554755@from-internal:2] Hangup(“SIP/4811-00000f40”, “”) in new stack  
[Jun 16 11:53:11] VERBOSE[13585] logger.c: Really destroying SIP dialog ‘1609872a73662819562bafc20875be5a@172.19.57.44’ Method: INVITE  
[Jun 16 11:53:11] VERBOSE[19077] logger.c: == Spawn extension (from-internal, 554755, 2) exited non-zero on ‘SIP/4811-00000f40’  
[Jun 16 11:53:11] VERBOSE[19077] logger.c: Scheduling destruction of SIP dialog ‘YjQ3OTI4MjIxNmQ5NDA3MmIzZmQ4YzYzMGUzZjU.’ in 32000 ms (Method: INVITE)  
[Jun 16 11:53:11] VERBOSE[19077] logger.c:

\<— Reliably Transmitting (NAT) to 172.19.41.195:5060 —\>  
SIP/2.0 403 Forbidden  
Via: SIP/2.0/UDP 172.19.41.195:5060;branch=z9hG4bK-d8754z-96682b32f7d500ec-1—d8754z-;received=172.19.41.195;rport=5060  
From: sip:4811@172.19.57.44;transport=UDP;tag=1620a86d  
To: sip:554755@172.19.57.44;transport=UDP;tag=as7111b7f7  
Call-ID: YjQ3OTI4MjIxNmQ5NDA3ZmQ4YzMxMjYzMGUzZjU.  
CSeq: 2 INVITE  
User-Agent: Asterisk PBX  
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO  
Supported: replaces  
Content-Length: 0

I know I am missing something but I cannot find what and right now I am a bit loss. Any help would be greatly appreciated. Thanks.
