[Freeswitch-users] Recording calls with a beep
Michael Collins
msc at freeswitch.org
Tue Oct 30 03:09:24 MSK 2012
Sounds like this is something that's more ad-hoc, so you might want to do a
quick and dirty combo of Lua and sched_api. Roughly it would look something
like this:
<action application="bridge" data="{api_on_answer='luarun beep.lua ${uuid}
15'}sofia/gateway/my_gw/18005551212"/>
Then have beep.lua be something like this:
-- beep.lua
uuid = argv[1]
if ( uuid == nil ) then
freeswitch.consoleLog("WARNING","No uuid specified, exiting...\n")
return "exit"
end
interval = argv[2]
if ( interval == nil ) then
interval = 15
end
api = freeswitch.API()
dump = api:execute('uuid_dump',uuid);
test = string.sub(dump,1,4)
if ( test == '-ERR' ) then
freeswitch.consoleLog("INFO","UUID " .. uuid .. " not present, ending the
beeps\n")
else
-- grab the other leg's uuid
other_leg = api:execute('uuid_getvar',uuid .. ' bridge_to')
-- uuid_displace to both legs with muxing on so that parties can still
hear each other
-- set the v=-xx to an appropriate dB value for the volume you want
-- change the '40' to a higher number to make the beep duration longer
command = ' start tone_stream://v=-18;%(40,0,1000) mux'
api:execute('uuid_displace',uuid .. command)
api:execute('uuid_displace',other_leg .. command)
-- queue it up to run again in <interval> seconds
api:execute('sched_api',' +' .. interval .. ' none luarun beep.lua ' ..
uuid .. ' ' .. interval)
end
Remember, standard
disclaimer<http://wiki.freeswitch.org/wiki/Reporting_Bugs#Standard_Disclaimer>applies,
so tinker with it before you report back that it does not work. If
you get it working then it would be great if you could pay the wiki tax and
put it up there as an example of what can be done w/ sched_api and Lua.
-MC
On Mon, Oct 29, 2012 at 5:12 AM, Yuriy Nasida <nasida at live.ru> wrote:
> I can be wrong but most likely it is possible via event_socket only. So
> you have to listen events on FS from some script and when the call is
> bridged, the script must playback the beep to both legs.
>
> ------------------------------
> From: rstevens at robcoit.com
> Date: Mon, 29 Oct 2012 00:03:51 -0400
> To: freeswitch-users at lists.freeswitch.org
> Subject: [Freeswitch-users] Recording calls with a beep
>
>
> Hi All,
>
>
>
> I have been searching the wiki for a good way to insert a beep every 10
> seconds into a call that is being recorded (I plan on recording all calls
> to Comcast from here on out). This is my dialplan:
>
> <extension name="CallCentric.18002662278" >
> <condition field="destination_number" expression="18002662278" >
> <action application="set" data="sip_h_X-accountcode=${accountcode}"
> />
> <action application="set" data="sip_h_X-Tag=" />
> <action application="set" data="call_direction=outbound" />
> <action application="set" data="hangup_after_bridge=true" />
> <action application="set"
> data="effective_caller_id_name=${outbound_caller_id_name}" />
> <action application="set"
> data="effective_caller_id_number=${outbound_caller_id_number}" />
> <action application="set" data="inherit_codec=true" />
> <action application="set" data="RECORD_TITLE=Recording
> ${destination_number} ${caller_id_number} ${strftime(%Y-%m-%d %H:%M)}" />
> <action application="set" data="RECORD_COPYRIGHT=(c) 2012" />
> <action application="set" data="RECORD_ARTIST=FreeSwitch" />
> <action application="set" data="RECORD_COMMENT=FreeSwitch" />
> <action application="set" data="RECORD_DATE=${strftime(%Y-%m-%d
> %H:%M)}" />
> <action application="set" data="RECORD_STEREO=true" />
> <action application="displace_session"
> data="tone_stream://%(100,15000,800);loops=-1" />
> <action application="record_session"
> data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${destination_number}_${caller_id_number}.wav"
> />
> <action application="bridge" data="sofia/gateway/CallCentric/
> 18002662278" />
>
> </condition>
> </extension>
>
> I would also like to playback a tone so they know I'm recording them (for
> legal reasons). Per the wiki, the displace_session does indeed play back a
> tone every 15 seconds. But I'm afraid it never bridges the call.. It's
> probably something stupid, but what am I doing wrong here? I hear the
> intial beep after dialing the number but no early media with dead air on
> the line. What is the best way to insert a tone every x seconds while both
> legs of the call are in progress and so that each party hears the tone?
>
>
> Also, when testing this without tone_stream, the recording works (horaah)
> but the recording itself is really ssssssssllllooowwwwww. I am still
> working on that one, its probably in the wiki, i'm looking now, but if
> anyone has a suggestion let me know.
>
>
>
> Best regards,
>
> Robert Stevens
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services: consulting at freeswitch.org
> http://www.freeswitchsolutions.com FreeSWITCH-powered IP PBX: The CudaTel
> Communication Server Official FreeSWITCH Sites
> http://www.freeswitch.org http://wiki.freeswitch.org
> http://www.cluecon.com FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:
> http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
>
>
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
--
Michael S Collins
Twitter: @mercutioviz
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20121029/9ed4018c/attachment-0001.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list