Busy Call Retry
Click here to expand Table of Contents
All the text below was last edited in 2009, it is therefore likely out-of-date, inaccurate and in dire need of a refresh
console_log("notice", "*********** STARTING TO DIAL NUMBER! ***********\n");
//session.answer();
while (callTry()){};
function callTry(){
// Create new_session
new_session = new Session();
console_log("notice", "*********** DIALING NUMBER! ***********\n");
new_session.originate(session, "sofia/gateway/<gateway-name>/<number>");
console_log("notice", "*********** CAUSE: " + new_session.cause + " ***********\n");
if(new_session.cause == "USER_BUSY"){
console_log("notice", "*********** HANGING UP ***********\n");
//new_session.hangup();
console_log("notice", "*********** TRYING AGAIN ***********\n");
return true;
}
// wait for it ... answer
new_session.waitForAnswer(10000);
// IF everybody is ready, then bridge our current session & the new_session
if (new_session.ready()) {
bridge(session, new_session);
}
return false;
}
// log to the console
console_log("notice", "*********** CALL CONNECTED! ***********\n");
// hangup when done
new_session.hangup();
See Also: