I am trying to follow this guide: mod_dptools: displace_session - FreeSWITCH - Confluence
using a javascript file.
My call flow is an inbound call that is answered and then bridged to an external sip address. The goal is to have a short tone play repeatedly on both legs of the call so that both the caller and the callee know that the call is being recorded.
When I
session.execute("displace_session","tone_stream://v=-20;%(500,3000,1400);loops=-1 mr"); session.execute("bridge","sofia/external/user@example.com");
I hear it on one leg of the call.
When I swap the r for a w
session.execute("displace_session","tone_stream://v=-20;%(500,3000,1400);loops=-1 mw"); session.execute("bridge","sofia/external/user@example.com");
I heard it on the other leg of the call.
I have tried mwr, mrw and two separate command lines with an mr and mw, but no matter what I do, I can only hear the beep on one leg of the call. Any pointers on how to get it to play on both legs of the call?
Someone on the slack community pointed me in the right direction, leaving the answer here for future reference.
I found that when I offset the wait timing of each command it works, but if the wait timing is the same, it fails for the bridged line. Working code:
var cmd=session.getVariable("uuid") + " start tone_stream://v=-34;%(500,14500,1400);loops=-1 0 mux";
apiExecute("uuid_displace",cmd);
session.execute("displace_session","tone_stream://v=-34;%(500,15500,1400);loops=-1 mr");
If I change the 15500 to match the first 14500, it no longer works. Any idea why this might be?
you also don’t want to do loops=-1, thats forever, also its per leg, unless you displace with the final mux argument. You’d be better off doing a sched_api on uuid_displace with the mux option than trying to do so inline.
Hi Brian, thank you for the feedback.
I am trying to do a Recorder warning tone - Wikipedia, i.e play a beep every 15 seconds to both parties on the call so I do want it to loop until the call is terminated. I also want it on both legs, because when it was only on the callee leg, the caller did not get the beeps in their recording, so it could lead to some confusion as to whether the beeps actually played. Given that, are there any recommended changes you have for the above script?