Skip to content

Instantly share code, notes, and snippets.

@toraritte
Created December 20, 2019 21:16
Show Gist options
  • Save toraritte/5808885a3b8a24d09a0767588623c06e to your computer and use it in GitHub Desktop.
Save toraritte/5808885a3b8a24d09a0767588623c06e to your computer and use it in GitHub Desktop.

Attila Gulyas 10:48 AM hi, if we'd like to have callers control audio playback during a call, we would use the relevant mod_commands (such as uuid_fileman perhaps?), bound to DTMF key strokes (like here: https://lists.freeswitch.org/pipermail/freeswitch-users/2013-January/091183.html ), right? For context: this is for a system for blind users to listen to articles recorded by volunteers.

Joshua Young 11:01 AM via the dialplan, dial *1 thru *3 on leg

<action application="bind_meta_app" data="1 b s playback::file1.wav"/>
<action application="bind_meta_app" data="2 b s playback::file1.wav"/>
<action application="bind_meta_app" data="3 b s playback::file1.wav"/>

via fs_cli, broadcast to a leg

uuid_broadcast <UUID> misc/sorry.wav aleg        (file plays on inbound leg)
uuid_broadcast <UUID> misc/sorry.wav bleg        (file plays on outbound leg)
uuid_broadcast <UUID> misc/sorry.wav both      (file plays on both legs)

perhaps those are what you're looking for...

Attila Gulyas 11:11 AM Thanks, but I was trying finding a way to control audio playback, such as doing fast-forward, rewind, pause etc. uuid_fileman seems to be the winner, but wanted to make sure that I am not missing something. Most of the resources I cited above are ca. 6 years old

Joshua Young 3 months ago i dont have much on uuid_fileman, but i did find a lua esl chunk from sometime ago how i bound * and # to fast-forward and reverse 2 seconds, and 0 to break...

local uuid = session:get_uuid();
api = freeswitch.API()
function func1()
    api:executeString("uuid_fileman " .. uuid .. " seek:-2000")
    session:destroy();
end
function func2()
    api:executeString("uuid_fileman " .. uuid .. " seek:+2000")
    session:destroy();
end
if argv[1] == "myarg1" then
    func1()
elseif argv[1] == "myarg2" then
    func2()
end
if session:ready() then
   session:answer()
   session:execute("sleep","1000")
   session:execute("bind_digit_action","myrealm,*,exec:lua,test.lua myarg1");
   session:execute("bind_digit_action","myrealm,#,exec:lua,test.lua myarg2");
   session:execute("bind_digit_action","myrealm,0,api:uuid_break," .. uuid);
   --session:execute("playback","/usr/local/freeswitch/sounds/joshebosh/Answering_Machine.wav")
   session:execute("playback","tone_stream://%(100,0,350);loops=-1");
end

hope it helps with your ESL endevour....

Attila Gulyas 3 months ago wow, thanks a lot! May I ask where you found this?

Joshua Young 3 months ago i created it sometime in the past couple years... it's not posted anywhere

Joshua Young 3 months ago do you use lua?

Attila Gulyas 3 months ago Yes, for now, so your snippet was very helpful, thanks again. The main web app is in Elixir, so I'm trying to figure out mod_erlang_event (and Elixir equivalents of mod_event_socket) which is going to be a fun (?) journey:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment