[Freeswitch-users] How do I use eavesdrop?

Mark Sobkow m.sobkow at marketelsystems.com
Thu Mar 18 13:31:00 PDT 2010

I know eavesdrop is an application, not an API, so you have to use it 

I have an operator dialing in on extension 5000 being bridged to a 
client, and I'm getting those lovely little echoes that confirm the call 
is bridged (both operator and client softphones are sharing my one 
headset and mic.)

In the dialplan, I parse out the extension when someone dials in to 
665000 (last 4 digits are the extension to monitor), look up the 
appropriate operator UUID in my mnesia/Erlang tables, receive the "call" 
callback from Freeswitch, and build a proplists replacement with the 
execute-app-name set to "eavesdrop" and execute-app-arg set to the 
operator UUID.  I issue a sendmsg() command to Freeswitch, and it 
returns ok.

However, what happens to the extension that tried to eavesdrop is it 
gets two events: CHANNEL_PARK and SEND_MESSAGE.  The person making the 
eavesdrop call can't actually hear anything.

I've attached the Erlang callback module that the dialplan executes.  
The dialplan fragment is as follows:

<extension name=\"eavesdrop\">
    <condition field=\"destination_number\" 
        <action application=\"answer\"/>
        <action application=\"set\" data=\"eavesdrop_extension=$1\" />
        <action application=\"erlang\" data=\"pbx_eavesdrop 
pursuit at testsrv\" />

Unfortunately I can't think of any way to look up the UUID other than 
using the mnesia tables from the application.  When I tried the sample 
dialplans from Freeswitch, the eavesdrop module itself _did_ work.  I'm 
just having trouble cobbling together the "glue" for Erlang.

P.S. This is the last Freeswitch feature I have to code for this 
release, other than niggling cleanups like adding a few more voice 
prompts, which is easy enough as I've already sample code on how to do 
it.  With a little luck we'll make our April 1st ready-for-testing 
deadline!  We wouldn't have made it without Andrew's hints, tips, and 
tricks for using Erlang with Freeswitch. Thanks a lot! :D

Mark Sobkow
Senior Developer
MarkeTel Multi-Line Dialing Systems LTD.
428 Victoria Ave
Regina, SK S4N-0P6
Toll-Free: 800-289-8616-X533
Local: 306-359-6893-X533
Fax: 306-359-6879
Email: m.sobkow at marketelsystems.com
Web: http://www.marketelsystems.com 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pbx_eavesdrop.erl
Url: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100318/d115112a/attachment-0002.pl 

More information about the FreeSWITCH-users mailing list