SIP Trunk problem - NAT - 2 networks

Hi everybody! Thnxs for reading in advance
I’m driving me crazy, I can’t find a solution for my problem. I’ve struggled long hours, so I decided to ask for help

At first, I’ll tell you THE problem, all working ok, but incoming calls end because of nat (I think) after 30 seconds.
Asterisk has 2 network boards, static public ip, extensions connected from outside the site. One of the boards is connected to a sip trunk, I’ve NAT enabled. Audio for both sides
In a SIP debug, I see “Retransmitting #10 (NAT) to 111.111.3.10:5060:” in INVITEs, but I think that is wrong the contact info (I see the public IP, where I think should be the eth1’s IP), so I think it is the problem, and I don’t know how to solve it

Hope somebody can help me

Thnx again

I changed IPs, just for security

Asterisk 11.25.3

2 network boards (eth0 network/internet, eth1 sip trunk)

eth0 Link encap:Ethernet HWaddr 78:2B:CB:AE:0E:16
inet addr:192.168.10.223 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: xxxx::7a2b:cbff:feae:e16/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:98692 errors:0 dropped:0 overruns:0 frame:0
TX packets:85077 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16984481 (16.1 MiB) TX bytes:73086281 (69.7 MiB)
Interrupt:20 Memory:e1c00000-e1c20000

eth1 Link encap:Ethernet HWaddr 7C:8B:CA:00:3D:7C
inet addr:111.111.64.149 Bcast:111.111.64.151 Mask:255.255.255.252
inet6 addr: xxxx::7e8b:caff:fe00:3d7c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29770 errors:0 dropped:0 overruns:0 frame:0
TX packets:27269 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6193913 (5.9 MiB) TX bytes:6111981 (5.8 MiB)


Trunk:

Trunk name: Telec
host=111.111.3.10
type=peer
context=from-trunk
fromdomain=111.111.64.149
disallow=all
allow=alaw


Public IP

Public IP 222.222.234.123


route -n

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
111.111.3.10 111.111.64.150 255.255.255.255 UGH 0 0 0 eth1
111.111.64.148 0.0.0.0 255.255.255.252 U 0 0 0 eth1
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth0
0.0.0.0 192.168.10.1 0.0.0.0 UG 0 0 0 eth0


sip.conf

nat=yes
allowguest=no
externip=222.222.234.123
localnet=192.168.10.0/24
localnet=111.111.64.148/30


SIP debug, an external call from 1166667777 to 1122223333, ext 4466

[2020-06-04 20:19:39] VERBOSE[3787][C-0000000e] netsock2.c:   == Using SIP RTP CoS mark 5
[2020-06-04 20:19:39] VERBOSE[3787][C-0000000e] app_dial.c:     -- Called SIP/4466
[2020-06-04 20:19:39] VERBOSE[3787][C-0000000e] app_dial.c:     -- Connected line update to SIP/Telec-0000000e prevented.
[2020-06-04 20:19:39] VERBOSE[3787][C-0000000e] app_dial.c:     -- SIP/4466-0000000f is ringing
[2020-06-04 20:19:42] VERBOSE[3787][C-0000000e] app_dial.c:     -- Connected line update to SIP/Telec-0000000e prevented.
[2020-06-04 20:19:42] VERBOSE[3787][C-0000000e] app_dial.c:     -- SIP/4466-0000000f answered SIP/Telec-0000000e
[2020-06-04 20:19:46] VERBOSE[2409] chan_sip.c: Retransmitting #5 (NAT) to 111.111.3.10:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 111.111.3.10:5060;branch=z9hG4bK+86e463137aecf9f409ba8a15f76dc3591+sip+6+aff49b2b;received=111.111.3.10;rport=5060
From: <sip:1166667777@111.111.3.10:5060>;tag=111.111.3.10+6+d582edab+d0c78e7e
To: <sip:1122223333@111.111.64.149>;tag=as2e963a0b
Call-ID: 0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10
CSeq: 56524576 INVITE
Server: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:1122223333@222.222.234.123:5060>
Content-Type: application/sdp
Content-Length: 238

v=0
o=root 190755527 190755527 IN IP4 222.222.234.123
s=Asterisk PBX 11.25.3
c=IN IP4 222.222.234.123
t=0 0
m=audio 10940 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---
[2020-06-04 20:19:50] VERBOSE[2409] chan_sip.c: Retransmitting #6 (NAT) to 111.111.3.10:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 111.111.3.10:5060;branch=z9hG4bK+86e463137aecf9f409ba8a15f76dc3591+sip+6+aff49b2b;received=111.111.3.10;rport=5060
From: <sip:1166667777@111.111.3.10:5060>;tag=111.111.3.10+6+d582edab+d0c78e7e
To: <sip:1122223333@111.111.64.149>;tag=as2e963a0b
Call-ID: 0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10
CSeq: 56524576 INVITE
Server: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:1122223333@222.222.234.123:5060>
Content-Type: application/sdp
Content-Length: 238

v=0
o=root 190755527 190755527 IN IP4 222.222.234.123
s=Asterisk PBX 11.25.3
c=IN IP4 222.222.234.123
t=0 0
m=audio 10940 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---
[2020-06-04 20:19:54] VERBOSE[2409] chan_sip.c: Retransmitting #7 (NAT) to 111.111.3.10:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 111.111.3.10:5060;branch=z9hG4bK+86e463137aecf9f409ba8a15f76dc3591+sip+6+aff49b2b;received=111.111.3.10;rport=5060
From: <sip:1166667777@111.111.3.10:5060>;tag=111.111.3.10+6+d582edab+d0c78e7e
To: <sip:1122223333@111.111.64.149>;tag=as2e963a0b
Call-ID: 0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10
CSeq: 56524576 INVITE
Server: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:1122223333@222.222.234.123:5060>
Content-Type: application/sdp
Content-Length: 238

v=0
o=root 190755527 190755527 IN IP4 222.222.234.123
s=Asterisk PBX 11.25.3
c=IN IP4 222.222.234.123
t=0 0
m=audio 10940 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---
[2020-06-04 20:19:58] VERBOSE[2409] chan_sip.c: Retransmitting #8 (NAT) to 111.111.3.10:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 111.111.3.10:5060;branch=z9hG4bK+86e463137aecf9f409ba8a15f76dc3591+sip+6+aff49b2b;received=111.111.3.10;rport=5060
From: <sip:1166667777@111.111.3.10:5060>;tag=111.111.3.10+6+d582edab+d0c78e7e
To: <sip:1122223333@111.111.64.149>;tag=as2e963a0b
Call-ID: 0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10
CSeq: 56524576 INVITE
Server: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:1122223333@222.222.234.123:5060>
Content-Type: application/sdp
Content-Length: 238

v=0
o=root 190755527 190755527 IN IP4 222.222.234.123
s=Asterisk PBX 11.25.3
c=IN IP4 222.222.234.123
t=0 0
m=audio 10940 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---
[2020-06-04 20:20:00] VERBOSE[2409] chan_sip.c: 
<--- SIP read from UDP:192.168.10.252:5060 --->


<------------->
[2020-06-04 20:20:02] VERBOSE[2409] chan_sip.c: Retransmitting #9 (NAT) to 111.111.3.10:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 111.111.3.10:5060;branch=z9hG4bK+86e463137aecf9f409ba8a15f76dc3591+sip+6+aff49b2b;received=111.111.3.10;rport=5060
From: <sip:1166667777@111.111.3.10:5060>;tag=111.111.3.10+6+d582edab+d0c78e7e
To: <sip:1122223333@111.111.64.149>;tag=as2e963a0b
Call-ID: 0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10
CSeq: 56524576 INVITE
Server: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:1122223333@222.222.234.123:5060>
Content-Type: application/sdp
Content-Length: 238

v=0
o=root 190755527 190755527 IN IP4 222.222.234.123
s=Asterisk PBX 11.25.3
c=IN IP4 222.222.234.123
t=0 0
m=audio 10940 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---
[2020-06-04 20:20:03] VERBOSE[2409] chan_sip.c: Really destroying SIP dialog '0gQAAC8WAAACBAAALxYAAJa26xmPlKr8wixeofhzyRdMoaLor7v3oik715/n3IFF@111.111.3.10' Method: OPTIONS
[2020-06-04 20:20:05] VERBOSE[2409] chan_sip.c: 
<--- SIP read from UDP:111.111.3.10:5060 --->
OPTIONS sip:metaswitch@111.111.64.149:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP 111.111.3.10:5060;branch=z9hG4bK+2183e4ea3ff7dd836b11c1e3bf15c7731+sip+2+b00889c8
From: <sip:metaswitch@111.111.3.10:5060>;tag=111.111.3.10+2+6eb16302+c68d2e13
Content-Length: 0
Supported: resource-priority, siprec, 100rel
To: <sip:metaswitch@111.111.64.149>
Contact: <sip:941235c91a33e3b43cf7d85de76db36e@111.111.3.10>
Allow-Events: message-summary, refer, dialog, line-seize, presence, call-info, as-feature-event, calling-name
Max-Forwards: 69
Call-ID: 0gQAAC8WAAACBAAALxYAAAF+Gn9XKilc3HNYnZtDoflCIM8wf/st6To/NgxdE2mM@111.111.3.10
CSeq: 699873511 OPTIONS
Organization: Metaswitch Networks
Accept: application/sdp, application/dtmf-relay

<------------->
[2020-06-04 20:20:05] VERBOSE[2409] chan_sip.c: --- (13 headers 0 lines) ---
[2020-06-04 20:20:05] VERBOSE[2409] chan_sip.c: Sending to 111.111.3.10:5060 (NAT)
[2020-06-04 20:20:05] VERBOSE[2409] chan_sip.c: Looking for metaswitch in from-sip-external (domain 111.111.64.149)
[2020-06-04 20:20:05] VERBOSE[2409] chan_sip.c: 
<--- Transmitting (NAT) to 111.111.3.10:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 111.111.3.10:5060;branch=z9hG4bK+2183e4ea3ff7dd836b11c1e3bf15c7731+sip+2+b00889c8;received=111.111.3.10;rport=5060
From: <sip:metaswitch@111.111.3.10:5060>;tag=111.111.3.10+2+6eb16302+c68d2e13
To: <sip:metaswitch@111.111.64.149>;tag=as371684c3
Call-ID: 0gQAAC8WAAACBAAALxYAAAF+Gn9XKilc3HNYnZtDoflCIM8wf/st6To/NgxdE2mM@111.111.3.10
CSeq: 699873511 OPTIONS
Server: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:222.222.234.123:5060>
Accept: application/sdp
Content-Length: 0


<------------>
[2020-06-04 20:20:05] VERBOSE[2409] chan_sip.c: Scheduling destruction of SIP dialog '0gQAAC8WAAACBAAALxYAAAF+Gn9XKilc3HNYnZtDoflCIM8wf/st6To/NgxdE2mM@111.111.3.10' in 32000 ms (Method: OPTIONS)
[2020-06-04 20:20:06] VERBOSE[2409] chan_sip.c: Retransmitting #10 (NAT) to 111.111.3.10:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 111.111.3.10:5060;branch=z9hG4bK+86e463137aecf9f409ba8a15f76dc3591+sip+6+aff49b2b;received=111.111.3.10;rport=5060
From: <sip:1166667777@111.111.3.10:5060>;tag=111.111.3.10+6+d582edab+d0c78e7e
To: <sip:1122223333@111.111.64.149>;tag=as2e963a0b
Call-ID: 0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10
CSeq: 56524576 INVITE
Server: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:1122223333@222.222.234.123:5060>
Content-Type: application/sdp
Content-Length: 238

v=0
o=root 190755527 190755527 IN IP4 222.222.234.123
s=Asterisk PBX 11.25.3
c=IN IP4 222.222.234.123
t=0 0
m=audio 10940 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

---
[2020-06-04 20:20:07] WARNING[2409] chan_sip.c: Retransmission timeout reached on transmission 0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10 for seqno 56524576 (Critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 31999ms with no response
[2020-06-04 20:20:07] WARNING[2409] chan_sip.c: Hanging up call 0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10 - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions).
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] pbx.c:     -- Executing [h@macro-dial-one:1] Macro("SIP/Telec-0000000e", "hangupcall,") in new stack
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] pbx.c:     -- Executing [s@macro-hangupcall:1] ExecIf("SIP/Telec-0000000e", "0?Set(CDR(recordingfile)=.wav)") in new stack
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] pbx.c:     -- Executing [s@macro-hangupcall:2] GotoIf("SIP/Telec-0000000e", "1?theend") in new stack
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] pbx.c:     -- Goto (macro-hangupcall,s,4)
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] pbx.c:     -- Executing [s@macro-hangupcall:4] Hangup("SIP/Telec-0000000e", "") in new stack
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] app_macro.c:   == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/Telec-0000000e' in macro 'hangupcall'
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] pbx.c:   == Spawn extension (macro-dial-one, h, 1) exited non-zero on 'SIP/Telec-0000000e'
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] chan_sip.c: Scheduling destruction of SIP dialog '2df5b9a014dafb8862ec863e3cdafbe2@192.168.10.223:5060' in 6400 ms (Method: INVITE)
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] chan_sip.c: set_destination: Parsing <sip:4466@192.168.10.36:60798> for address/port to send to
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] chan_sip.c: set_destination: set destination to 192.168.10.36:60798
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] chan_sip.c: Reliably Transmitting (NAT) to 192.168.10.36:60798:
BYE sip:4466@192.168.10.36:60798 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.223:5060;branch=z9hG4bK2a54c60e;rport
Max-Forwards: 70
From: "1166667777" <sip:1166667777@192.168.10.223>;tag=as6604fad6
To: <sip:4466@192.168.10.36:60798;rinstance=b84ac64a2db3b64f;transport=UDP>;tag=aa39c34a
Call-ID: 2df5b9a014dafb8862ec863e3cdafbe2@192.168.10.223:5060
CSeq: 103 BYE
User-Agent: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
X-Asterisk-HangupCause: Normal Clearing
X-Asterisk-HangupCauseCode: 16
Content-Length: 0


---
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] app_macro.c:   == Spawn extension (macro-dial-one, s, 45) exited non-zero on 'SIP/Telec-0000000e' in macro 'dial-one'
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] app_macro.c:   == Spawn extension (macro-exten-vm, s, 16) exited non-zero on 'SIP/Telec-0000000e' in macro 'exten-vm'
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] pbx.c:   == Spawn extension (ext-local, 4466, 2) exited non-zero on 'SIP/Telec-0000000e'
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] chan_sip.c: Scheduling destruction of SIP dialog '0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10' in 32000 ms (Method: INVITE)
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] chan_sip.c: set_destination: Parsing <sip:4876c0435de2db36c27a315bebe64c62@111.111.3.10> for address/port to send to
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] chan_sip.c: set_destination: set destination to 111.111.3.10:5060
[2020-06-04 20:20:07] VERBOSE[3787][C-0000000e] chan_sip.c: Reliably Transmitting (NAT) to 111.111.3.10:5060:
BYE sip:4876c0435de2db36c27a315bebe64c62@111.111.3.10 SIP/2.0
Via: SIP/2.0/UDP 222.222.234.123:5060;branch=z9hG4bK42f5707d;rport
Max-Forwards: 70
From: <sip:1122223333@111.111.64.149>;tag=as2e963a0b
To: <sip:1166667777@111.111.3.10:5060>;tag=111.111.3.10+6+d582edab+d0c78e7e
Call-ID: 0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10
CSeq: 102 BYE
User-Agent: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
X-Asterisk-HangupCause: No user responding
X-Asterisk-HangupCauseCode: 18
Content-Length: 0


---
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: 
<--- SIP read from UDP:192.168.10.36:60798 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.10.223:5060;branch=z9hG4bK2a54c60e;rport=5060
Contact: <sip:4466@192.168.10.36:60798>
To: <sip:4466@192.168.10.36:60798;rinstance=b84ac64a2db3b64f;transport=UDP>;tag=aa39c34a
From: "1166667777" <sip:1166667777@192.168.10.223>;tag=as6604fad6
Call-ID: 2df5b9a014dafb8862ec863e3cdafbe2@192.168.10.223:5060
CSeq: 103 BYE
User-Agent: Z 3.15.40006 rv2.8.20
Content-Length: 0

<------------->
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: --- (9 headers 0 lines) ---
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Really destroying SIP dialog '2df5b9a014dafb8862ec863e3cdafbe2@192.168.10.223:5060' Method: INVITE
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: 
<--- SIP read from UDP:111.111.3.10:5060 --->
SIP/2.0 200 OK
Call-ID: 0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10
CSeq: 102 BYE
From: <sip:1122223333@111.111.64.149>;tag=as2e963a0b
To: <sip:1166667777@111.111.3.10:5060>;tag=111.111.3.10+6+d582edab+d0c78e7e
Via: SIP/2.0/UDP 222.222.234.123:5060;received=111.111.64.149;rport=5060;branch=z9hG4bK42f5707d
Content-Length: 0
Supported: resource-priority, siprec, 100rel
Contact: <sip:4876c0435de2db36c27a315bebe64c62@111.111.3.10>
Server: DC-SIP/2.0
Organization: Metaswitch Networks
Allow-Events: message-summary, refer, dialog, line-seize, presence, call-info, as-feature-event, calling-name

<------------->
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: --- (12 headers 0 lines) ---
[2020-06-04 20:20:07] VERBOSE[2409][C-0000000e] chan_sip.c: SIP Response message for INCOMING dialog BYE arrived
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Really destroying SIP dialog '0gQAAC8WAAACBAAALxYAABKW5K4dBEPAqJ9GNe/2xO8AN67To034BFUOE0iRoDID@111.111.3.10' Method: INVITE
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: 
<--- SIP read from UDP:192.168.10.36:60798 --->
PUBLISH sip:4466@192.168.10.223;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 192.168.10.36:60798;branch=z9hG4bK-524287-1---ba8a6e7aed23642f
Max-Forwards: 70
Contact: <sip:4466@192.168.10.36:60798;transport=UDP>
To: <sip:4466@192.168.10.223;transport=UDP>
From: <sip:4466@192.168.10.223;transport=UDP>;tag=0b20e91e
Call-ID: y-qUP1725REoFNjQnRZg0Q..
CSeq: 1 PUBLISH
Expires: 600
Content-Type: application/pidf+xml
User-Agent: Z 3.15.40006 rv2.8.20
Event: presence
Allow-Events: presence, kpml, talk
Content-Length: 262

<?xml version="1.0" encoding="UTF-8"?>
<presence xmlns="urn:ietf:params:xml:ns:pidf" entity="sip:4466@192.168.10.223;transport=UDP"> <tuple id="4466" > <status><basic>open</basic></status> <note>Online</note> </tuple>
</presence>
<------------->
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: --- (14 headers 3 lines) ---
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Sending to 192.168.10.36:60798 (NAT)
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: 
<--- Transmitting (NAT) to 192.168.10.36:60798 --->
SIP/2.0 489 Bad Event
Via: SIP/2.0/UDP 192.168.10.36:60798;branch=z9hG4bK-524287-1---ba8a6e7aed23642f;received=192.168.10.36;rport=60798
From: <sip:4466@192.168.10.223;transport=UDP>;tag=0b20e91e
To: <sip:4466@192.168.10.223;transport=UDP>;tag=as5edf2150
Call-ID: y-qUP1725REoFNjQnRZg0Q..
CSeq: 1 PUBLISH
Server: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<------------>
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Really destroying SIP dialog 'y-qUP1725REoFNjQnRZg0Q..' Method: PUBLISH
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: 
<--- SIP read from UDP:192.168.10.36:60798 --->
SUBSCRIBE sip:4466@192.168.10.223;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 192.168.10.36:60798;branch=z9hG4bK-524287-1---7acf366feff11173
Max-Forwards: 70
Contact: <sip:4466@192.168.10.36:60798;transport=UDP>
To: <sip:4466@192.168.10.223;transport=UDP>
From: <sip:4466@192.168.10.223;transport=UDP>;tag=4e63d737
Call-ID: QqCMBDM_dVMSM5fZ5HyN2A..
CSeq: 1 SUBSCRIBE
Expires: 600
Accept: application/watcherinfo+xml
User-Agent: Z 3.15.40006 rv2.8.20
Event: presence.winfo
Allow-Events: presence, kpml, talk
Content-Length: 0

<------------->
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: --- (14 headers 0 lines) ---
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Sending to 192.168.10.36:60798 (NAT)
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Creating new subscription
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Sending to 192.168.10.36:60798 (NAT)
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: list_route: hop: <sip:4466@192.168.10.36:60798;transport=UDP>
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Found peer '4466' for '4466' from 192.168.10.36:60798
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: 
<--- Transmitting (NAT) to 192.168.10.36:60798 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.10.36:60798;branch=z9hG4bK-524287-1---7acf366feff11173;received=192.168.10.36;rport=60798
From: <sip:4466@192.168.10.223;transport=UDP>;tag=4e63d737
To: <sip:4466@192.168.10.223;transport=UDP>;tag=as7dc61397
Call-ID: QqCMBDM_dVMSM5fZ5HyN2A..
CSeq: 1 SUBSCRIBE
Server: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="7516b3e8"
Content-Length: 0


<------------>
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Scheduling destruction of SIP dialog 'QqCMBDM_dVMSM5fZ5HyN2A..' in 6400 ms (Method: SUBSCRIBE)
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: 
<--- SIP read from UDP:192.168.10.36:60798 --->
SUBSCRIBE sip:4466@192.168.10.223;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 192.168.10.36:60798;branch=z9hG4bK-524287-1---d7a542af6bfdfbb6
Max-Forwards: 70
Contact: <sip:4466@192.168.10.36:60798;transport=UDP>
To: <sip:4466@192.168.10.223;transport=UDP>
From: <sip:4466@192.168.10.223;transport=UDP>;tag=4e63d737
Call-ID: QqCMBDM_dVMSM5fZ5HyN2A..
CSeq: 2 SUBSCRIBE
Expires: 600
Accept: application/watcherinfo+xml
User-Agent: Z 3.15.40006 rv2.8.20
Authorization: Digest username="4466",realm="asterisk",nonce="7516b3e8",uri="sip:4466@192.168.10.223;transport=UDP",response="9aac98c51da5114be076284f7b0b3393",algorithm=MD5
Event: presence.winfo
Allow-Events: presence, kpml, talk
Content-Length: 0

<------------->
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: --- (15 headers 0 lines) ---
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Creating new subscription
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Sending to 192.168.10.36:60798 (NAT)
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Found peer '4466' for '4466' from 192.168.10.36:60798
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: 
<--- Transmitting (NAT) to 192.168.10.36:60798 --->
SIP/2.0 489 Bad Event
Via: SIP/2.0/UDP 192.168.10.36:60798;branch=z9hG4bK-524287-1---d7a542af6bfdfbb6;received=192.168.10.36;rport=60798
From: <sip:4466@192.168.10.223;transport=UDP>;tag=4e63d737
To: <sip:4466@192.168.10.223;transport=UDP>;tag=as7dc61397
Call-ID: QqCMBDM_dVMSM5fZ5HyN2A..
CSeq: 2 SUBSCRIBE
Server: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<------------>
[2020-06-04 20:20:07] VERBOSE[2409] chan_sip.c: Really destroying SIP dialog 'QqCMBDM_dVMSM5fZ5HyN2A..' Method: SUBSCRIBE
[2020-06-04 20:20:08] VERBOSE[2409] chan_sip.c: 
<--- SIP read from UDP:192.168.10.132:5060 --->


<------------->
[2020-06-04 20:20:08] VERBOSE[2409] chan_sip.c: Really destroying SIP dialog 'D4BFEBF0-3@111.111.3.10:5060' Method: OPTIONS
[2020-06-04 20:20:12] VERBOSE[2409] chan_sip.c: Reliably Transmitting (NAT) to 24.232.134.32:55974:
OPTIONS sip:4444@24.232.134.32:55974;rinstance=272c0387725cd0b8;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 222.222.234.123:5060;branch=z9hG4bK7f1ffec9;rport
Max-Forwards: 70
From: "Unknown" <sip:Unknown@222.222.234.123>;tag=as641529a1
To: <sip:4444@24.232.134.32:55974;rinstance=272c0387725cd0b8;transport=UDP>
Contact: <sip:Unknown@222.222.234.123:5060>
Call-ID: 229901085ddfcdf923b1799b3de772e8@222.222.234.123:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Date: Thu, 04 Jun 2020 23:20:12 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2020-06-04 20:20:12] VERBOSE[2409] chan_sip.c: 
<--- SIP read from UDP:24.232.134.32:55974 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 222.222.234.123:5060;branch=z9hG4bK7f1ffec9;rport=5060
Contact: <sip:24.232.134.32:55974>
To: <sip:4444@24.232.134.32:55974;rinstance=272c0387725cd0b8;transport=UDP>;tag=dc3f5348
From: "Unknown"<sip:Unknown@222.222.234.123>;tag=as641529a1
Call-ID: 229901085ddfcdf923b1799b3de772e8@222.222.234.123:5060
CSeq: 102 OPTIONS
Accept: application/sdp, application/sdp
Accept-Language: en
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, X-cisco-serviceuri
User-Agent: Z 3.6.25251 r25476
Allow-Events: presence, kpml
Content-Length: 0

<------------->
[2020-06-04 20:20:12] VERBOSE[2409] chan_sip.c: --- (14 headers 0 lines) ---
[2020-06-04 20:20:12] VERBOSE[2409] chan_sip.c: Really destroying SIP dialog '229901085ddfcdf923b1799b3de772e8@222.222.234.123:5060' Method: OPTIONS
[2020-06-04 20:20:12] VERBOSE[2409] chan_sip.c: Reliably Transmitting (NAT) to 192.168.10.36:60798:
OPTIONS sip:4466@192.168.10.36:60798;rinstance=b84ac64a2db3b64f;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 192.168.10.223:5060;branch=z9hG4bK04d8555b;rport
Max-Forwards: 70
From: "Unknown" <sip:Unknown@192.168.10.223>;tag=as1f1562f8
To: <sip:4466@192.168.10.36:60798;rinstance=b84ac64a2db3b64f;transport=UDP>
Contact: <sip:Unknown@192.168.10.223:5060>
Call-ID: 4b8f5a6e098f932743c9dcc530ac8957@192.168.10.223:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Date: Thu, 04 Jun 2020 23:20:12 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2020-06-04 20:20:12] VERBOSE[2409] chan_sip.c: 
<--- SIP read from UDP:192.168.10.36:60798 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.10.223:5060;branch=z9hG4bK04d8555b;rport=5060
Contact: <sip:192.168.10.36:60798>
To: <sip:4466@192.168.10.36:60798;rinstance=b84ac64a2db3b64f;transport=UDP>;tag=f45e8623
From: "Unknown" <sip:Unknown@192.168.10.223>;tag=as1f1562f8
Call-ID: 4b8f5a6e098f932743c9dcc530ac8957@192.168.10.223:5060
CSeq: 102 OPTIONS
Accept: application/sdp, application/sdp
Accept-Language: en
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
User-Agent: Z 3.15.40006 rv2.8.20
Allow-Events: presence, kpml, talk
Content-Length: 0

