Skip to content

Instantly share code, notes, and snippets.

@abhiyerra
Created February 3, 2009 04:56
Show Gist options
  • Save abhiyerra/57319 to your computer and use it in GitHub Desktop.
Save abhiyerra/57319 to your computer and use it in GitHub Desktop.
function speak(text) {
session.speak("flite", "kal", text);
}
function getNumber() {
speak("Enter the number then press pound");
number = '';
while((digit = session.getDigits(1, '', 20000)) != '#') {
session.flushDigits();
number += digit;
}
return number;
}
function handleCall() {
var number = getNumber();
var new_session;
console_log('notice', 'Using gafachi\n');
new_session = new Session("{origination_caller_id_name=" + session.caller_id_name + ",origination_caller_id_number=" + session.caller_id_number + "}sofia/gateway/sip.gafachi.com/" + number);
var isAnswered = new_session.waitForAnswer(10000);
if(isAnswered) {
bridge(session, new_session);
}
new_session.hangup();
}
session.answer();
session.setAutoHangup(true);
session.setHangupHook(function() { exit (); });
handleCall();
exit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment