Skip to content

Instantly share code, notes, and snippets.

/**
* How to cancel an outbound call
*
* Note: example below illustrates using srf.createUAC, but the same logic and callback is available
* for srf.createB2BUA
*
* For another example, see https://drachtio.org/api#srf-create-uac and the last example there
*/
let dlg, reqSent, timer;
@davehorton
davehorton / gist:31444a5aac69dc7f265473a0fee27d7e
Created August 24, 2019 15:06
handling hangup on A when outdialing B and creating uas/uac dialogs indepently
const SipError = require('drachtio-srf').SipError;
srf.invite(async(req, res) => {
let uas, uac, ep;
try {
let invite; // will be used to track invite we send on B leg
// connect A leg
const {endpoint, dialog} = await ms.connectCaller(req, res);
@davehorton
davehorton / gist:94f8301594fc67e7efa04388534c75a7
Created August 24, 2019 15:06
handling hangup on A when outdialing B and creating uas/uac dialogs indepently
const SipError = require('drachtio-srf').SipError;
srf.invite(async(req, res) => {
let uas, uac, ep;
try {
let invite; // will be used to track invite we send on B leg
// connect A leg
const {endpoint, dialog} = await ms.connectCaller(req, res);
version: '3'
services:
drachtio:
image: drachtio/drachtio-server:0.8.3
network_mode: host
command: drachtio --contact "sip:*;transport=udp" --loglevel info
freeswitch:
image: drachtio/drachtio-freeswitch-mrf:latest
@davehorton
davehorton / rtpengine.log
Last active November 6, 2019 16:32
rtpengine commands -- trying to transcoding RFC 2833 => PCMU with audio tones and back again
[1573055112.558183] INFO: [604876896_63863282@23.29.25.54]: Received command 'offer' from 10.11.3.48:45637
[1573055112.558298] DEBUG: [604876896_63863282@23.29.25.54]: Dump for 'offer' from 10.11.3.48:45637: { "ICE": "remove", "call-id": "604876896_63863282@23.29.25.54", "codec": { "offer": [ "PCMU" ], "strip": [ "all" ] }, "command": "offer", "flags": [ "asymmetric", "always transcode" ], "from-tag": "gK0d45e2f1", "sdp": "v=0^M
o=- 26743 31458 IN IP4 23.29.25.59^M
s=-^M
c=IN IP4 23.29.25.59^M
t=0 0^M
m=audio 24768 RTP/AVP 0 18 101^M
a=rtpmap:18 G729/8000^M
a=fmtp:18 annexb=no^M
a=rtpmap:101 telephone-event/8000^M
@davehorton
davehorton / freeswitch.yaml
Created December 24, 2019 16:20
ansible playbook for building freeswitch 1.10.1 with support for davehorton open source modules
---
- hosts: all
become: yes
vars_prompt:
- name: "build_with_grpc"
prompt: "Include the grpc modules (mod_google_transcribe, mod_google_tts, mod_dialogflow)?"
private: no
default: false
- name: "cloud_provider"
prompt: "CLoud provider: aws, gcp, azure, digital_ocean"
EXECUTE [depth=1] sofia/drachtio_mrf/nobody@18.232.68.47:5060 playback(/tmp/d8129e06-2fe6-11ea-8da6-81dfb84be858_23.opus)
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:273 [OGG/OPUS File] Opening File [/tmp/d8129e06-2fe6-11ea-8da6-81dfb84be858_23.opus] 48000hz
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:282 [OGG/OPUS File] Channels: 1
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:284 [OGG/OPUS File] Original sampling rate: 24000 Hz
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:294 [OGG/OPUS File] Duration (samples): 235682
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:296 [OGG/OPUS File] Size (bytes): 20131
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:299 [OGG/OPUS File] Encoded by: Google Speech using libopus
2020-01-05 18:12:05.135608 [DEBUG] switch_core_file.c:391 File /tmp/d8129e06-2fe6-11ea-8da6-81dfb84be858_23.opus sample rate 48000 doesn't match requested rate 8000
2020-01-05 18:12:05.135608 [DEBUG] switch_ivr_play_say.c:1492 Codec Activated L16@8000hz 1 channels 20ms
2020-01-05 18
EXECUTE [depth=1] sofia/drachtio_mrf/nobody@18.232.68.47:5060 playback(/tmp/d8129e06-2fe6-11ea-8da6-81dfb84be858_23.opus)
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:273 [OGG/OPUS File] Opening File [/tmp/d8129e06-2fe6-11ea-8da6-81dfb84be858_23.opus] 48000hz
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:282 [OGG/OPUS File] Channels: 1
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:284 [OGG/OPUS File] Original sampling rate: 24000 Hz
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:294 [OGG/OPUS File] Duration (samples): 235682
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:296 [OGG/OPUS File] Size (bytes): 20131
2020-01-05 18:12:05.135608 [INFO] mod_opusfile.c:299 [OGG/OPUS File] Encoded by: Google Speech using libopus
2020-01-05 18:12:05.135608 [DEBUG] switch_core_file.c:391 File /tmp/d8129e06-2fe6-11ea-8da6-81dfb84be858_23.opus sample rate 48000 doesn't match requested rate 8000
2020-01-05 18:12:05.135608 [DEBUG] switch_ivr_play_say.c:1492 Codec Activated L16@8000hz 1 channels 20ms
2020-01-05 18
@davehorton
davehorton / ms-teams-outbound-hold-resume.txt
Created May 22, 2020 11:54
ms teams: outbound call that is placed on hold and then resumed
*** outbound invite to teams
2020-05-22 11:29:25.042912 send 1865 bytes to tls/[52.114.75.24]:5061 at 11:29:25.042466:
INVITE sip:+441273652002@sip.pstnhub.microsoft.com SIP/2.0
Via: SIP/2.0/TLS 15.216.66.78;branch=z9hG4bKFNF21X863SFHF
Max-Forwards: 70
From: <sip:+15085710838@tenant1.customers.adatum.biz>;tag=5t2N1mNy55ZKr
To: <sip:+441273652002@tenant1.customers.adatum.biz>
Call-ID: 54c3fce3-16c2-1239-ae93-061513c9979a
CSeq: 20519690 INVITE
@davehorton
davehorton / ms-teams-options-pings.txt
Created May 22, 2020 12:00
ms teams: sending and receiving OPTIONS pings
*** sending OPTIONS pings
2020-05-22 11:55:36.391560 send 382 bytes to tls/[52.114.75.24]:5061 at 11:55:36.391362:
OPTIONS sip:sip.pstnhub.microsoft.com SIP/2.0
Via: SIP/2.0/TLS 15.216.66.78;branch=z9hG4bKFraec3SSeHamQ
Max-Forwards: 70
From: <sip:customers.adatum.biz:5061;transport=tls>;tag=gcQ8FQ9gQZHSD
To: <sip:sip.pstnhub.microsoft.com>
Call-ID: fd5c93eb-16c5-1239-ae93-061513c9979a
CSeq: 20520476 OPTIONS