<------------->
[2020-06-04 20:20:12] VERBOSE[2409] chan_sip.c: --- (14 headers 0 lines) ---
[2020-06-04 20:20:12] VERBOSE[2409] chan_sip.c: Really destroying SIP dialog '4b8f5a6e098f932743c9dcc530ac8957@192.168.10.223:5060' Method: OPTIONS
[2020-06-04 20:20:13] VERBOSE[2409] chan_sip.c: Reliably Transmitting (NAT) to 192.168.10.252:5060:
OPTIONS sip:900@192.168.10.252:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.223:5060;branch=z9hG4bK7c81c2d7;rport
Max-Forwards: 70
From: "Unknown" <sip:Unknown@192.168.10.223>;tag=as2a1cc252
To: <sip:900@192.168.10.252:5060>
Contact: <sip:Unknown@192.168.10.223:5060>
Call-ID: 78aee7092263ff811bf07c1b1c2db4a1@192.168.10.223:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-AsteriskNOW-12.0.76.6(11.25.3)
Date: Thu, 04 Jun 2020 23:20:13 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
[2020-06-04 20:20:13] VERBOSE[2409] chan_sip.c: 
<--- SIP read from UDP:192.168.10.252:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.10.223:5060;branch=z9hG4bK7c81c2d7;rport=5060
From: "Unknown" <sip:Unknown@192.168.10.223>;tag=as2a1cc252
To: <sip:900@192.168.10.252:5060>;tag=3991286321
Call-ID: 78aee7092263ff811bf07c1b1c2db4a1@192.168.10.223:5060
CSeq: 102 OPTIONS
User-Agent: Yealink SIP-T21P_E2 52.80.0.130
Content-Length: 0

<------------->
[2020-06-04 20:20:13] VERBOSE[2409] chan_sip.c: --- (8 headers 0 lines) ---
[2020-06-04 20:20:13] VERBOSE[2409] chan_sip.c: Really destroying SIP dialog '78aee7092263ff811bf07c1b1c2db4a1@192.168.10.223:5060' Method: OPTIONS

The key is that the call is being treated as NATted (NAT in parentheses), but it is actually effectively on a private network, because you have a broken multi-home configuration (one without proper autonomous system routing), so which public address you present matters.

Almost certainly the correct solution is to declare the subnetwork containing the ITSP’s SIP system as being private, with the localnet option.

You are almost certainly going to need directmedia=no, at least on the trunk.

Alternatively, and more reliable if it works, is to make the public address that on the ITSP interface. That will only work if you don’t have any of your own devices on real public addresses.

The final resort for broken multi-homed arrangements is to run two instances of Asterisk, one for each public address, and have them forward traffic between themselves.

Incidentally, I’m not convinced that you need a non-default nat= setting, and, in any case, “yes” is deprecated. I’m not aware of ALLOW_SIP_ANON ever having been a valid option; did you mean allowguest? Logs and configuration need to be marked up as preformatted text for the forum.

Thanks for the answer @david551. I improved my post for best reading
I added directmedia=no, and allowguest=no
When you say "you need a non-default nat= " what dou you mean? I tested with options no, never, route without success

I have extensions connected from outside. It’s not an option

Thanxs again

I said that I thought you had no need to use nat= at all. The default is nat=auto_force_rport,auto_comedia, which will work in most cases. nat=yes is nat=force_rport, comedia. There are some cases where applying these can actually break things, even when there is NAT.

As far as I can tell, declaring your ITSP as on a localnet should work for you.

Strangely, (NAT) in the trace seems to indicate rport forcing, rather than actually having detected the use of NAT.

1 Like

YESSSSSSSSSSS

I put trunk IP as localnet, and voalaaaaaa!
At first I didn’t understand what you say with “declaring your ITSP as on a localnet should work for you.” because I’ve declared this network as local, but not the trunk ip

Thanks a lot @david551 !

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.