[Freeswitch-users] Freeswitch streamFile when the user answers

Alexandru Nedelcu alex at sinapticode.ro
Fri Dec 12 03:38:47 PST 2008


Hi,

I'm working on a simple dialer, and I have the following problem: the
audio file starts playing before the user answeres the phone (while it's
ringing). It only works when I introduce a delay, but that doesn't seem
right.

For instance in the asterisk context referred in the call files, I had:

exten => s,4,Answer
exten => s,n,Wait(2)
exten => s,n,Background(${SOUNDFILE})
And indeed it played a soundfile 2 seconds after the called person
picked up the phone

In FS I currently initiate calls like this:

session.waitForAnswer(10000);

if (session.ready()) {
    session.sleep(2000);
    session.streamFile(/*...*/);
}

Is this right?





More information about the FreeSWITCH-users mailing list