Summary:ASTERISK-16729: Chanspy using spy groups not getting audio from calls placed to a queue using local channel
Reporter:Edward Smola (esmola)Labels:
Date Opened:2010-09-24 12:54:26Date Closed:2015-03-27 17:01:06
Versions:Frequency of
Environment:Attachments:( 0) example_console.txt
Description:There is a queue member 650 which is added as a member to the queue "vlcn_group_777" by inserting into the queue_member_table RealTime table.

INSERT INTO queue_member_table (context,queue_name, interface) VALUES ('vlcn', 'vlcn_group_777', 'Local/650@vlcn_group_777_agents')

A call is then placed and routed to that Queue:

vlcn_group_777, s, 1, Queue(vlcn_group_777|nr|||20)
vlcn_group_777, s, 2, GoTo(vlcn_aa_Main|s|1)

The Queue() application sends the call to the queue member at the Local/ interface:

vlcn_group_777_agents, _X., 1, Set(SBC_HOST=)
vlcn_group_777_agents, _X., 2, Set(__SPYGROUP=${SPYGROUP}:sip${EXTEN}_vlcn)
vlcn_group_777_agents, _X., 3, Dial(SIP/sip${EXTEN}_vlcn${SBC_HOST})

You see that above, we set {{__SPYGROUP}} for this party so that another user may be able to ChanSpy() on them without knowing their actual SIP/ channel

Next, another user attempts to spy on the extension 650 taking the queue call above:

vlcn_listenlive, _XXX, 1, Gosub(vlcn_listenlive_listener_whitelist|${CALLERID(num)}|1)
vlcn_listenlive, _XXX, 2, Gosub(vlcn_listenlive_listenee_whitelist|${EXTEN}|1)
vlcn_listenlive, _XXX, 3, Authenticate(123456)
vlcn_listenlive, _XXX, 4, Set(GROUP()=vlcn_ll_${EXTEN})
vlcn_listenlive, _XXX, 5, GotoIf($[${GROUP_COUNT(vlcn_ll_${EXTEN})} > 1]?vlcn_listenlive_mutex|s|1)
vlcn_listenlive, _XXX, 6, Wait(1)
vlcn_listenlive, _XXX, 7, ChanSpy(|qv(4)g(sip${EXTEN}_vlcn))
vlcn_listenlive, _XXX, 8, Hangup()

Note that we use the g() option for ChanSpy().

Result: No audio is heard by the Spying party.


this was noticed on 1.4.29 and confirmed to have the same behavior in 1.4.37

Calls originating from an external source seem to be able to be spied on in the lap machine while calls on that machine seem to not be able to spied most of the time on the same lab machine.

This same exact ChanSpy() usage works correctly if the party being spied on is not a Local/ interface.

We can eliminate the problem by not using {{__SPYGROUP}}:

vlcn_listenlive, _XXX, 7, ChanSpy(SIP/sip${EXTEN}_vlcn|qv(4))

Although that eliminates the practical problem, there is still a bug when using ChanSpy() with groups "g()" option on a Local/ interface - which is something we have to be able to have working.

Comments:By: Matt Jordan (mjordan) 2015-03-27 17:01:01.398-0500

This doesn't appear to be a bug any longer. Testing with the latest Asterisk 11:

*CLI>   == Using SIP RTP CoS mark 5
   -- Executing [900@default:1] NoOp("SIP/alice-00000000", "") in new stack
   -- Executing [900@default:2] ChanSpy("SIP/alice-00000000", ",qv(4)g(sip601)") in new stack
      > 0x7f36200214c0 -- Probation passed - setting RTP source address to
 == Spawn extension (default, 900, 2) exited non-zero on 'SIP/alice-00000000'
 == Using SIP RTP CoS mark 5
   -- Executing [900@default:1] NoOp("SIP/alice-00000001", "") in new stack
   -- Executing [900@default:2] ChanSpy("SIP/alice-00000001", ",qv(4)g(sip601)") in new stack
      > 0x7f362007ecf0 -- Probation passed - setting RTP source address to
 == Using SIP RTP CoS mark 5
   -- Executing [800@default:1] NoOp("SIP/ekiga-00000002", "") in new stack
   -- Executing [800@default:2] Dial("SIP/ekiga-00000002", "Local/801@default") in new stack
   -- Called Local/801@default
   -- Executing [801@default:1] NoOp("Local/801@default-00000000;2", "") in new stack
   -- Executing [801@default:2] Set("Local/801@default-00000000;2", "__SPYGROUP=sip601") in new stack
   -- Executing [801@default:3] Dial("Local/801@default-00000000;2", "SIP/bob") in new stack
 == Using SIP RTP CoS mark 5
   -- Called SIP/bob
 == Spying on channel Local/801@default-00000000;2
[Mar 27 16:59:31] NOTICE[28167][C-00000001]: app_chanspy.c:491 start_spying: Attaching SIP/alice-00000001 to Local/801@default-00000000;2
   -- SIP/bob-00000003 is ringing
   -- Local/801@default-00000000;1 is ringing
      > 0x7f35f401a690 -- Probation passed - setting RTP source address to
   -- SIP/bob-00000003 answered Local/801@default-00000000;2
   -- Local/801@default-00000000;1 answered SIP/ekiga-00000002
      > 0x7f35f401a690 -- Probation passed - setting RTP source address to
 == Spawn extension (default, 801, 3) exited non-zero on 'Local/801@default-00000000;2'
      > 0x7f36200b1f90 -- Probation passed - setting RTP source address to
 == Spawn extension (default, 800, 2) exited non-zero on 'SIP/ekiga-00000002'
 == Done Spying on channel Local/801@default-00000000;2