Asterisk 1.8 Internal Call Drop out after 6 sec, wrong Contact

Hi Guys,
I have a really big problem with an Italian ISP .
To connect a trunk SIP with it i use a public IP NATTED on my asterisk (NAT from Watchguard)

All Works good until today,
when i try a inbound call asterisk get it and it works ok for 6 second but after that the call is dropped.
If i check with tshark it says that I have a Unrecognised SIP header.

After that my ISP check log too and it says that my problem is on my Contact that show my internal ip and not my public ip.
I check it too and i see the same issue ,this in the header:
image
I’ve tried to override it with contact= in and check my externalip on sip.conf and it’s all ok.
There is a way to change that parameter?

These are my trunk settings:

[e2abb71f-9263-49a0-9e5b-eff2f57c905e] ;%VoncSipProvider%
username=
secret=
context=925bc138-4a77-40f6-bb51-e4798da69f02
host=ISP PUBLIC IP
type=peer
port=5060
qualify=yes
insecure=invite,port
canreinvite=yes
dtmfmode=rfc2833
stunaddr=
;description=TRUNK SIP
;prefix=
;GenerateRing=1
accountcode=<TRUNK SIP
disallow=all
nat=yes
allow=alaw

Sorry for my bad english but i’m really stuck on it and all my phone number are useless right now

Thanks
Fabio

You probably have externip or localnets set wrongly, so Asterisk either doesn’t know that you have NAT, or thinks that it the ITSP is insider the NAT.

I’m trying to get out of this issue but i don’t find nothing wrong in my sip.conf

[general]
port=5060
bindaddr=0.0.0.0
subscribecontext=BLF
limitonpeer=yes
notifyringing=yes
notifyhold=yes
allowsubscribe=yes
nat=yes
disallow=all
maxexpiry=3600
defaultexpiry=3400
relaxdtmf=yes
;;MODIFICA DISABILITAZIONE JITTER BUFFER
;jbenable=yes
;jblog =yes
;jbforce=no
;jbenable=no
;jbmaxsize=160
;jbresyncthreshold=160
;jbimpl=adaptive
;usejb=no
;jbsize=600
;jblog=yes
language=it			; Default language setting for all users/peers
;jitterbuffers=50
videosupport=yes		; Turn on support for SIP video. You need to turn this on
;useragent=VoipNet		; Allows you to change the user agent string
rtptimeout=60
rtpholdtimeout=300
; incoming calls
;insecure = very
;register => 6998800:iifhbTmb@6998800.zeppelink.net:5060/9600
; 0247951034 is the account and DID number for Italy 
t38pt_udptl= yes
realm=VoipNetCallCenter
callevents=yes
Qualify=No
externip=**MYPUBLICIP**/255.255.255.248
localnet=172.16.0.0/255.255.0.0
localnet=ISP PUBLICIP.0/255.255.255.0
localnet=93.42.189.86/255.255.255.255
localnet=192.168.0.35/255.255.255.0
rtcachefriends=yes
allow=alaw
allow=g729
allow=h261
allow=h264
allow=h263p
allow=h263
allow=mpeg4

I’ve tried to set netmask on my externip just in case but nothing change.

eth0      Link encap:Ethernet  HWaddr 00:50:56:91:2d:2b
          inet addr:172.16.14.100  Bcast:172.16.255.255  Mask:255.255.0.0
          inet6 addr: fe80::250:56ff:fe91:2d2b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1480752 errors:0 dropped:177 overruns:0 frame:0
          TX packets:1785464 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:973498014 (973.4 MB)  TX bytes:1085584053 (1.0 GB)

root@onc-callcenter-64:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface


@PBX:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

host051.pool213 172.16.90.254   255.255.255.255 UGH   0      0        0 eth0
host054.pool213 172.16.90.254   255.255.255.255 UGH   0      0        0 eth0
**ISP_PUBLIC_IP**    172.16.90.254   255.255.255.0   UG    0      0        0 eth0
172.16.0.0      *               255.255.0.0     U     0      0        0 eth0
default         172.16.8.254    0.0.0.0         UG    100    0        0 eth0

PBX-64*CLI> sip show settings

Global Settings:

UDP Bindaddress: 0.0.0.0:5060
TCP SIP Bindaddress: Disabled
TLS SIP Bindaddress: Disabled
Videosupport: Yes
Textsupport: No
Ignore SDP sess. ver.: No
AutoCreate Peer: No
Match Auth Username: No
Allow unknown access: Yes
Allow subscriptions: Yes
Allow overlap dialing: Yes
Allow promisc. redir: No
Enable call counters: No
SIP domain support: No
Realm. auth: No
Our auth realm VoipNetCallCenter
Use domains as realms: No
Call to non-local dom.: Yes
URI user is phone no: No
Always auth rejects: Yes
Direct RTP setup: No
User Agent: Asterisk PBX 1.8.10.1
SDP Session Name: Asterisk PBX 1.8.10.1
SDP Owner Name: root
Reg. context: (not set)
Regexten on Qualify: No
Legacy userfield parse: No
Caller ID: asterisk
From: Domain:
Record SIP history: Off
Call Events: On
Auth. Failure Events: Off
T.38 support: Yes
T.38 EC mode: FEC
T.38 MaxDtgrm: -1
SIP realtime: Disabled
Qualify Freq : 60000 ms
Q.850 Reason header: No
Store SIP_CAUSE: No

Network QoS Settings:

IP ToS SIP: CS0
IP ToS RTP audio: CS0
IP ToS RTP video: CS0
IP ToS RTP text: CS0
802.1p CoS SIP: 4
802.1p CoS RTP audio: 5
802.1p CoS RTP video: 6
802.1p CoS RTP text: 5
Jitterbuffer enabled: No

Network Settings:

SIP address remapping: Enabled using externaddr
Externhost:
Externaddr: 123.123.126.54:0 (My Public IP)
Externrefresh: 10
Localnet: 172.16.0.0/255.255.0.0 (LOCAL address pbx)
123.456.678.0/255.255.255.0 (ISP Public address)
93.42.189.86/255.255.255.255
192.168.0.0/255.255.255.0

Global Signalling Settings:

Codecs: 0x7c0108 (alaw|g729|h261|h263|h263p|h264|mpeg4)
Codec Order: alaw:20,g729:20
Relax DTMF: Yes
RFC2833 Compensation: No
Symmetric RTP: Yes
Compact SIP headers: No
RTP Keepalive: 0 (Disabled)
RTP Timeout: 60
RTP Hold Timeout: 300
MWI NOTIFY mime type: application/simple-message-summary
DNS SRV lookup: Yes
Pedantic SIP support: Yes
Reg. min duration 60 secs
Reg. max duration: 3600 secs
Reg. default duration: 3400 secs
Outbound reg. timeout: 20 secs
Outbound reg. attempts: 0
Notify ringing state: Yes
Include CID: No
Notify hold state: Yes
SIP Transfer mode: open
Max Call Bitrate: 384 kbps
Auto-Framing: No
Outb. proxy:
Session Timers: Accept
Session Refresher: uas
Session Expires: 1800 secs
Session Min-SE: 90 secs
Timer T1: 500
Timer T1 minimum: 100
Timer B: 32000
No premature media: Yes
Max forwards: 70

Default Settings:

Allowed transports: UDP
Outbound transport: UDP
Context: default
Force rport: Yes
DTMF: rfc2833
Qualify: 0
Use ClientCode: No
Progress inband: Never
Language: it
MOH Interpret: default
MOH Suggest:
Voice Mail Extension: asterisk


Fixed it!!
i’ve set the public ip of ISP on sip.conf localnet and for this reason asterisk think that it don’t need NAT.
After remove localnet=ISPPUBLICIP all works.

Hope this could help someone

Fabio