How to execute several actions in parallel during freeswitch call

Status
Not open for further replies.

verb

New Member
May 15, 2019
5
0
1
37
Hello everyone,
I try to create lua app which bridges two legs with video call and play background music when call is set.As i am new to freeswitch and fusionpbx not sure what is the right way to do this.Tried different setups via fusionpbx interfeis but with no success, tried also to write simple lua script you can find it bellow. Please any hint on how to set call between legs and execute any other action (play music or send http request) during the call, need to execute 2 or 3 actions in parallel .

Code:
api = freeswitch.API();
uuid = argv[1];
if uuid == nil then
  freeswitch.consoleLog("crit","Fatal Error:  A UUID was not passed to the script!\n");
else
  freeswitch.consoleLog("info","Working...\n");

  --Do the task here that may take some time...

  session = freeswitch.Session(uuid);
  freeswitch.consoleLog("info","HAVING uuid!: "..uuid.." \n");
end


session:execute("playback","/usr/share/freeswitch/sounds/en/us/callie/ivr/8000/ivr-please_enter_the_number_where_we_can_reach_you.wav")
session:execute("sleep", "6000")
digits = session:read(5, 15, "/opt/audio/beep.wav", 10000,"#");              

if ((digits == nil) or (digits == '')) then
   
    session:execute("playback","/opt/audio/waiting.wav")
end

edit:
Dont know if it's clear enough but i want to:
1.create video call between two extensions
2.play background music during the call
I manage to do this but background audio has a lot of distortion, not sure why.
 
Last edited:
Status
Not open for further replies.