Skip to content

Instantly share code, notes, and snippets.

View psanders's full-sized avatar

Pedro Sanders psanders

View GitHub Profile
@psanders
psanders / record-api-draft.md
Last active May 8, 2023 14:25
API Draft for record and dial

Recording feature

This option works well for channel recording only.

See next section for recording of entire conversation

Use cases:

  • Get user input
  • Better control for privacy purposes
@psanders
psanders / calls_with_notes.js
Created July 3, 2021 13:41
Call example with notes
// This will load the SDK and reuse your Fonos credentials
const Fonos = require("@fonos/sdk");
const callManager = new Fonos.CallManager();
// Few notes:
// 1. Update the from to look exactly as the Number you added
// 2. Use an active phone or mobile
// 3. Replace the webhook with the one from your Ngrok
callManager.call({
from: "9842753574",
@psanders
psanders / voice_server.js
Created July 3, 2021 13:33
Example of Voice Server
const { VoiceServer } = require("@fonos/voice");
const voiceServer = new VoiceServer();
voiceServer.listen((req, res) => {
console.log(req);
res.play("sound:hello-world");
});
@psanders
psanders / function.js
Created July 3, 2021 13:32
Cloud Function Example
const Fonos = require("@fonos/sdk");
const callManager = new Fonos.CallManager();
// 🚀 Let's get started
// Use fonos funcs:deploy to send to the cloud functions
module.exports = async(request, response) => {
await callManager.call({
from: "9842753589",
to: "17853178070",
webhook: "https://5a2d2ea5d84d.ngrok.io"
@psanders
psanders / call.js
Created July 3, 2021 13:31
Using the SDK to start a call
const Fonos = require("@fonos/sdk");
const callManager = new Fonos.CallManager();
callManager.call({
from: "9842753574",
to: "17853178070",
webhook: "https://5a2d2ea5d84d.ngrok.io"
})
.then(console.log)
.catch(console.error);

Docker Swarm with Macvlan, Consul and Autoscaling

TL;DR:

This will get you routable containers with IPs on your existing subnets, advertising to Consul. They will also be scalable and placed across a cluster of Swarm hosts. It's assumed that you are already running Consul, so if not, there are a ton of tutorials out there. It's also assumed you know how to install Docker and various Linux kernels.

Bonus: We add an autoscaling API called Orbiter (https://gianarb.it/blog/orbiter-the-swarm-autoscaler-moves).

I just want to run containers, like now, on my existing infrastructure and networks!

So you have an existing environment. You use Consul for service discovery. Life is good. Containers are now a thing and you want to work them in without having to worry about overlay networking or reverse proxies. You also don't want to add extra latency (as some naysayers could use it as fuel to kill your hopes and dreams). Lastly, you don't have a lot of time to invest in a complex orchestration tool, such a

@psanders
psanders / rexray-s3fs
Created December 15, 2020 01:59 — forked from cocoastorm/README.md
rexray/s3fs Docker Plugin Install with Minio
# Getting Started
Make sure Docker is installed!
Get your Minio endpoint url, accesskey, and secretkey ready!
## Install Docker Plugin
```bash
docker plugin install rexray/s3fs \
The following scenarios must work with verb dial
1. Agent's call is sent to ingress application. Call is transfer to another Agent ✔️
2. Agent's call is sent to ingress application. Call is then transfer to landline number via SP
The call gets transfer if the From header is setup correctly (using endpoint/from_domain: ...) but call setup is not
completed due to NAT issues
3. Call is received by ingress application and then transfer to softphone
// jvm-npm needs this variable
const System = Java.type('java.lang.System')
load('./node_modules/jvm-npm/src/main/javascript/jvm-npm.js')
require('./app.js')
...
public void jsLaunch() {
Context polyglot = Context
.newBuilder()
.allowExperimentalOptions(true)
.allowIO(true)
.allowAllAccess(true).build();
polyglot.eval("js", "const System = Java.type('java.lang.System');"