This file contains 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
require(Modules.AI) | |
var dialogflow, call | |
// Inbound call processing | |
VoxEngine.addEventListener(AppEvents.CallAlerting, (e) => { | |
call = e.call | |
call.addEventListener(CallEvents.Connected, onCallConnected) | |
call.addEventListener(CallEvents.Disconnected, VoxEngine.terminate) | |
call.answer() |
This file contains 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
require(Modules.ASR); | |
let mycall = null; | |
VoxEngine.addEventListener(AppEvents.CallAlerting, (e) => { | |
mycall = e.call; | |
mycall.addEventListener(CallEvents.Connected, handleCallConnected); | |
mycall.answer(); | |
}); |
This file contains 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
{"coord": | |
{ | |
"lon":120.99, | |
"lat":15.79 | |
}, | |
"weather":[ | |
{ | |
"id":802, | |
"main":"Clouds", | |
"description":"scattered clouds", |
This file contains 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
const sessionId = () => Math.floor(100000 * Math.random()); | |
Net.httpRequest("https://api.dialogflow.com/v1/query?v=20170712&contexts=weather&query=" | |
+ encodeURI(userSpeech) | |
+ "&lang=en&sessionId=" | |
+ sessionId() | |
+ "&timezone=Europe/Moscow", (e) => { | |
// here we receive the JSON and continue our scenario execution | |
}, | |
{ headers: ["Authorization: bearer 1799227ce77f446fa8d64749f70527ca"]}); |
This file contains 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
{ | |
"id": "5111e0da-5970-4a11-a458-28830f59bc73", | |
"timestamp": "2018-02-28T19:26:27.43Z", | |
"lang": "en", | |
"result": { | |
"source": "agent", | |
"resolvedQuery": "What is the weather in San Francisco?", | |
"action": "weather", | |
"actionIncomplete": false, | |
"parameters": { |
This file contains 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
curl ‘https://api.dialogflow.com/v1/query?v=20170712&query=What%20is%20the%20weather%20in%20San%20Francisco%3F&lang=en&sessionId=93882e69-fdeb-417d-9f73-7347c8e57a2f&timezone=Europe/Moscow' -H ‘Authorization:Bearer 1799227ce77f446fa8d64749f70527ca’ |
This file contains 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
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" | |
}; | |
VoxEngine.addEventListener(AppEvents.CallAlerting, function (e) { | |
/** |
This file contains 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
call.record({ transcribe: true, language: ASRLanguage.ENGLISH_US, format: “json” }) |
This file contains 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
call.record({ transcribe: true, language: ASRLanguage.ENGLISH_US }) |
This file contains 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
/** | |
* Make PSTN call-out | |
*/ | |
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) { |
NewerOlder