SIP not detecting hangup

We have a FreePBX server (v2.9.0.12) running on CentOS 5.7 which has previously been working fine.

Yesterday I changed the external IP address the server uses. I updated all of the firewall rules (our firewall uses 1-to-1 NAT to give the server a dedicated external IP) and updated /etc/asterisk/sip_custom.conf to change externip to the new IP. We are still using the same provider, who allow us to connect from either IP address.

However, since making the change if I make a call out and the other party hangs up first, the hangup is not detected.

This is an example of the Peer details for on of the trunks, which have remained unchanged:

type=peer
qualify=yes
host=sip-wholesale.provider.com
dtmfmode=inband

This is the content of sip_custom.conf

language=en
progressinband=no
externip=xxx.xxx.xxx.xxx
localnet=192.168.0.0/255.255.0.0
nat=yes

Below there is also an example of a call, where the other party hung up after 10 secs.

Does anyone have any ideas what might be causing this? It could be a problem when an office full of people start making calls on Monday morning.

Thanks in advance for any help anyone can offer.

[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [01xxxxxxxxx@from-internal:1] Macro("SIP/5145-0000052b", "user-callerid,LIMIT,") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:1] Set("SIP/5145-0000052b", "AMPUSER=5145") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:2] GotoIf("SIP/5145-0000052b", "0?report") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:3] ExecIf("SIP/5145-0000052b", "1?Set(REALCALLERIDNUM=5145)") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:4] Set("SIP/5145-0000052b", "AMPUSER=5145") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:5] Set("SIP/5145-0000052b", "AMPUSERCIDNAME=Me") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:6] GotoIf("SIP/5145-0000052b", "0?report") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:7] Set("SIP/5145-0000052b", "AMPUSERCID=5145") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:8] Set("SIP/5145-0000052b", "CALLERID(all)="Me" <5145>") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:9] GotoIf("SIP/5145-0000052b", "0?limit") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:10] ExecIf("SIP/5145-0000052b", "1?Set(GROUP(concurrency_limit)=5145)") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:11] GosubIf("SIP/5145-0000052b", "7?sub-ccss,s,1(from-internal,01xxxxxxxxx)") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@sub-ccss:1] ExecIf("SIP/5145-0000052b", "0?Return()") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@sub-ccss:2] Set("SIP/5145-0000052b", "CCSS_SETUP=TRUE") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@sub-ccss:3] GosubIf("SIP/5145-0000052b", "0?monitor_config,1(from-internal,01xxxxxxxxx):monitor_default,1(from-internal,01xxxxxxxxx)") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [monitor_default@sub-ccss:1] GotoIf("SIP/5145-0000052b", "0?is_exten") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [monitor_default@sub-ccss:2] StackPop("SIP/5145-0000052b", "") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [monitor_default@sub-ccss:3] Return("SIP/5145-0000052b", "FALSE") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:12] GotoIf("SIP/5145-0000052b", "1?continue") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Goto (macro-user-callerid,s,25)
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:25] Set("SIP/5145-0000052b", "CALLERID(number)=5145") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:26] Set("SIP/5145-0000052b", "CALLERID(name)=Me") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-user-callerid:27] Set("SIP/5145-0000052b", "CHANNEL(language)=en") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [01xxxxxxxxx@from-internal:2] Set("SIP/5145-0000052b", "MOHCLASS=default") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [01xxxxxxxxx@from-internal:3] Set("SIP/5145-0000052b", "_NODEST=") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [01xxxxxxxxx@from-internal:4] Macro("SIP/5145-0000052b", "record-enable,5145,OUT,") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-record-enable:1] GotoIf("SIP/5145-0000052b", "1?check") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Goto (macro-record-enable,s,4)
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-record-enable:4] ExecIf("SIP/5145-0000052b", "0?MacroExit()") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-record-enable:5] GotoIf("SIP/5145-0000052b", "0?Group:OUT") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Goto (macro-record-enable,s,14)
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-record-enable:14] GotoIf("SIP/5145-0000052b", "0?IN") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-record-enable:15] ExecIf("SIP/5145-0000052b", "0?MacroExit()") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-record-enable:16] Set("SIP/5145-0000052b", "CALLFILENAME=OUT5145-20150228-145959-1425135599.1325") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-record-enable:17] Goto("SIP/5145-0000052b", "record") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Goto (macro-record-enable,s,20)
[Feb 28 14:59:59] WARNING[17393] func_strings.c: EVAL requires an argument: EVAL(<string>)
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-record-enable:20] MixMonitor("SIP/5145-0000052b", "OUT5145-20150228-145959-1425135599.1325.wav,,/var/lib/asterisk/bin/sendrecordingbyemail ^{CALLFILENAME}.^{MIXMON_FORMAT} ^{UNIQUEID}") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-record-enable:21] MacroExit("SIP/5145-0000052b", "") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [01xxxxxxxxx@from-internal:5] Macro("SIP/5145-0000052b", "dialout-trunk,3,01xxxxxxxxx,") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:1] Set("SIP/5145-0000052b", "DIAL_TRUNK=3") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:2] GosubIf("SIP/5145-0000052b", "0?sub-pincheck,s,1") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:3] GotoIf("SIP/5145-0000052b", "0?disabletrunk,1") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:4] Set("SIP/5145-0000052b", "DIAL_NUMBER=01xxxxxxxxx") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:5] Set("SIP/5145-0000052b", "DIAL_TRUNK_OPTIONS=Tt") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:6] Set("SIP/5145-0000052b", "OUTBOUND_GROUP=OUT_3") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:7] GotoIf("SIP/5145-0000052b", "1?nomax") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Goto (macro-dialout-trunk,s,9)
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:9] GotoIf("SIP/5145-0000052b", "0?skipoutcid") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:10] Set("SIP/5145-0000052b", "DIAL_TRUNK_OPTIONS=Tt") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:11] Macro("SIP/5145-0000052b", "outbound-callerid,3") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-outbound-callerid:1] ExecIf("SIP/5145-0000052b", "0?Set(CALLERPRES()=)") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-outbound-callerid:2] ExecIf("SIP/5145-0000052b", "0?Set(REALCALLERIDNUM=5145)") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-outbound-callerid:3] GotoIf("SIP/5145-0000052b", "1?normcid") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Goto (macro-outbound-callerid,s,6)
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-outbound-callerid:6] Set("SIP/5145-0000052b", "USEROUTCID=01xxxxx5145") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-outbound-callerid:7] Set("SIP/5145-0000052b", "EMERGENCYCID=") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-outbound-callerid:8] Set("SIP/5145-0000052b", "TRUNKOUTCID=0845xxxxxxx") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-outbound-callerid:9] GotoIf("SIP/5145-0000052b", "1?trunkcid") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Goto (macro-outbound-callerid,s,12)
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/5145-0000052b", "1?Set(CALLERID(all)=0845xxxxxxx)") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-outbound-callerid:13] ExecIf("SIP/5145-0000052b", "1?Set(CALLERID(all)=01xxxxx5145)") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-outbound-callerid:14] ExecIf("SIP/5145-0000052b", "0?Set(CALLERID(all)=)") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-outbound-callerid:15] ExecIf("SIP/5145-0000052b", "0?Set(CALLERPRES()=prohib_passed_screen)") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:12] GosubIf("SIP/5145-0000052b", "0?sub-flp-3,s,1") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:13] Set("SIP/5145-0000052b", "OUTNUM=01xxxxxxxxx") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:14] Set("SIP/5145-0000052b", "custom=SIP/PROVIDER1") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/5145-0000052b", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)Tt)") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:16] ExecIf("SIP/5145-0000052b", "0?Set(DIAL_TRUNK_OPTIONS=TtM(confirm))") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:17] Macro("SIP/5145-0000052b", "dialout-trunk-predial-hook,") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/5145-0000052b", "") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/5145-0000052b", "0?bypass,1") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:19] GotoIf("SIP/5145-0000052b", "0?customtrunk") in new stack
[Feb 28 14:59:59] VERBOSE[17393] pbx.c:     -- Executing [s@macro-dialout-trunk:20] Dial("SIP/5145-0000052b", "SIP/PROVIDER1/01xxxxxxxxx,300,Tt") in new stack
[Feb 28 14:59:59] VERBOSE[17393] netsock2.c:   == Using SIP RTP TOS bits 184
[Feb 28 14:59:59] VERBOSE[17393] netsock2.c:   == Using SIP RTP CoS mark 5
[Feb 28 14:59:59] VERBOSE[17393] app_dial.c:     -- Called SIP/PROVIDER1/01xxxxxxxxx
[Feb 28 15:00:03] VERBOSE[17393] app_dial.c:     -- SIP/PROVIDER1-0000052c is making progress passing it to SIP/5145-0000052b
[Feb 28 15:00:04] VERBOSE[17393] app_dial.c:     -- SIP/PROVIDER1-0000052c answered SIP/5145-0000052b
[Feb 28 15:00:36] VERBOSE[17393] pbx.c:     -- Executing [h@macro-dialout-trunk:1] Macro("SIP/5145-0000052b", "hangupcall,") in new stack
[Feb 28 15:00:36] VERBOSE[17393] pbx.c:     -- Executing [s@macro-hangupcall:1] GotoIf("SIP/5145-0000052b", "1?theend") in new stack
[Feb 28 15:00:36] VERBOSE[17393] pbx.c:     -- Goto (macro-hangupcall,s,3)
[Feb 28 15:00:36] VERBOSE[17393] pbx.c:     -- Executing [s@macro-hangupcall:3] Hangup("SIP/5145-0000052b", "") in new stack
[Feb 28 15:00:36] VERBOSE[17393] app_macro.c:   == Spawn extension (macro-hangupcall, s, 3) exited non-zero on 'SIP/5145-0000052b' in macro 'hangupcall'
[Feb 28 15:00:36] VERBOSE[17393] features.c:   == Spawn extension (macro-dialout-trunk, h, 1) exited non-zero on 'SIP/5145-0000052b'
[Feb 28 15:00:36] VERBOSE[17393] app_macro.c:   == Spawn extension (macro-dialout-trunk, s, 20) exited non-zero on 'SIP/5145-0000052b' in macro 'dialout-trunk'
[Feb 28 15:00:36] VERBOSE[17393] pbx.c:   == Spawn extension (from-internal, 01xxxxxxxxx, 5) exited non-zero on 'SIP/5145-0000052b'