Search code examples
freeswitch

Setting duration of a freeswitch call


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.


Solution

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