Problem with SIP trunk & NAT, read all the posts I could find on here and on google

Hi guys

I’m really having a hard time getting my SIP trunk to provider to work. It is getting natted through a Mikrotik Router with the SIP helper switched off. I’m not sure if the problem is NAT related or codec related. I get 2 way audio on the one call, then next call only 1 way. No really pattern. Here is an extract from CLI SIP Debug

196.28.95.12 is my provider’s IP
192.168.3.32 is my asterisk server’s ip
192.168.3.20 is the Atcom AT640P handset trying to make the call.

<------------->
[2012-06-29 00:47:09] VERBOSE[5542] chan_sip.c: — (8 headers 0 lines) —
[2012-06-29 00:47:09] VERBOSE[5542] chan_sip.c: list_route: no route
[2012-06-29 00:47:09] VERBOSE[5586] app_dial.c: – SIP/MWEB-00000007 is ringing
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c:
<— SIP read from UDP:196.28.95.12:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 127.0.0.1:5060;received=41.133.161.26;branch=z9hG4bK1544db9f;rport=5060
From: “27100070561” sip:[email protected];tag=as7882c23a
To: sip:[email protected];tag=jxqd4p6sf76rjvux.i
Call-ID: [email protected]
CSeq: 103 INVITE
Contact: "Anonymous"sip:[email protected]:5060;transport=udp
Content-Type: application/sdp
Server: Sippy
Content-Length: 196

v=0
o=Sippy 166232648 1 IN IP4 196.28.95.12
s=-
t=0 0
m=audio 14012 RTP/AVP 0 101
c=IN IP4 196.28.95.12
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
<------------->
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: — (10 headers 10 lines) —
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: Found RTP audio format 0
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: Found RTP audio format 101
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: Found audio description format PCMU for ID 0
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: Found audio description format telephone-event for ID 101
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: Capabilities: us - 0xc (ulaw|alaw), peer - audio=0x4 (ulaw)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0x4 (ulaw)
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: Peer audio RTP is at port 196.28.95.12:14012
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: list_route: hop: sip:[email protected]:5060;transport=udp
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: set_destination: Parsing sip:[email protected]:5060;transport=udp for address/port to send to
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: set_destination: set destination to 196.28.95.12:5060
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: Transmitting (NAT) to 196.28.95.12:5060:
ACK sip:[email protected]:5060;transport=udp SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5060;branch=z9hG4bK34da7a42;rport
Max-Forwards: 70
From: “27100070561” sip:[email protected];tag=as7882c23a
To: sip:[email protected];tag=jxqd4p6sf76rjvux.i
Contact: sip:[email protected]:5060
Call-ID: [email protected]
CSeq: 103 ACK
User-Agent: FPBX-2.10.0rc1(1.8.11)
Content-Length: 0


[2012-06-29 00:47:12] VERBOSE[5586] app_dial.c: – SIP/MWEB-00000007 answered SIP/001-00000006
[2012-06-29 00:47:12] VERBOSE[5586] chan_sip.c: Audio is at 16026
[2012-06-29 00:47:12] VERBOSE[5586] chan_sip.c: Adding codec 0x4 (ulaw) to SDP
[2012-06-29 00:47:12] VERBOSE[5586] chan_sip.c: Adding codec 0x8 (alaw) to SDP
[2012-06-29 00:47:12] VERBOSE[5586] chan_sip.c: Adding non-codec 0x1 (telephone-event) to SDP
[2012-06-29 00:47:12] VERBOSE[5586] chan_sip.c:
<— Reliably Transmitting (no NAT) to 192.168.3.20:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.3.20:5060;branch=z9hG4bK12911154352360027890;received=192.168.3.20;rport=5060
From: Study sip:[email protected]:5060;tag=279814915
To: " 0800414141" sip:[email protected];tag=as1a70942f
Call-ID: [email protected]
CSeq: 2 INVITE
Server: FPBX-2.10.0rc1(1.8.11)
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: sip:[email protected]:5060
Content-Type: application/sdp
Content-Length: 265

v=0
o=root 1373573186 1373573186 IN IP4 192.168.3.32
s=Asterisk PBX 1.8.11-cert1
c=IN IP4 192.168.3.32
t=0 0
m=audio 16026 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

<------------>
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c:
<— SIP read from UDP:192.168.3.20:5060 —>
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.3.20:5060;branch=z9hG4bK306571853116117059
From: Study sip:[email protected]:5060;tag=279814915
To: “0800414141” sip:[email protected];tag=as1a70942f
Call-ID: [email protected]
CSeq: 2 ACK
Max-Forwards: 70
User-Agent: Voip Phone 1.0
Content-Length: 0

<------------->
[2012-06-29 00:47:12] VERBOSE[5542] chan_sip.c: — (9 headers 0 lines) —
[2012-06-29 00:47:18] VERBOSE[5542] chan_sip.c: Really destroying SIP dialog ‘[email protected]’ Method: REGISTER
[2012-06-29 00:47:18] VERBOSE[5542] chan_sip.c: Really destroying SIP dialog ‘[email protected]:5060’ Method: OPTIONS
[2012-06-29 00:47:18] VERBOSE[5542] chan_sip.c: Really destroying SIP dialog ‘[email protected]’ Method: REGISTER
[2012-06-29 00:47:21] VERBOSE[5542] chan_sip.c:
<— SIP read from UDP:192.168.3.20:5060 —>
REGISTER sip:192.168.3.32 SIP/2.0
Via: SIP/2.0/UDP 192.168.3.20:5060;branch=z9hG4bK2486058092197811944;rport
From: Study sip:[email protected]:5060;tag=162145220
To: Study sip:[email protected]:5060
Call-ID: [email protected]
CSeq: 583 REGISTER
Contact: sip:[email protected]:5060
Max-Forwards: 70
Expires: 60
Supported: path
User-Agent: Voip Phone 1.0
Content-Length: 0

<------------->