0

I'm a bit new on freeswitch but I'd like to call a number, play a sound and hang up after a certain amount of time. It could be that the call lasts longer or shorter then the sound file.

I was hoping to do it with Javascript and I got as far as

session.waitForAnswer(10000);


if (session.ready()) {
    session.streamFile('/path-to-sound.wav');
    session.hangup();
}

Is there a way I can set an auto hangup time through javascript becuase I can keep the call open by looping a sound file of silence.

I'm using javascript because I want to keep the sound file and duration as variables.

Tomcomm
  • 233
  • 2
  • 6
  • 16

2 Answers2

1

with "sched_api" call, you can schedule an execution of "hangup" call. Is that what you want?

Stanislav Sinyagin
  • 1,973
  • 10
  • 10
  • Maybe but I'm struggling to see how I'd implement it – Tomcomm Oct 18 '12 at 09:45
  • I've done it var calllength = "3"; session.execute("sched_hangup","+"+calllength+" alloted_timeout"); if (session.ready()) { session.streamFile('/root/piano2.wav'); } – Tomcomm Oct 18 '12 at 10:05
1

You have an example of inplementation below.

  <action application="set" data="execute_on_answer=sched_hangup+60alloted_timeout" /> 
  <action application="bridge" data="sofia/external/1234567@10.10.10.10"/>

From:

http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_sched_hangup

olivecoder
  • 2,858
  • 23
  • 22