[Solved]Reception calls with DID number doesn't work stable - Ubuntu cloud EC2 with NAT

I seted a DID number to receive in my Asterisk PBX 13.18.5 and the calls doesn’t ring every time that is called.

The calls are coming in the server but when is redirected to the SIP number to attend.

I am not using the register in the file sip.conf is it necessary to receive calls? If yes why?

Below is the Flow capturated with tcpdump and the log with debug of a call that doesn’t ring:

  == Using SIP RTP CoS mark 5
    -- Executing [551935177554@incoming:1] Dial("SIP/buydid-1-00000044", "SIP/4701006,60") in new stack
  == Using SIP RTP CoS mark 5
Audio is at 15870
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec g729 to SDP
Adding codec g723 to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 181.221.135.180:7898:
INVITE sip:4701006@192.168.137.220:5060 SIP/2.0
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK75445b9a;rport
Max-Forwards: 70
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as7bf856d2
To: <sip:4701006@192.168.137.220:5060>
Contact: <sip:5519999901569@54.94.200.147:5060>
Call-ID: 2d2a95de478ad54a6499d4951753d756@54.94.200.147:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.18.5
Date: Fri, 02 Feb 2018 17:44:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Diversion: <sip:+551935177554@54.94.200.147>;reason=unconditional
Content-Type: application/sdp
Content-Length: 369

v=0
o=root 1450682690 1450682690 IN IP4 54.94.200.147
s=Asterisk PBX 13.18.5
c=IN IP4 54.94.200.147
t=0 0
m=audio 15870 RTP/AVP 0 8 18 4 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---
    -- Called SIP/4701006
Retransmitting #1 (NAT) to 181.221.135.180:7898:
INVITE sip:4701006@192.168.137.220:5060 SIP/2.0
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK75445b9a;rport
Max-Forwards: 70
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as7bf856d2
To: <sip:4701006@192.168.137.220:5060>
Contact: <sip:5519999901569@54.94.200.147:5060>
Call-ID: 2d2a95de478ad54a6499d4951753d756@54.94.200.147:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.18.5
Date: Fri, 02 Feb 2018 17:44:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Diversion: <sip:+551935177554@54.94.200.147>;reason=unconditional
Content-Type: application/sdp
Content-Length: 369

v=0
o=root 1450682690 1450682690 IN IP4 54.94.200.147
s=Asterisk PBX 13.18.5
c=IN IP4 54.94.200.147
t=0 0
m=audio 15870 RTP/AVP 0 8 18 4 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---
Retransmitting #2 (NAT) to 181.221.135.180:7898:
INVITE sip:4701006@192.168.137.220:5060 SIP/2.0


Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK75445b9a;rport
Max-Forwards: 70
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as7bf856d2
To: <sip:4701006@192.168.137.220:5060>
Contact: <sip:5519999901569@54.94.200.147:5060>
Call-ID: 2d2a95de478ad54a6499d4951753d756@54.94.200.147:5060
CSeq: 102 INVITE

User-Agent: Asterisk PBX 13.18.5
Date: Fri, 02 Feb 2018 17:44:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Diversion: <sip:+551935177554@54.94.200.147>;reason=unconditional
Content-Type: application/sdp
Content-Length: 369

v=0
o=root 1450682690 1450682690 IN IP4 54.94.200.147
s=Asterisk PBX 13.18.5
c=IN IP4 54.94.200.147
t=0 0
m=audio 15870 RTP/AVP 0 8 18 4 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv



---
Retransmitting #3 (NAT) to 181.221.135.180:7898:
INVITE sip:4701006@192.168.137.220:5060 SIP/2.0


Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK75445b9a;rport
Max-Forwards: 70
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as7bf856d2
To: <sip:4701006@192.168.137.220:5060>
Contact: <sip:5519999901569@54.94.200.147:5060>
Call-ID: 2d2a95de478ad54a6499d4951753d756@54.94.200.147:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.18.5
Date: Fri, 02 Feb 2018 17:44:06 GMT




Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Diversion: <sip:+551935177554@54.94.200.147>;reason=unconditional
Content-Type: application/sdp
Content-Length: 369

v=0
o=root 1450682690 1450682690 IN IP4 54.94.200.147
s=Asterisk PBX 13.18.5
c=IN IP4 54.94.200.147
t=0 0
m=audio 15870 RTP/AVP 0 8 18 4 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv


---



Retransmitting #4 (NAT) to 181.221.135.180:7898:
INVITE sip:4701006@192.168.137.220:5060 SIP/2.0
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK75445b9a;rport
Max-Forwards: 70
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as7bf856d2
To: <sip:4701006@192.168.137.220:5060>
Contact: <sip:5519999901569@54.94.200.147:5060>
Call-ID: 2d2a95de478ad54a6499d4951753d756@54.94.200.147:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.18.5
Date: Fri, 02 Feb 2018 17:44:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Diversion: <sip:+551935177554@54.94.200.147>;reason=unconditional
Content-Type: application/sdp
Content-Length: 369

v=0
o=root 1450682690 1450682690 IN IP4 54.94.200.147
s=Asterisk PBX 13.18.5
c=IN IP4 54.94.200.147
t=0 0
m=audio 15870 RTP/AVP 0 8 18 4 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---
[Feb  2 15:44:19] NOTICE[20873]: chan_sip.c:28633 handle_request_register: Registration from '"8367" <sip:8367@54.94.200.147>' failed for '46.166.187.35:5072' - Wrong password



<--- SIP read from UDP:181.221.135.180:8052 --->
REGISTER sip:solaristelecom.com SIP/2.0

Via: SIP/2.0/UDP 192.168.137.220:5060;branch=z9hG4bK1725350262;rport
From: <sip:4701006@solaristelecom.com>;tag=282315126
To: <sip:4701006@solaristelecom.com>
Call-ID: 2078275464-5060-1@BJC.BGI.BDH.CCA
CSeq: 3194 REGISTER


Contact: <sip:4701006@192.168.137.220:5060>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-1000-8000-000B82B5AA83>"
Authorization: Digest username="4701006", realm="asterisk", nonce="0a9b0c56", uri="sip:solaristelecom.com", response="4ab2046f431ef0c4f2d07756e6fd4b61", algorithm=MD5
Max-Forwards: 70

User-Agent: Grandstream GXP1625 1.0.4.55
Supported: path
Expires: 3600
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0

<------------->
--- (14 headers 0 lines) ---
Sending to 181.221.135.180:8052 (NAT)
Sending to 181.221.135.180:8052 (NAT)

<--- Transmitting (NAT) to 181.221.135.180:8052 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.137.220:5060;branch=z9hG4bK1725350262;received=181.221.135.180;rport=8052
From: <sip:4701006@solaristelecom.com>;tag=282315126
To: <sip:4701006@solaristelecom.com>;tag=as394db6da
Call-ID: 2078275464-5060-1@BJC.BGI.BDH.CCA
CSeq: 3194 REGISTER
Server: Asterisk PBX 13.18.5
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="3720d88a"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '2078275464-5060-1@BJC.BGI.BDH.CCA' in 32000 ms (Method: REGISTER)

<--- SIP read from UDP:181.221.135.180:8052 --->
REGISTER sip:solaristelecom.com SIP/2.0

Via: SIP/2.0/UDP 192.168.137.220:5060;branch=z9hG4bK1757815538;rport
From: <sip:4701006@solaristelecom.com>;tag=282315126
To: <sip:4701006@solaristelecom.com>
Call-ID: 2078275464-5060-1@BJC.BGI.BDH.CCA
CSeq: 3195 REGISTER


Contact: <sip:4701006@192.168.137.220:5060>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-1000-8000-000B82B5AA83>"
Authorization: Digest username="4701006", realm="asterisk", nonce="3720d88a", uri="sip:solaristelecom.com", response="2f08470c766e72df03b18cd1794c4bb1", algorithm=MD5
Max-Forwards: 70

User-Agent: Grandstream GXP1625 1.0.4.55
Supported: path
Expires: 3600
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0

<------------->
--- (14 headers 0 lines) ---
Sending to 181.221.135.180:8052 (NAT)
    -- Registered SIP '4701006' at 181.221.135.180:8052

<--- Transmitting (NAT) to 181.221.135.180:8052 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.137.220:5060;branch=z9hG4bK1757815538;received=181.221.135.180;rport=8052
From: <sip:4701006@solaristelecom.com>;tag=282315126
To: <sip:4701006@solaristelecom.com>;tag=as394db6da
Call-ID: 2078275464-5060-1@BJC.BGI.BDH.CCA
CSeq: 3195 REGISTER
Server: Asterisk PBX 13.18.5
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Expires: 360
Contact: <sip:4701006@192.168.137.220:5060>;expires=360
Date: Fri, 02 Feb 2018 17:44:20 GMT
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '2078275464-5060-1@BJC.BGI.BDH.CCA' in 32000 ms (Method: REGISTER)
Retransmitting #5 (NAT) to 181.221.135.180:7898:
INVITE sip:4701006@192.168.137.220:5060 SIP/2.0
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK75445b9a;rport
Max-Forwards: 70
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as7bf856d2
To: <sip:4701006@192.168.137.220:5060>
Contact: <sip:5519999901569@54.94.200.147:5060>
Call-ID: 2d2a95de478ad54a6499d4951753d756@54.94.200.147:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.18.5
Date: Fri, 02 Feb 2018 17:44:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Diversion: <sip:+551935177554@54.94.200.147>;reason=unconditional
Content-Type: application/sdp
Content-Length: 369

v=0
o=root 1450682690 1450682690 IN IP4 54.94.200.147
s=Asterisk PBX 13.18.5
c=IN IP4 54.94.200.147
t=0 0
m=audio 15870 RTP/AVP 0 8 18 4 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---
Retransmitting #6 (NAT) to 181.221.135.180:7898:
INVITE sip:4701006@192.168.137.220:5060 SIP/2.0
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK1cda1e1d;rport
Max-Forwards: 70
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as4efac7a9
To: <sip:4701006@192.168.137.220:5060>
Contact: <sip:5519999901569@54.94.200.147:5060>
Call-ID: 2bb2f6471550437c454b86064656d7c8@54.94.200.147:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.18.5
Date: Fri, 02 Feb 2018 17:43:50 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Diversion: <sip:+551935177554@54.94.200.147>;reason=unconditional
Content-Type: application/sdp
Content-Length: 369

v=0
o=root 1557732070 1557732070 IN IP4 54.94.200.147
s=Asterisk PBX 13.18.5
c=IN IP4 54.94.200.147
t=0 0
m=audio 19214 RTP/AVP 0 8 18 4 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---
[Feb  2 15:44:22] WARNING[20873]: chan_sip.c:4072 retrans_pkt: Retransmission timeout reached on transmission 2bb2f6471550437c454b86064656d7c8@54.94.200.147:5060 for seqno 102 (Critical Request) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 32000ms with no response
Really destroying SIP dialog '2bb2f6471550437c454b86064656d7c8@54.94.200.147:5060' Method: INVITE
Scheduling destruction of SIP dialog '2d2a95de478ad54a6499d4951753d756@54.94.200.147:5060' in 32000 ms (Method: INVITE)
  == Spawn extension (incoming, 551935177554, 1) exited non-zero on 'SIP/buydid-1-00000044'
Retransmitting #6 (NAT) to 181.221.135.180:7898:
INVITE sip:4701006@192.168.137.220:5060 SIP/2.0
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK75445b9a;rport
Max-Forwards: 70
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as7bf856d2
To: <sip:4701006@192.168.137.220:5060>
Contact: <sip:5519999901569@54.94.200.147:5060>
Call-ID: 2d2a95de478ad54a6499d4951753d756@54.94.200.147:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.18.5
Date: Fri, 02 Feb 2018 17:44:06 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Diversion: <sip:+551935177554@54.94.200.147>;reason=unconditional
Content-Type: application/sdp
Content-Length: 369

v=0
o=root 1450682690 1450682690 IN IP4 54.94.200.147
s=Asterisk PBX 13.18.5
c=IN IP4 54.94.200.147
t=0 0
m=audio 15870 RTP/AVP 0 8 18 4 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---
[Feb  2 15:44:38] WARNING[20873]: chan_sip.c:4072 retrans_pkt: Retransmission timeout reached on transmission 2d2a95de478ad54a6499d4951753d756@54.94.200.147:5060 for seqno 102 (Critical Request) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 32000ms with no response
Really destroying SIP dialog '2d2a95de478ad54a6499d4951753d756@54.94.200.147:5060' Method: INVITE
Really destroying SIP dialog '2078275464-5060-1@BJC.BGI.BDH.CCA' Method: REGISTER
[Feb  2 15:45:16] WARNING[20873]: chan_sip.c:4072 retrans_pkt: Retransmission timeout reached on transmission e613515308f75e169fc1aec94b186924 for seqno 1 (Non-critical Response) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 31999ms with no response

Below is the Flow capturated with tcpdump and the log with debug of a call that ring:


  == Using SIP RTP CoS mark 5
    -- Executing [551935177554@incoming:1] Dial("SIP/buydid-1-00000050", "SIP/4701006,60") in new stack
  == Using SIP RTP CoS mark 5
Audio is at 13690
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec g729 to SDP
Adding codec g723 to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 181.221.135.180:9228:
INVITE sip:4701006@192.168.137.220:5060 SIP/2.0
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK1e2d6dd1;rport
Max-Forwards: 70
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as45cc4ce5
To: <sip:4701006@192.168.137.220:5060>
Contact: <sip:5519999901569@54.94.200.147:5060>
Call-ID: 691bbf07470e341065bcb6172d66b0f3@54.94.200.147:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.18.5
Date: Fri, 02 Feb 2018 18:03:20 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Diversion: <sip:+551935177554@54.94.200.147>;reason=unconditional
Content-Type: application/sdp
Content-Length: 369

v=0
o=root 1038848421 1038848421 IN IP4 54.94.200.147
s=Asterisk PBX 13.18.5
c=IN IP4 54.94.200.147
t=0 0
m=audio 13690 RTP/AVP 0 8 18 4 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---
    -- Called SIP/4701006

<--- SIP read from UDP:181.221.135.180:9228 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK1e2d6dd1;rport=5060
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as45cc4ce5
To: <sip:4701006@192.168.137.220:5060>
Call-ID: 691bbf07470e341065bcb6172d66b0f3@54.94.200.147:5060
CSeq: 102 INVITE
Supported: replaces, path, timer
User-Agent: Grandstream GXP1625 1.0.4.55
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---

<--- SIP read from UDP:181.221.135.180:9228 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK1e2d6dd1;rport=5060
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as45cc4ce5
To: <sip:4701006@192.168.137.220:5060>;tag=814373542
Call-ID: 691bbf07470e341065bcb6172d66b0f3@54.94.200.147:5060
CSeq: 102 INVITE
Contact: <sip:4701006@192.168.137.220:5060>
Supported: replaces, path, timer
User-Agent: Grandstream GXP1625 1.0.4.55
Allow-Events: talk, hold
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0

<------------->
--- (12 headers 0 lines) ---
sip_route_dump: route/path hop: <sip:4701006@192.168.137.220:5060>
    -- SIP/4701006-00000051 is ringing
Scheduling destruction of SIP dialog '691bbf07470e341065bcb6172d66b0f3@54.94.200.147:5060' in 32000 ms (Method: INVITE)
Reliably Transmitting (NAT) to 181.221.135.180:9228:
CANCEL sip:4701006@192.168.137.220:5060 SIP/2.0
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK1e2d6dd1;rport
Max-Forwards: 70
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as45cc4ce5
To: <sip:4701006@192.168.137.220:5060>
Call-ID: 691bbf07470e341065bcb6172d66b0f3@54.94.200.147:5060
CSeq: 102 CANCEL
User-Agent: Asterisk PBX 13.18.5
Content-Length: 0


---
Scheduling destruction of SIP dialog '691bbf07470e341065bcb6172d66b0f3@54.94.200.147:5060' in 32000 ms (Method: INVITE)
  == Spawn extension (incoming, 551935177554, 1) exited non-zero on 'SIP/buydid-1-00000050'

<--- SIP read from UDP:181.221.135.180:9228 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK1e2d6dd1;rport=5060
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as45cc4ce5
To: <sip:4701006@192.168.137.220:5060>;tag=814373542
Call-ID: 691bbf07470e341065bcb6172d66b0f3@54.94.200.147:5060
CSeq: 102 CANCEL
Contact: <sip:4701006@192.168.137.220:5060>
Supported: replaces, path, timer
User-Agent: Grandstream GXP1625 1.0.4.55
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0

<------------->
--- (11 headers 0 lines) ---

<--- SIP read from UDP:181.221.135.180:9228 --->
SIP/2.0 487 Request Terminated
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK1e2d6dd1;rport=5060
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as45cc4ce5
To: <sip:4701006@192.168.137.220:5060>;tag=814373542
Call-ID: 691bbf07470e341065bcb6172d66b0f3@54.94.200.147:5060
CSeq: 102 INVITE
Contact: <sip:4701006@192.168.137.220:5060>
Supported: replaces, path, timer
User-Agent: Grandstream GXP1625 1.0.4.55
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0

<------------->
--- (11 headers 0 lines) ---
Transmitting (NAT) to 181.221.135.180:9228:
ACK sip:4701006@192.168.137.220:5060 SIP/2.0
Via: SIP/2.0/UDP 54.94.200.147:5060;branch=z9hG4bK1e2d6dd1;rport
Max-Forwards: 70
From: "5519999901569" <sip:5519999901569@54.94.200.147>;tag=as45cc4ce5
To: <sip:4701006@192.168.137.220:5060>;tag=814373542
Contact: <sip:5519999901569@54.94.200.147:5060>
Call-ID: 691bbf07470e341065bcb6172d66b0f3@54.94.200.147:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 13.18.5
Content-Length: 0


---
Scheduling destruction of SIP dialog '691bbf07470e341065bcb6172d66b0f3@54.94.200.147:5060' in 32000 ms (Method: INVITE)

My guess is that some of the port numbers from which the B side is registering are blocked somewhere, as either the mesage from Asterisk to it is getting lost, or its reply to Asterisk is getting lost.

I think that finally identify the real problem, my SIP clients is losting the register with the time, then the destination cant find the source to forward the calls. But I didn’t find the solution to solve it.

this is my whole extensions.conf:

[general]
static = yes
writeprotect = no
clearglobalvars = no


[globals]
CONSOLE = Console/dsp  ; Console interface for demo
IAXINFO = guest  ; IAXtel username/password
TRUNK = DAHDI/G2  ; Trunk interface
TRUNKMSD = 1  ; MSD digits to strip (usually 1 or 0)
;FEATURES =
;DIALOPTIONS =
;RINGTIME = 20
;FOLLOWMEOPTIONS =
;PAGING_HEADER = Intercom

[basico]
exten => _XXXXXXX,1,Dial(SIP/${EXTEN},60})
exten => _XXXXXXX,2,Answer()
exten => _XXXXXXX,3,Hangup()
include = messages

[incoming]
exten => 551935177554,1,Answer()
exten => 551935177554,2,Wait(2)
exten => 551935177554,3,Dial(SIP/4701006,60)  ; direct inboound call from DID provider to specific extention
  same => n,ExecIf([${HANGUPCAUSE}=19]?Dial(SIP/voxbeam-solaris/00111025519999901569,120))  ; direct inboound call from DID provider to specific extention
  same => n,Playtones(congestion)
  same => n,Congestion(5)
  same => n,Hangup()

[rotadesaida-silver] ;Silver
exten => _+XXXXXXXX.,1,Dial(SIP/voxbeam-solaris/0011103${EXTEN:1},180/nj)
  same => n,ExecIf([${HANGUPCAUSE}=34]?Dial(SIP/voxbeam-solaris/0011102${EXTEN:1},180/nj))
exten => _XXXXXXXX.,1,Dial(SIP/voxbeam-solaris/0011103${EXTEN},180/nj)
  same => n,ExecIf([${HANGUPCAUSE}=34]?Dial(SIP/voxbeam-solaris/0011102${EXTEN},180/nj))
include = basico
include = incoming
include = messages

[rotadesaida-platinum]
exten => _+XXXXXXXX.,1,Dial(SIP/voxbeam-solaris/0011102${EXTEN:1},180/nj)
exten => _XXXXXXXX.,1,Dial(SIP/voxbeam-solaris/0011102${EXTEN},180/nj)
include = basico
include = incoming
include = messages

[rotadesaida-gold]
exten => _+XXXXXXXX.,1,Dial(SIP/voxbeam-solaris/0011101${EXTEN:1},180/nj)
exten => _XXXXXXXX.,1,Dial(SIP/voxbeam-solaris/0011101${EXTEN},180/nj)
include = basico
include = incoming
include = messages

[messages]
exten => _XXXXXXX,1,MessageSend(sip:${EXTEN},"${CALLERID(name)}"${MESSAGE(from)})

[BLF_Solaris]
exten => _XXXXXXX,hint,SIP/${EXTEN}

Solved after I put qualify=yes and put to register the SIP number that receive calls of the DID.

register => 4701006:password@10.31.15.125/4701006
where 4701006 is my SIP number.