Skip to content

Instantly share code, notes, and snippets.

/scenario.js Secret

Created July 25, 2017 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/618480748988dd67c9de56902cd059d6 to your computer and use it in GitHub Desktop.
Save anonymous/618480748988dd67c9de56902cd059d6 to your computer and use it in GitHub Desktop.
Net.httpRequest(url, function(e) { // запрашиваем свой бэкенд
if (e.code === 200) { // бэкенд случаем не лежит?
var resp = e.text ? JSON.parse(e.text) : {};
if (resp.numberToCall) { // получили номер телефона водителя
// Собственно, маскировка номера: звоним от лица колл центра
var out = VoxEngine.callPSTN(resp.numberToCall, ACCESS_NUMBER);
out.addEventListener(CallEvents.Connected, function() {
// Дозвонились до водителя: синтезируем что-нибудь,
// соединяем с клиентом и так далее
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment