Sip trunk problem

i problem in sip trunk to asterisk. outgoing call is ok but incoming is busy.
please help me.

Retransmitting #3 (NAT) to 192.168.2.2:5062:
OPTIONS sip:192.168.2.2 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.156:5060;branch=z9hG4bK33cd4152;rport
Max-Forwards: 70
From: “Unknown” sip:Unknown@192.168.2.156;tag=as46d14fc6
To: sip:192.168.2.2
Contact: sip:Unknown@192.168.2.156:5060
Call-ID: 74398cb97901af7b26008b9f61115b8d@192.168.2.156:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-2.11.0(11.20.0)
Date: Sat, 16 Feb 2002 01:28:30 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


Retransmitting #4 (NAT) to 192.168.2.2:5062:
OPTIONS sip:192.168.2.2 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.156:5060;branch=z9hG4bK33cd4152;rport
Max-Forwards: 70
From: “Unknown” sip:Unknown@192.168.2.156;tag=as46d14fc6
To: sip:192.168.2.2
Contact: sip:Unknown@192.168.2.156:5060
Call-ID: 74398cb97901af7b26008b9f61115b8d@192.168.2.156:5060
CSeq: 102 OPTIONS
User-Agent: FPBX-2.11.0(11.20.0)
Date: Sat, 16 Feb 2002 01:28:30 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


Really destroying SIP dialog ‘74398cb97901af7b26008b9f61115b8d@192.168.2.156:5060’ Method: OPTIONS
Really destroying SIP dialog ‘OTI3Y2YxNmE5ZTFmMWI4NzViM2FhMjg1YTQ3MmQwMmI.’ Method: REGISTER

<— SIP read from UDP:192.168.2.2:5060 —>
INVITE sip:95118801@192.168.2.156:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.2;rport;branch=z9hG4bKgjy0Qg8cU4aUB
Max-Forwards: 70
From: “4763216” sip:4763216@192.168.2.2;tag=HZy0t198XKcmS
To: sip:95118801@192.168.2.156:5060
Call-ID: 199727d4-b56f-1234-a9bd-00900b3ea8bd
CSeq: 93091918 INVITE
Contact: sip:mod_sofia@192.168.2.2:5060
User-Agent: Netborder SS7 to VoIP Media Gateway 5.1
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY
Supported: timer, precondition, path, replaces
Allow-Events: talk, hold, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 723
X-FreeTDM-SpanName: wp1
X-FreeTDM-SpanNumber: 1
X-FreeTDM-ChanNumber: 2
X-FreeTDM-CallerName: 4763216
X-FreeTDM-CallerNumber: 4763216
X-FreeTDM-ANI: 4763216
X-FreeTDM-ANI-TON: 0
X-FreeTDM-ANI-Plan: 0
X-FreeTDM-DNIS: 95118801
X-FreeTDM-DNIS-TON: 0
X-FreeTDM-DNIS-Plan: 0
X-FreeTDM-RDNIS-NADI: 0
X-FreeTDM-RDNIS-Plan: 0
X-FreeTDM-CPC: ordinary
X-FreeTDM-TransUUID: 1bd05299-0527-4812-8603-eb98b0a39474
X-FreeTDM-IAM-NATURE-CONN-HEX: 00
X-FreeTDM-IAM-FWD-IND-HEX: 2000
X-FreeTDM-NADI: 1
X-FreeTDM-ANI-NADI: 1
X-FreeTDM-DNIS-NADI: 2
X-FreeTDM-IAM: x%9C%ED%DB%B1%11%82%40%10%05%D0%3Bq%08%8C%90%3A%8C%CDH%EC%C2%3E%C8I)%C2%22,%CE%02p%061XG%03%18%09%F4%BD%E4%CF%DE%26%3B%B7%F1%E64%CAK3%7F%EE%A7%F8%BE%0Bu%91%98%E1%F9%7F%9BP%C7%7Dl%C7%3C%EF%FBj%A5%D1%FE%DA%CB%1E%A6,%DE%F4%A7%FA%B1%A7%F6X%97_%1E%11%00%00%00%00%00%00%00%00%00%00%00%E0%B7%DD%AE%CD%A9%BB%E7%E5%10O%9C%80%95%0DP~%05n
X-FreeTDM-CIC: 3
X-FreeTDM-Screen: 3
X-FreeTDM-Presentation: 0
X-FreeTDM-CallReference: 0
X-FreeTDM-OPC: 2193
X-FreeTDM-hopCounter: 70
X-FS-Support: update_display,send_info
Remote-Party-ID: “4763216” sip:4763216@192.168.2.2;party=calling;screen=yes;privacy=off

v=0
o=FreeSWITCH 1466834172 1466834173 IN IP4 192.168.2.2
s=FreeSWITCH
c=IN IP4 192.168.2.2
t=0 0
m=audio 21792 RTP/AVP 8 0 98 9 99 100 18 3 102 101 13
a=rtpmap:98 AMR/8000
a=rtpmap:99 G7221/16000
a=fmtp:99 bitrate=32000
a=rtpmap:100 G726-32/8000
a=rtpmap:102 iLBC/8000
a=fmtp:102 mode=30
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
m=audio 21792 RTP/AVP 4 101 13
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:30
m=audio 21792 RTP/AVP 8 0 98 9 99 100 18 3 102 101 13
a=rtpmap:98 AMR/8000
a=rtpmap:99 G7221/16000
a=fmtp:99 bitrate=32000
a=rtpmap:100 G726-32/8000
a=rtpmap:102 iLBC/8000
a=fmtp:102 mode=30
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
<------------->
— (44 headers 29 lines) —
Sending to 192.168.2.2:5060 (NAT)
Sending to 192.168.2.2:5060 (NAT)
Using INVITE request as basis request - 199727d4-b56f-1234-a9bd-00900b3ea8bd
Found peer ‘sangoma0’ for ‘4763216’ from 192.168.2.2:5060

<— Reliably Transmitting (NAT) to 192.168.2.2:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.2.2;branch=z9hG4bKgjy0Qg8cU4aUB;received=192.168.2.2;rport=5060
From: “4763216” sip:4763216@192.168.2.2;tag=HZy0t198XKcmS
To: sip:95118801@192.168.2.156:5060;tag=as417414bd
Call-ID: 199727d4-b56f-1234-a9bd-00900b3ea8bd
CSeq: 93091918 INVITE
Server: FPBX-2.11.0(11.20.0)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce="38b1a224"
Content-Length: 0

<------------>
Scheduling destruction of SIP dialog ‘199727d4-b56f-1234-a9bd-00900b3ea8bd’ in 6400 ms (Method: INVITE)

<— SIP read from UDP:192.168.2.2:5060 —>
ACK sip:95118801@192.168.2.156:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.2.2;rport;branch=z9hG4bKgjy0Qg8cU4aUB
Max-Forwards: 70
From: “4763216” sip:4763216@192.168.2.2;tag=HZy0t198XKcmS
To: sip:95118801@192.168.2.156:5060;tag=as417414bd
Call-ID: 199727d4-b56f-1234-a9bd-00900b3ea8bd
CSeq: 93091918 ACK

trunk config
sangoma:sangoma@192.168.2.2:5060

easy way to solve this add insecure=port,invite

thanks
I can make outgoing calls but incoming just are not working.
Caller = 4763216 called=95118801 busy tone sip trunk incoming
caller =95118801 called=4763216 ok sip trunk outgoing

add insecure=port,invite in incoming config?

in the trunk configuration you should add that setting

Thank you for helped me

1 Like

insecure=port has no effect on this problem. You just need insecure=invite.

A better solution these days, is to use remotesecret, rather than secret.

Totally agreed that port option has no effect on this problem, but I have seems situation where is needed because this will Allow matching of peer by IP address without matching port number

Please put the correct settings.
username=sangoma
secret=sangoma
host=192.168.2.2
canreinvite=no
type=peer

Please putting the last adjustment.

canreinvite is deprecated, please use directmedia.

Is the problem will be solved by adding insecure=invite ?

insecure=invite make asterisk Do not require authentication of incoming INVITEs, so this will eliminate the 401 Unauthorized

Thank you to everybody