eavesdrop specific extention only

Status
Not open for further replies.
Aug 10, 2017
36
0
6
55
I am trying to allow eavesdrop to specific extension only for privacy reason.

I have found this info but it don't work. Any suggestion.

Specifying a group​


You can specify a "group" to limit the channels that an eavesdrop applies to. This may be useful for privacy reasons.

For example, if you only want to eavesdrop on incoming sales calls, you could set the "eavesdrop_group" variable on the original incoming channel:

<action application="set" data="eavesdrop_group=sales_call_eavesdrop"/>
Then create an eavesdrop command that only affects that "sales_call_eavesdrop" group:

<extension name="eavesdrop">
<condition field="destination_number" expression="^779$">
<action application="answer"/>
<action application="set" data="eavesdrop_require_group=sales_call_eavesdrop"/>
<action application="eavesdrop" data="all"/>
</condition>
</extension>
 

ad5ou

Active Member
Jun 12, 2018
884
195
43
Fusionpbx eavesdrop feature is done in LUA so I'm not sure where you looking at such an example.
The default Fusionpbx dial plan for eavesdrop looks like:
1620678144379.png

As shown, only people who know the pin_number can use the eavesdrop feature. The pin_number can be blanked out if desired, and other conditions can be added to test against the "sip_from_user" or the destination etc.
 
Aug 10, 2017
36
0
6
55
The exemple is from Freeswitch, we are looking for a way to disable a possible eavesdrop on specific extensions, it is a customer request
 

ad5ou

Active Member
Jun 12, 2018
884
195
43
Specific extensions that cannot be eavesdropped on, or extensions that cannot eavesdrop on others?
 

hfoster

Active Member
Jan 28, 2019
674
80
28
34
What I have done is used a combination of the destination_number regex and the sip_from_user regex. Not the most user friendly way of doing it, but very flexible.

${sip_from_user} ^(2001|2002)$
destination_number ^\*34(2003|2004|2005|2006)$
 
Aug 10, 2017
36
0
6
55
What I have done is used a combination of the destination_number regex and the sip_from_user regex. Not the most user friendly way of doing it, but very flexible.

${sip_from_user} ^(2001|2002)$
destination_number ^\*34(2003|2004|2005|2006)$
Oh that is a great idea !!, so the way I see it is only the extension 2001 and 2002 are able to eavesdrop on extension 2003 to 2006 right ?
 

hfoster

Active Member
Jan 28, 2019
674
80
28
34
Yeh, exactly. Our users would never remember the PIN or would share it willy nilly, so this worked a bit better.
 

jeetz

Member
Oct 15, 2019
73
0
6
40
<extension name="ChanSpy" continue="true" uuid="14792c06-4b8f-4744-a0f9-d702aa36c611">
<condition field="destination_number" expression="^*34(2004|2005|2006)$"/>
<condition field="${sip_from_user}" expression="^(2001|2002|2003)$">
<action application="export" data="call_direction=inbound" inline="true"/>
<action application="set" data="domain_uuid=a22d92bf-1e83-46c4-b9b4-1713df20696f" inline="true"/>
<action application="set" data="domain_name=myexample.com" inline="true"/>
<action application="answer" data=""/>
<action application="set" data="pin_number=52703130"/>
<action application="lua" data="eavesdrop lua $1"/>
</condition>
</extension>


still does not pickup......
 
Last edited:

hfoster

Active Member
Jan 28, 2019
674
80
28
34
I believe regex capture groups are reset on each condition, though I really am not a FreeSwitch guru so I might be wrong on that. Try switching the condition orders around so the destination number is the most recent for the $1 in the lua call.

I think you can also use ?: in the sip_from condition to not care about saving it. i.e:

<condition field="destination_number" expression="^*34(2003|2004|2005|2006)$"/>
<condition field="${sip_from_user}" expression="^(?:2001|2002)$">
 

jeetz

Member
Oct 15, 2019
73
0
6
40
nope, still no luck.....

<extension name="ChanSpy" continue="true" uuid="14792c06-4b8f-4744-a0f9-d702aa36c611">
<condition field="destination_number" expression="^*34(2003|2004|2005|2006)$"/>
<condition field="${sip_from_user}" expression="^(?:2001|2002)$">
<action application="export" data="call_direction=inbound" inline="true"/>
<action application="set" data="domain_uuid=a22d92bf-1e83-46c4-b9b4-1713df20696f" inline="true"/>
<action application="set" data="domain_name=myexample.com" inline="true"/>
<action application="answer" data=""/>
<action application="set" data="pin_number=52703130"/>
<action application="lua" data="eavesdrop lua $1"/>
</condition>
</extension>
 

hfoster

Active Member
Jan 28, 2019
674
80
28
34
As per the FreeSwitch Docs, yeh. I believe I was right in that the variable is only accessible in the condition group that matched it. Whilst the forum has munged the indentation the first one will not work, as evasedrop.lua has been given either 2001 or 2002 as the variable, whilst the second one will work as it's been given the destination_number capture:

XML:
<extension name="ChanSpy" continue="true" uuid="14792c06-4b8f-4744-a0f9-d702aa36c611">
    <condition field="destination_number" expression="^*34(2003|2004|2005|2006)$"/>
    <condition field="${sip_from_user}" expression="^(2001|2002)$">
        <action application="export" data="call_direction=inbound" inline="true"/>
        <action application="set" data="domain_uuid=a22d92bf-1e83-46c4-b9b4-1713df20696f" inline="true"/>
        <action application="set" data="domain_name=myexample.com" inline="true"/>
        <action application="answer" data=""/>
        <action application="set" data="pin_number=52703130"/>
        <action application="lua" data="eavesdrop lua $1"/>
    </condition>
</extension>

<extension name="ChanSpy" continue="true" uuid="14792c06-4b8f-4744-a0f9-d702aa36c611">
    <condition field="${sip_from_user}" expression="^(2001|2002)$"/>
    <condition field="destination_number" expression="^*34(2003|2004|2005|2006)$">
        <action application="export" data="call_direction=inbound" inline="true"/>
        <action application="set" data="domain_uuid=a22d92bf-1e83-46c4-b9b4-1713df20696f" inline="true"/>
        <action application="set" data="domain_name=myexample.com" inline="true"/>
        <action application="answer" data=""/>
        <action application="set" data="pin_number=52703130"/>
        <action application="lua" data="eavesdrop lua $1"/>
    </condition>
</extension>
 

jeetz

Member
Oct 15, 2019
73
0
6
40
ive got it working.....but now the pin doesnt enter lol


<extension name="ChanSpy" continue="true" uuid="14792c06-4b8f-4744-a0f9-d702aa36c611">
<condition field="destination_number" expression="^*33(d{2,7})$">
<action application="export" data="call_direction=inbound" inline="true"/>
<action application="set" data="domain_uuid=a22d92bf-1e83-46c4-b9b4-1713df20696f" inline="true"/>
<action application="set" data="domain_name=myexample.com" inline="true"/>
<action application="answer" data=""/>
<action application="set" data="pin_number=2222"/>
<action application="lua" data="eavesdrop.lua $1"/>
</condition>
</extension>
 

jeetz

Member
Oct 15, 2019
73
0
6
40
okay, entered pin number, surprisingly its not the pin i kept, but its this 58094965 and i just want my callee hearing, not my caller hearing any idea? and why does the call finish, when caller hangs up, any ideas?

edit: this is what all can be done while hearing, Listen to the call. Press 1 remote, 2 local, 3 full conversation, 0 mute

now only need not to drop the call, when caller hangs up.....

@hfoster your given code also works like a charm......but hangs up, any idea about that?


<extension name="ChanSpy" continue="true" uuid="14792c06-4b8f-4744-a0f9-d702aa36c611">
<condition field="${sip_from_user}" expression="^(2001|2002)$"/>
<condition field="destination_number" expression="^*34(2003|2004|2005|2006)$">
<action application="export" data="call_direction=inbound" inline="true"/>
<action application="set" data="domain_uuid=a22d92bf-1e83-46c4-b9b4-1713df20696f" inline="true"/>
<action application="set" data="domain_name=myexample.com" inline="true"/>
<action application="answer" data=""/>
<action application="set" data="pin_number=52703130"/>
<action application="lua" data="eavesdrop lua $1"/>
</condition>
</extension>
 
Last edited:

hfoster

Active Member
Jan 28, 2019
674
80
28
34
It hangs up because it's an eavesdrop, and not a conference. You might be able to hack the eavesdrop.lua into something where it keeps the session alive, maybe. Way beyond me though. As for the pin, I'm going to guess it was cached.

Option 2 is what you want, local is the 'whisper' feature. Option 3 turns it into kind of a 3 way call.
 

jeetz

Member
Oct 15, 2019
73
0
6
40
ok @hfoster thanks a lot buddy.......:):)

anyone got a "hacked the eavesdrop.lua into something where it keeps the session alive" :D
 

jeetz

Member
Oct 15, 2019
73
0
6
40
It hangs up because it's an eavesdrop, and not a conference. You might be able to hack the eavesdrop.lua into something where it keeps the session alive, maybe. Way beyond me though. As for the pin, I'm going to guess it was cached.

Option 2 is what you want, local is the 'whisper' feature. Option 3 turns it into kind of a 3 way call.
@hfoster any idea where to look if i want to keep the call connected?
 

hfoster

Active Member
Jan 28, 2019
674
80
28
34
Not really no. I have never written a lua script for Freeswitch, so I've got no clue. Perhaps you would have to create something using mod_spy instead. This is more in the realms of FreeSwitch rather than FusionPBX though.
 
Status
Not open for further replies.