Orphaned local channels on transfer


I have queue with some SIP agents and sometimes one agent pickup calls from another agent who’s not answering. When this agent transfer the call to another Asterisk leaves a local channel orphaned, I have to hangup these channels manually.

It seems that is some thing related to MixMonitor.

Below is the relevant logs, I apreciate any help.

[2017-09-13 08:39:01] NOTICE[3674]: pickup.c:223 ast_pickup_call: Pickup SIP/2339-00006caa attempt by SIP/2332-00006cab [202/1383]
– SIP/2332-00006cab answered SIP/GVT-00006ca7
– Stopped music on hold on SIP/GVT-00006ca7
== Begin MixMonitor Recording SIP/GVT-00006ca7
– Channel SIP/2332-00006cab joined ‘simple_bridge’ basic-bridge <64368592-2e0c-4fd3-bc64-ec7c7b38cc93>
– Channel SIP/GVT-00006ca7 joined ‘simple_bridge’ basic-bridge <64368592-2e0c-4fd3-bc64-ec7c7b38cc93>
– Started music on hold, class ‘default’, on channel ‘SIP/GVT-00006ca7’
– <SIP/2332-00006cab> Playing ‘pbx-transfer.slin16’ (language ‘br’)
– Executing [2320@from-internal-default:1] Gosub(“Local/2320@from-internal-default-00000134;2”, “start-mixmonitor,2320,1”) in new stack
– Channel Local/2320@from-internal-default-00000134;1 joined ‘simple_bridge’ basic-bridge
– Executing [2320@start-mixmonitor:1] NoOp(“Local/2320@from-internal-default-00000134;2”, “”) in new stack
– Executing [2320@start-mixmonitor:2] ResetCDR(“Local/2320@from-internal-default-00000134;2”, “w”) in new stack
– Executing [2320@start-mixmonitor:3] StopMixMonitor(“Local/2320@from-internal-default-00000134;2”, “”) in new stack
– Executing [2320@start-mixmonitor:4] System(“Local/2320@from-internal-default-00000134;2”, “mkdir -p /var/spool/asterisk/monitor/2017/09/13”) in new stack
– Channel SIP/2332-00006cab left ‘simple_bridge’ basic-bridge <64368592-2e0c-4fd3-bc64-ec7c7b38cc93>
– Channel SIP/2332-00006cab joined ‘simple_bridge’ basic-bridge
– Executing [2320@start-mixmonitor:5] Set(“Local/2320@from-internal-default-00000134;2”, “_MONITOR_FILE=/var/spool/asterisk/monitor/2017/09/13/2332-2320-084131.wav”) in new stack
– Executing [2320@start-mixmonitor:6] MixMonitor(“Local/2320@from-internal-default-00000134;2”, “/var/spool/asterisk/monitor/2017/09/13/2332-2320-084131.wav,b”) in new stack
– Executing [2320@start-mixmonitor:7] Return(“Local/2320@from-internal-default-00000134;2”, “”) in new stack
– Executing [2320@from-internal-default:2] Dial(“Local/2320@from-internal-default-00000134;2”, “SIP/2320,40,rtT”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/2320
== Begin MixMonitor Recording Local/2320@from-internal-default-00000134;2
– SIP/2320-00006cb7 is ringing
– SIP/2320-00006cb7 answered Local/2320@from-internal-default-00000134;2
– Channel SIP/2320-00006cb7 joined ‘simple_bridge’ basic-bridge
– Channel Local/2320@from-internal-default-00000134;2 joined ‘simple_bridge’ basic-bridge
– Channel Local/2320@from-internal-default-00000134;1 left ‘simple_bridge’ basic-bridge
– Stopped music on hold on SIP/GVT-00006ca7
– Channel Local/2320@from-internal-default-00000134;1 joined ‘simple_bridge’ basic-bridge <64368592-2e0c-4fd3-bc64-ec7c7b38cc93>
– Channel SIP/2332-00006cab left ‘simple_bridge’ basic-bridge
– <Local/2320@from-internal-default-00000134;1> Playing ‘beep.gsm’ (language ‘en’)

Seems like you are using FreePBX based distro and the dialplan is created by it. Contact them and ask for this in their forum.

No, I’m not using FreePBX, I use vanilla Asterisk and this dialplan I wrote myself.

Whilst it is unlikely that this will get fixed without help from the FreePBX people, as they need to simplify the scenario and also use a debug build of Asterisk, before a usable bug report can be submitted, it does sound as though the underlying problem is in Asterisk, rather than FreePBX.

Hi. I’m not using FreePBX, I wrote the dialplan myself.

I’d want to start with core show channel xxxx on one of the orphaned channels. Also, I would probably want to get a “thread apply all bt” from a debug build of Asterisk, to see if the PBX threads were still running for the local channels, and if so, what they were waiting for.

pabx*CLI> core show channel Local/2320@from-internal-default-00000134;2 
 -- General --
           Name: Local/2320@from-internal-default-00000134;2
           Type: Local
       UniqueID: 1505302891.52999
       LinkedID: 1505302693.52980
      Caller ID: 4734325007
 Caller ID Name: (N/A)
Connected Line ID: 2320
Connected Line ID Name: (N/A)
Eff. Connected Line ID: 2320
Eff. Connected Line ID Name: (N/A)
    DNID Digits: (N/A)
       Language: en
          State: Up (6)
  NativeFormats: (alaw)
    WriteFormat: alaw
     ReadFormat: alaw
 WriteTranscode: No 
  ReadTranscode: No 
 Time to Hangup: 0
   Elapsed Time: 2h35m21s
      Bridge ID: d3917b17-9fbe-477b-9661-631a01bdb4e7
 --   PBX   --
        Context: from-internal-default
      Extension: 2320
       Priority: 2
     Call Group: 0
   Pickup Group: 0
    Application: Dial
           Data: SIP/2320,40,rtT
 Call Identifer: [C-00001d1a]

It thinks it is still running in Dial, but you need the backtraces to see if that is true.

Unfortunately, the way that channel replacements are done has changed since the versions of Asterisk for which I’ve studied the internals, so I’m not going to guess at the exact failure mode.