This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const call = number => { | |
| return (dispatch, getState) => { | |
| const state = getState(); | |
| const call = state.vox.call(number, false, JSON.stringify({ | |
| from: state.id, | |
| to: number, | |
| })); | |
| const Events = VoxImplant.Events; | |
| console.log("subscribing events..."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Куда подключаться к Zoom | |
| var regions = { | |
| "US_West": "162.255.37.11", | |
| "US_East": "162.255.36.11", | |
| "China": "221.122.88.195", | |
| "India": "115.114.131.7", | |
| "EMEA": "213.19.144.110" | |
| }; | |
| // Будет выполнено в облаке по любому входящемму звонку: телефон, WebSDK итд |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function handleCallOut(num) { | |
| var pstn = VoxEngine.callPSTN(num); | |
| pstn.addEventListener(CallEvents.Connected, function (e) { | |
| pstnCalls.push(e.call); // запоминаем для отключения | |
| VoxEngine.sendMediaBetween(pstn, conference); // микшируем всех со всеми | |
| }); | |
| pstn.addEventListener(CallEvents.Disconnected, function (e) { | |
| if (pstnCalls.indexOf(e.call) > -1) pstnCalls.splice(pstnCalls.indexOf(e.call), 1); | |
| }); | |
| pstn.addEventListener(CallEvents.Failed, function (e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // К запущенной JS сессии можно делать HTTP запросы | |
| VoxEngine.addEventListener(AppEvents.HttpRequest, function (e) { | |
| var path = e.path.split("/"); | |
| // HTTP запрос содержит ".../CallOut/<номер>"? | |
| if (path[path.length - 2] == "CallOut") { | |
| num = path[path.length - 1]; | |
| // Звоним и добавляем звонок в конференцию | |
| handleCallOut(num); | |
| // Будет возвращено как результат обработки HTTP запроса | |
| return '{"result":"callingto:' + num + '"}'; |