Skip to content

Instantly share code, notes, and snippets.

View luddilo's full-sized avatar

Ludvig Linse luddilo

View GitHub Profile
@luddilo
luddilo / distributed-mediasoup.js
Created August 30, 2021 13:42 — forked from gurupras/distributed-mediasoup.js
mediasoup horizontal scaling
onServerStartup () {
const { serverId, ip } = getServerInfo() // serverId does not change across restarts
this.serverId = serverId
// We don't have any routers or producers (yet). Clear any value that exists in the DB related to our serverId
clearSharedDB(serverId, 'routers')
clearSharedDB(serverId, 'producers')
// Update the DB with our serverId and ip so that others will know how to reach us
registerServerInDB(serverId, ip)
// This will have to be hosted by you elsewhere, maybe as a cloud function..!
const checkIfSessionHasARecentFlightBooking = (sessionId) => {
// ...
}
export const checkStatus = (req, res) => {
const { sessionId } = req.body
return res.json({
set: {
@luddilo
luddilo / scenario.js
Last active May 19, 2020 13:59
A voximplant "scenario" supporting both Incomign and Outgoing calls with a Dialogflow agent built with Narratory
require(Modules.AI)
var debug = true
// Agent settings
var agentId = YOUR_DIALOGFLOW_AGENT_ID_IN_VOXIMPLANT // Should be a number, for example 2600. Check the Dialogflow Connector menu in Voximplant
var CALLER_ID = "YOUR_REAL_VOXIMPLANT_PHONE_NUMBER" // Cannot be a virtual number. Format should be for example 46701231212 for +46701231212
var lang = DialogflowLanguage.SWEDISH
// Other variables
@luddilo
luddilo / gist:615ce3efe8e58699233ef66717f07766
Last active October 22, 2018 12:13
Share behavior between response handlers and wizard buttons
val IT_HAPPENED = "ItHappened"
onButton("Make it happen") {
raise(IT_HAPPENED)
}
onResponse<ItHappenedIntent> {
raise(IT_HAPPENED)
}