Session waitForAnswer
From FreeSWITCH Wiki
waitForAnswer blocks (waits) until the channel is in a fully answered state. It can be useful for example after an originate to wait for a full answer instead of just early media. It takes an optional parameter which is the amount of time to delay before returning. It returns true if the channel is answered and false if not, i.e. when timed out.
[edit]
Synopsis
waitForAnswer(timeout)
- timeout - the duration in milliseconds to wait
- returns true when the call is answered and false when timed out
[edit]
Example
new_session = new Session();
new_session.setCallerData("caller_id_name", "fred");
new_session.setCallerData("caller_id_number", "2121231234");
new_session.originate(session, "sofia/default/1235@conference.freeswitch.org", 15);
var isAnswered = new_session.waitForAnswer(10000);
// its been 10 seconds (isAnswered == false) or a real answer at this point (isAnswered == true)
[edit]
