Skip to content

Instantly share code, notes, and snippets.

View WhiteyDude's full-sized avatar

Whitey WhiteyDude

  • Australia
View GitHub Profile
View drachtio-rtpengine-playback-server.js
const Srf = require('drachtio-srf');
const srf = new Srf();
const rtpengineClient = require('rtpengine-client').Client;
const { v4: uuid } = require('uuid');
const sdpTransform = require('sdp-transform');
const config = {
'drachtio': {
"host": "drachtio",
"port": 9022,
@WhiteyDude
WhiteyDude / gist:e34cb593159be07b09f8f11e7ff1a33f
Last active July 21, 2023 22:10
Anatomy of a UAC <-> UAS with media
View gist:e34cb593159be07b09f8f11e7ff1a33f
User Agent A | UAS server | rtpengine
INVITE (offer) |
-------------|-------> |
| ng offer
| ---------|----->
| ng answer
| <--------|------
200 (answer) |
<-------|--------- |
@WhiteyDude
WhiteyDude / gist:50d548f36aa4e04fa06085a133b7ab26
Last active July 21, 2023 22:08
Anatomy of a B2BUA with a media server (rtpengine) proxy
View gist:50d548f36aa4e04fa06085a133b7ab26
User Agent A | B2BUA server | rtpengine | User Agent B
INVITE (offer) | |
-------------|-------> | |
| ng offer |
| ---------|-----> |
| ng rewritten offer|
| <--------|------ |
| INVITE (rewritten offer)
| ---------|-----------|----->
| 200 (answer) |
@WhiteyDude
WhiteyDude / gist:a0bb315fef6c9fa76268fe41ee634b1b
Created June 11, 2023 15:32
Langchain example for oobabooga API
View gist:a0bb315fef6c9fa76268fe41ee634b1b
process.env.OPENAI_API_BASE = 'http://127.0.0.1:5001/v1';
const { OpenAI } = require("langchain/llms/openai");
const model = new OpenAI(
{
openAIApiKey: 'sk-dummy',
temperature: 0.9,
},
{
basePath: process.env.OPENAI_API_BASE
});
@WhiteyDude
WhiteyDude / appspec.yml
Last active July 25, 2020 13:34
CodeDeploy ruby 2.5+ non empty directories fix
View appspec.yml
files:
- source: files/codedeploy_install_instruction.patch
destination: /tmp
hooks:
AfterInstall:
- location: scripts/patch_codedeploy_and_restart.sh
timeout: 300
runas: root
View drachtio-bridge-test.js
const Srf = require('drachtio-srf');
const Mrf = require('drachtio-fsmrf');
const config = require('config');
const srf = new Srf() ;
const mrf = new Mrf(srf) ;
// Connect to drachtio server using SRF - sync
srf.connect(config.get('drachtio'), (err, srf) => {
if (err) return log_to_console(false, `error connecting to drachtio: ${err}`);
});
View sample.js
const calls = require('./calls');
srf.invite(async(req, res) => {
const ms = req.app.locals.ms;
const to_number = calls.convertToE164(req.calledNumber);
let ep, dlg;
try {
const {endpoint, dialog} = await ms.connectCaller(req, res);
ep = endpoint;
dlg = dialog;
View app.js
calls = require('./calls')
srf.invite((req, res) => {
return res.send(500);
const ms = req.app.locals.ms;
ms.connectCaller(req, res, next)
.then(({endpoint, dialog}) => {
console.log("Never get here")
});
}); // End ms.ConnectCaller
View app.js
calls = require('./calls')
srf.invite((req, res) => {
const ms = req.app.locals.ms;
ms.connectCaller(req, res, next)
.then(({endpoint, dialog}) => {
setHandlers(req, res, dialog, endpoint)
to = calls.parseURI(req.msg.headers.to);
to_number = calls.convertToE164(to.user)
View update-all-the-things.yml
---
- hosts: all
become: true
become_user: "root"
become_method: sudo
tasks:
- name: Enable epel
shell:
cmd: '/usr/bin/amazon-linux-extras enable epel'
- name: Install epel