Phantom call after remote disconnect on DAHDI channel

Hi,

Current PBX Version:14.0.1.4
Current System Version:12.7.3-1708-1.sng7
Current Asterisk Version: 13.17.1

Just finished an Admin/Updates/System Update today and I’ve started seeing some strange behaviour on incoming calls from my external PBX exchange.
I have one DAHDi trunk, which points to ‘Analog Channel 1’ in the DAHDI Trunk Settings. Oddly, once this has been set, the ‘Analog Channel 1’ selection disappears from the drop down menu (but I don’t think that’s the main problem).
Destination in the Inbound Route is set to Ring Group, which rings all internal extensions
If I use my mobile to make a call into the system via the DAHDi trunk, all extensions ring as expected - correctly showing the callerid. If I then hangup the call from my mobile (without picking up any of the extensions) the extensions stop ringing, but on some occasions the extensions will start ringing again for a couple of rings (callerid now displays unknown) and then stops.

I’ve tried moving the DAHDi trunk over to ‘Analog Channel 4’ and get the same result. (my card has 2 FXO & 2 FXS ports).
I have the same issue if I point the inbound route to a single extension instead of a Ring Group

Any ideas?

Here’s an extract from the log at the time it happens:

[2017-10-08 18:55:16] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:1] GotoIf("DAHDI/1-1", "1?theend") in new stack
[2017-10-08 18:55:16] VERBOSE[9922][C-00000000] pbx_builtins.c: Goto (macro-hangupcall,s,3)
[2017-10-08 18:55:16] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:3] ExecIf("DAHDI/1-1", "0?Set(CDR(recordingfile)=)") in new stack
[2017-10-08 18:55:16] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:4] NoOp("DAHDI/1-1", "SIP/5012-00000009 monior file= ") in new stack
[2017-10-08 18:55:16] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:5] AGI("DAHDI/1-1", "attendedtransfer-rec-restart.php,SIP/5012-00000009,") in new stack
[2017-10-08 18:55:16] VERBOSE[9922][C-00000000] res_agi.c: Launched AGI Script /var/lib/asterisk/agi-bin/attendedtransfer-rec-restart.php
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] res_agi.c: <DAHDI/1-1>AGI Script attendedtransfer-rec-restart.php completed, returning 0
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:6] Hangup("DAHDI/1-1", "") in new stack
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] app_macro.c: Spawn extension (macro-hangupcall, s, 6) exited non-zero on 'DAHDI/1-1' in macro 'hangupcall'
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] pbx.c: Spawn extension (ext-group, h, 1) exited non-zero on 'DAHDI/1-1'
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] app_stack.c: DAHDI/1-1 Internal Gosub(crm-hangup,s,1) start
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:1] NoOp("DAHDI/1-1", "Sending Hangup to CRM") in new stack
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:2] NoOp("DAHDI/1-1", "HANGUP CAUSE: 16") in new stack
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:3] ExecIf("DAHDI/1-1", "0?Set(__CRM_VOICEMAIL=)") in new stack
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:4] NoOp("DAHDI/1-1", "MASTER CHANNEL: 1507485307.0 = 1507485307.0") in new stack
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:5] GotoIf("DAHDI/1-1", "0?return") in new stack
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:6] Set("DAHDI/1-1", "__CRM_HANGUP=1") in new stack
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:7] AGI("DAHDI/1-1", "sangomacrm.agi") in new stack
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] res_agi.c: Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] res_agi.c: <DAHDI/1-1>AGI Script sangomacrm.agi completed, returning 0
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] pbx.c: Executing [[email protected]:8] Return("DAHDI/1-1", "") in new stack
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] app_stack.c: Spawn extension (ext-group, h, 1) exited non-zero on 'DAHDI/1-1'
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] app_stack.c: DAHDI/1-1 Internal Gosub(crm-hangup,s,1) complete GOSUB_RETVAL=
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] sig_analog.c: Hanging up on 'DAHDI/1-1'
[2017-10-08 18:55:17] VERBOSE[9922][C-00000000] chan_dahdi.c: Hungup 'DAHDI/1-1'
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] sig_analog.c: Starting simple switch on 'DAHDI/1-1'
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] pbx.c: Executing [[email protected]:1] NoOp("DAHDI/1-1", "Entering from-dahdi with DID == ") in new stack
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] pbx.c: Executing [[email protected]:2] Ringing("DAHDI/1-1", "") in new stack
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] pbx.c: Executing [[email protected]:3] Set("DAHDI/1-1", "DID=s") in new stack
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] pbx.c: Executing [[email protected]:4] NoOp("DAHDI/1-1", "DID is now s") in new stack
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] pbx.c: Executing [[email protected]:5] GotoIf("DAHDI/1-1", "1?dahdiok:checkzap") in new stack
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] pbx_builtins.c: Goto (from-analog,s,9)
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] pbx.c: Executing [[email protected]:9] NoOp("DAHDI/1-1", "Is a DAHDi Channel") in new stack
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] pbx.c: Executing [[email protected]:10] Set("DAHDI/1-1", "CHAN=1-1") in new stack
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] pbx.c: Executing [[email protected]:11] Set("DAHDI/1-1", "CHAN=1") in new stack
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] pbx.c: Executing [[email protected]:12] Macro("DAHDI/1-1", "from-dahdi-1,s,1") in new stack
[2017-10-08 18:55:17] WARNING[9969][C-00000001] app_macro.c: No such context 'macro-from-dahdi-1' for macro 'from-dahdi-1'. Was called by [email protected]
[2017-10-08 18:55:17] VERBOSE[9969][C-00000001] pbx.c: Executing [[email protected]:13] NoOp("DAHDI/1-1", "Returned from Macro from-dahdi-1") in new stack