Skip to content

Instantly share code, notes, and snippets.

@davehorton
davehorton / gist:040f2b4eceb782e92ea2
Last active August 29, 2015 14:17
response object provided in drachtio req#proxy callback when 'wantsFullResponse' is set on the proxy request
{
"connected": false, //final result -- was the call connected or not?
"responses": [ //all responses received from all destinations
{
"address": "192.168.100.129",
"port": 49579,
"msgs": [{
"time": "18:04:50.978089",
"status": 404,
"msg": {
@davehorton
davehorton / gist:24aa26518bd5e079863e
Created March 23, 2015 23:22
npm-debug.log when publish fails with 409
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'publish' ]
2 info using npm@2.2.0
3 info using node@v1.0.3
4 verbose node symlink /usr/local/bin/node
5 verbose publish [ '.' ]
6 silly cache add args [ '.', null ]
7 verbose cache add spec .
8 silly cache add parsed spec { raw: '.',
8 silly cache add scope: null,
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'publish' ]
2 info using npm@2.2.0
3 info using node@v1.0.3
4 verbose node symlink /usr/local/bin/node
5 verbose publish [ '.' ]
6 silly cache add args [ '.', null ]
7 verbose cache add spec .
8 silly cache add parsed spec { raw: '.',
8 silly cache add scope: null,
@davehorton
davehorton / output
Created June 27, 2012 05:09
add-in module with wrapped C++ class
new-host-5:sipua dhorton$ node test.js
27 Jun 01:09:42 - [object SipUserAgent]
{}
sip port is: undefined
@davehorton
davehorton / gist:817eea5167e17a6bf868f755145120dd
Created July 15, 2018 13:59
Some notes on drachtio server control protocol
The drachtio server is controlled by one or more drachtio-srf applications over a tcp connection. This gist provides some
notes on the messaging protocol, in case anyone wants to take a **shot**
@davehorton
davehorton / gist:87b050bcdec6913584f204c0ed4ada12
Created August 6, 2018 12:45
error scenario with ipv6 / ipv4
2018-08-06 11:17:43.410747 SipProxyController::doSendRequestOutsideDialog attempting to determine transport tport for request-uri sip:guiprat@sip.linphone.org proto: udp
2018-08-06 11:17:43.410761 SipTransport::findAppropriateTransport: searching for a transport to reach udp/sip:guiprat@sip.linphone.org
2018-08-06 11:17:43.410800 SipTransport::findAppropriateTransport: host parsed as sip.linphone.org
2018-08-06 11:17:43.410811 SipTransport::findAppropriateTransport - after filtering for transport we have 6 candidates
2018-08-06 11:17:43.410817 SipTransport::findAppropriateTransport - after filtering for protocol we have 3 candidates
2018-08-06 11:17:43.410865 SipTransport::findAppropriateTransport: - returning the best match 0x24c2f10: udp/10.196.160.34:5060
2018-08-06 11:17:43.410875 SipTransport::getContactUri - created Contact header: sip:10.196.160.34:5060
2018-08-06 11:17:43.410882 SipProxyController::doSendRequestOutsideDialog selected transport 0x24c2f10
2018-08-06 11:17:43.410905 makeTags - Adding wel
@davehorton
davehorton / gist:5136b200d8eb3c514698d5300b87aa76
Created September 3, 2018 14:40
callback with LWS_CALLBACK_PROTOCOL_INIT never invoked ?
#include <libwebsockets.h>
#include <string.h>
#include <signal.h>
#include <inttypes.h>
#include "read_wav.h"
#define LWS_PLUGIN_STATIC
struct vhd_asapp {
struct lws_context *context;
@davehorton
davehorton / gist:e0df812242c816c92f6f13013234dde0
Created January 15, 2019 19:21
lws log - fake wsi = 0x7fffef014570, wsi for connection = 0x911a40
2019-01-15 12:37:53.268753 [DEBUG] lws_glue.cpp:26 addPendingConnect - after adding there are now 1 pending
2019-01-15 12:37:53.268753 [INFO] lws_glue.cpp:239 lws_cancel_service
2019-01-15 12:37:53.268753 [DEBUG] lws_glue.cpp:92 lws_callback wsi: 0x7fffef014570, vhost: default
2019-01-15 12:37:53.268753 [DEBUG] lws_glue.cpp:106 lws_callback LWS_CALLBACK_EVENT_WAIT_CANCELLED wsi: 0x7fffef014570, vhost
2019-01-15 12:37:53.268753 [INFO] lws_glue.cpp:239 lws_vhost_bind_wsi: vh default: count_bound_wsi 1
2019-01-15 12:37:53.268753 [DEBUG] lws_glue.cpp:239 lws_role_transition: 0x911a40: wsistate 0x10000200, ops h1
2019-01-15 12:37:53.268753 [INFO] lws_glue.cpp:239 lws_client_connect_via_info: protocol binding to audiostream.drachtio.org
2019-01-15 12:37:53.268753 [DEBUG] lws_glue.cpp:92 lws_callback wsi: 0x911a40, vhost: default
2019-01-15 12:37:53.268753 [DEBUG] lws_glue.cpp:211 lws_callback unhandled reason: 85 wsi: 0x911a40
2019-01-15 12:37:53.268753 [INFO] lws_glue.cpp:239 lws_header_table_attach: wsi 0x911a40:
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;
const Srf = require('drachtio-srf');
const srf = new Srf();
const SipError = Srf.SipError;
srf.invite((req, res) => {
console.log(`Received an Invite from ${req.source_address}:${req.source_port}`);
if (req.body.includes('Conferencing Control Leg')) {
handleControlLegInvite(req, res);
}
else {