7145551234 = My cell phone 111.222.111.222 = IP Address of SIP Client 9987 = my extension on PBXSales 999015 = agent extension being spied on *225XXXXXX = command which initializes chanspy 208.0.0.254 = random IP from the carrier processing the call 207.0.0.132 = same as above for the 1st call 123.45.67.89 = IP Address of PBXSales I added some debugging code to app_chanspy to help me get a better idea of what's going on. Here is what I did: I called out from 999015 to my cell 7145551234 After I answered, I dialed *225 999015 from 9987 to spy via chanspy(SIP/999015,d) At this point, it attaches both the whisper and barge channels immediately, even though it starts on listen mode. [@ 2014-03-05 13:53:09] I then pressed 6 to barge, and got no message in the log, and heard my voice on all channels as expected. I then hung up 999015, killing the call, but left the chanspy open on 9987 I dialed my cell again from 999015, as soon as it started ringing, I heard chanspy connect to the call [@ 2014-03-05 13:53:09] Notice that it attaches the whisper channel immediately, and since the bridged party hasn't answered, it looks like that's why it's not able to barge, even after the line is picked up. While the call between 999015 -> 7145551234 was still active, I pressed * on 9987, to rotate the call [@ 2014-03-05 13:55:04] At this point, it reconnects me and since both channels are up, it locks on to each of them, and now when i press 6 to barge it works on both channels. I have submitted a patch which tries to reattach the bridged channel if in barge mode to fix the issue. Dialplan: [9987's system] exten => _*225XXXXXX,1,Macro(user-callerid,) same => n,Set(_SKIP_PH=1) same => n,NoCDR same => n(jump),Dial(SIP/${ODBC_PFLOOKUP(${EXTEN:4})}/${EXTEN}) Dialplan [999015 system] exten => _*225x.#,1,Macro(user-callerid,) same => n,GotoIf($[${DIALPLAN_EXISTS(ext-local,${EXTEN:4},1)}=0]?jump) same => n,Answer same => n,NoCDR same => n,Wait(1) same => n,ChanSpy(sip/${EXTEN:4},d) same => n,Hangup same => n(jump),Set(_SKIP_PH=1) same => n,Macro(dialout-trunk,3,${EXTEN},,off) Sample call: -- Executing [7145551234@from-internal:1] NoOp("SIP/999015-00000007", "Ignore this") in new stack -- Executing [7145551234@from-internal:2] Dial("SIP/999015-00000007", "SIP/SIPTrunkum_Out/7145551234") in new stack == Using SIP RTP TOS bits 184 == Using SIP RTP CoS mark 5 -- Called SIP/SIPTrunkum_Out/7145551234 > 0x7f220402d210 -- Probation passed - setting RTP source address to 207.0.0.132:15076 -- SIP/SIPTrunkum_Out-00000008 is ringing -- SIP/SIPTrunkum_Out-00000008 is making progress passing it to SIP/999015-00000007 > 0x7f220402d210 -- Probation passed - setting RTP source address to 207.0.0.132:15076 > 0x7f222c02d1a0 -- Probation passed - setting RTP source address to 111.222.111.222:5397 > 0x7f222c02d1a0 -- Probation passed - setting RTP source address to 111.222.111.222:5397 -- SIP/SIPTrunkum_Out-00000008 answered SIP/999015-00000007 == Using SIP RTP TOS bits 184 == Using SIP RTP CoS mark 5 -- Executing [*225999015@from-trunk-sip-PBXSales_Out:1] Set("SIP/PBXSales_Out-00000009", "GROUP()=OUT_3") in new stack -- Executing [*225999015@from-trunk-sip-PBXSales_Out:2] Goto("SIP/PBXSales_Out-00000009", "from-trunk,*225999015,1") in new stack -- Goto (from-trunk,*225999015,1) -- Executing [*225999015@from-trunk:1] Set("SIP/PBXSales_Out-00000009", "CDR(hostname)=center15") in new stack -- Executing [*225999015@from-trunk:2] Set("SIP/PBXSales_Out-00000009", "__ANSWERTIME=1394056382") in new stack -- Executing [*225999015@from-trunk:3] Goto("SIP/PBXSales_Out-00000009", "from-pstn,*225999015,1") in new stack -- Goto (from-pstn,*225999015,1) -- Executing [*225999015@from-pstn:1] Macro("SIP/PBXSales_Out-00000009", "user-callerid,") in new stack -- Executing [s@macro-user-callerid:1] Set("SIP/PBXSales_Out-00000009", "AMPUSER=9987") in new stack -- Executing [s@macro-user-callerid:2] GotoIf("SIP/PBXSales_Out-00000009", "0?report") in new stack -- Executing [s@macro-user-callerid:3] ExecIf("SIP/PBXSales_Out-00000009", "1?Set(REALCALLERIDNUM=9987)") in new stack -- Executing [s@macro-user-callerid:4] Set("SIP/PBXSales_Out-00000009", "AMPUSER=") in new stack -- Executing [s@macro-user-callerid:5] Set("SIP/PBXSales_Out-00000009", "AMPUSERCIDNAME=") in new stack -- Executing [s@macro-user-callerid:6] GotoIf("SIP/PBXSales_Out-00000009", "1?report") in new stack -- Goto (macro-user-callerid,s,14) -- Executing [s@macro-user-callerid:14] GotoIf("SIP/PBXSales_Out-00000009", "0?continue") in new stack -- Executing [s@macro-user-callerid:15] Set("SIP/PBXSales_Out-00000009", "__TTL=64") in new stack -- Executing [s@macro-user-callerid:16] GotoIf("SIP/PBXSales_Out-00000009", "1?continue") in new stack -- Goto (macro-user-callerid,s,27) -- Executing [s@macro-user-callerid:27] Set("SIP/PBXSales_Out-00000009", "CALLERID(number)=9987") in new stack -- Executing [s@macro-user-callerid:28] Set("SIP/PBXSales_Out-00000009", "CALLERID(name)=RobertTest-9987") in new stack -- Executing [s@macro-user-callerid:29] Set("SIP/PBXSales_Out-00000009", "CDR(cnum)=9987") in new stack -- Executing [s@macro-user-callerid:30] Set("SIP/PBXSales_Out-00000009", "CDR(cnam)=RobertTest-9987") in new stack -- Executing [s@macro-user-callerid:31] Set("SIP/PBXSales_Out-00000009", "CHANNEL(language)=en") in new stack -- Executing [*225999015@from-pstn:2] GotoIf("SIP/PBXSales_Out-00000009", "0?jump") in new stack -- Executing [*225999015@from-pstn:3] Answer("SIP/PBXSales_Out-00000009", "") in new stack > 0x7f222c03c6c0 -- Probation passed - setting RTP source address to 123.45.67.89:14556 -- Executing [*225999015@from-pstn:4] NoCDR("SIP/PBXSales_Out-00000009", "") in new stack -- Executing [*225999015@from-pstn:5] Wait("SIP/PBXSales_Out-00000009", "1") in new stack -- Executing [*225999015@from-pstn:6] ChanSpy("SIP/PBXSales_Out-00000009", "sip/999015,d") in new stack -- Playing 'beep.ulaw' (language 'en') -- Playing 'spy-sip.ulaw' (language 'en') -- Playing 'digits/9.ulaw' (language 'en') -- Playing 'digits/9.ulaw' (language 'en') -- Playing 'digits/9.ulaw' (language 'en') -- Playing 'digits/0.ulaw' (language 'en') -- Playing 'digits/1.ulaw' (language 'en') -- Playing 'digits/5.ulaw' (language 'en') == Spying on channel SIP/999015-00000007 [2014-03-05 13:53:09] NOTICE[28973][C-00000005]: app_chanspy.c:487 start_spying: Attaching SIP/PBXSales_Out-00000009 to SIP/999015-00000007 [2014-03-05 13:53:09] NOTICE[28973][C-00000005]: app_chanspy.c:487 start_spying: Attaching SIP/PBXSales_Out-00000009 to SIP/999015-00000007 -- EZRob: Should be spying on channel: SIP/999015-00000007. Whisper mode -- EZRob: Barge: Locking Channel: SIP/SIPTrunkum_Out-00000008 Result: 0 [2014-03-05 13:53:09] NOTICE[28973][C-00000005]: app_chanspy.c:487 start_spying: Attaching SIP/PBXSales_Out-00000009 to SIP/SIPTrunkum_Out-00000008 -- EZRob: Should be spying on channel: SIP/SIPTrunkum_Out-00000008. Barge mode -- EZRob: Barge: Unlocking channel: SIP/SIPTrunkum_Out-00000008 Result: 0 -- Executing [h@from-internal:1] Hangup("SIP/999015-00000007", "") in new stack == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/999015-00000007' == Spawn extension (from-internal, 7145551234, 2) exited non-zero on 'SIP/999015-00000007' == Done Spying on channel SIP/999015-00000007 -- Playing 'beep.ulaw' (language 'en') == Using SIP RTP TOS bits 184 == Using SIP RTP CoS mark 5 -- Executing [7145551234@from-internal:1] NoOp("SIP/999015-0000000a", "Ignore this") in new stack -- Executing [7145551234@from-internal:2] Dial("SIP/999015-0000000a", "SIP/SIPTrunkum_Out/7145551234") in new stack == Using SIP RTP TOS bits 184 == Using SIP RTP CoS mark 5 -- Called SIP/SIPTrunkum_Out/7145551234 -- Playing 'spy-sip.ulaw' (language 'en') -- Playing 'digits/9.ulaw' (language 'en') -- SIP/SIPTrunkum_Out-0000000b is ringing -- SIP/SIPTrunkum_Out-0000000b is making progress passing it to SIP/999015-0000000a > 0x7f2204008ee0 -- Probation passed - setting RTP source address to 208.0.0.254:25072 > 0x7f222c02ca80 -- Probation passed - setting RTP source address to 111.222.111.222:21146 > 0x7f222c02ca80 -- Probation passed - setting RTP source address to 111.222.111.222:21146 -- Playing 'digits/9.ulaw' (language 'en') -- Playing 'digits/9.ulaw' (language 'en') -- Playing 'digits/0.ulaw' (language 'en') -- Playing 'digits/1.ulaw' (language 'en') -- Playing 'digits/5.ulaw' (language 'en') == Spying on channel SIP/999015-0000000a [2014-03-05 13:54:18] NOTICE[28973][C-00000005]: app_chanspy.c:487 start_spying: Attaching SIP/PBXSales_Out-00000009 to SIP/999015-0000000a [2014-03-05 13:54:18] NOTICE[28973][C-00000005]: app_chanspy.c:487 start_spying: Attaching SIP/PBXSales_Out-00000009 to SIP/999015-0000000a -- EZRob: Should be spying on channel: SIP/999015-0000000a. Whisper mode -- SIP/SIPTrunkum_Out-0000000b answered SIP/999015-0000000a == Done Spying on channel SIP/999015-0000000a -- Playing 'beep.ulaw' (language 'en') -- Playing 'spy-sip.ulaw' (language 'en') -- Playing 'digits/9.ulaw' (language 'en') -- Playing 'digits/9.ulaw' (language 'en') -- Playing 'digits/9.ulaw' (language 'en') -- Playing 'digits/0.ulaw' (language 'en') -- Playing 'digits/1.ulaw' (language 'en') -- Playing 'digits/5.ulaw' (language 'en') == Spying on channel SIP/999015-0000000a [2014-03-05 13:55:04] NOTICE[28973][C-00000005]: app_chanspy.c:487 start_spying: Attaching SIP/PBXSales_Out-00000009 to SIP/999015-0000000a [2014-03-05 13:55:04] NOTICE[28973][C-00000005]: app_chanspy.c:487 start_spying: Attaching SIP/PBXSales_Out-00000009 to SIP/999015-0000000a -- EZRob: Should be spying on channel: SIP/999015-0000000a. Whisper mode -- EZRob: Barge: Locking Channel: SIP/SIPTrunkum_Out-0000000b Result: 0 [2014-03-05 13:55:04] NOTICE[28973][C-00000005]: app_chanspy.c:487 start_spying: Attaching SIP/PBXSales_Out-00000009 to SIP/SIPTrunkum_Out-0000000b -- EZRob: Should be spying on channel: SIP/SIPTrunkum_Out-0000000b. Barge mode -- EZRob: Barge: Unlocking channel: SIP/SIPTrunkum_Out-0000000b Result: 0 == Done Spying on channel SIP/999015-0000000a == Spawn extension (from-pstn, *225999015, 6) exited non-zero on 'SIP/PBXSales_Out-00000009' -- Executing [h@from-pstn:1] Macro("SIP/PBXSales_Out-00000009", "hangupcall,") in new stack -- Executing [s@macro-hangupcall:1] GotoIf("SIP/PBXSales_Out-00000009", "1?theend") in new stack -- Goto (macro-hangupcall,s,3) -- Executing [s@macro-hangupcall:3] ExecIf("SIP/PBXSales_Out-00000009", "0?Set(CDR(recordingfile)=)") in new stack -- Executing [s@macro-hangupcall:4] Hangup("SIP/PBXSales_Out-00000009", "") in new stack == Spawn extension (macro-hangupcall, s, 4) exited non-zero on 'SIP/PBXSales_Out-00000009' in macro 'hangupcall' == Spawn extension (from-pstn, h, 1) exited non-zero on 'SIP/PBXSales_Out-00000009' -- Executing [h@from-internal:1] Hangup("SIP/999015-0000000a", "") in new stack == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/999015-0000000a' == Spawn extension (from-internal, 7145551234, 2) exited non-zero on 'SIP/999015-0000000a'