Connect to Endpoints

The code snippet below dials in using PSTN and hangs up after 60 seconds.

const {
sdk
} = require('symbl-node');
sdk.init({
appId: 'yourAppId',
appSecret: 'yourAppSecret',
basePath: 'https://api.symbl.ai'
}).then(() => {
sdk.startEndpoint({
endpoint: {
type: 'pstn', // This can be pstn or sip
phoneNumber: '<number_to_call>', // include country code
dtmf: '<meeting_id>' // if password protected, use "dtmf": "<meeting_id>#,#<password>#"
}
}).then(connection => {
console.log('Successfully connected.', connection.connectionId);
// Scheduling stop endpoint call after 60 seconds for demonstration purposes
// In real adoption, sdk.stopEndpoint() should be called when the meeting or call actually ends
setTimeout(() => {
sdk.stopEndpoint({
connectionId: connection.connectionId
}).then(() => {
console.log('Stopped the connection');
console.log('Summary Info:', connection.summaryInfo);
console.log('Conversation ID:', connection.conversationId);
}).catch(err => console.error('Error while stopping the connection', err));
}, 60000);
}).catch(err => console.error('Error while starting the connection', err));
}).catch(err => console.error('Error in SDK initialization.', err));

We recommend using SIP whenever possible instead of PSTN as it provides higher audio quality options as compared to PSTN. SIP endpoint provides an optional audio configuration as well. Contact us for your specific requirements.

This SDK supports dialing through a simple phone number - PSTN or a Voice Over IP system - SIP endpoint. If you don't have your own voice over IP system, you will want to use a phone number to make the connection.

PSTN (Public Switched Telephone Networks)#

The Publicly Switched Telephone Network (PSTN) is the network that carries your calls when you dial in from a landline or cell phone. It refers to the worldwide network of voice-carrying telephone infrastructure, including privately-owned and government-owned infrastructure.

endpoint: {
type: 'pstn',
phoneNumber: '14083380682', // Phone number to dial in
dtmf: '6155774313#' // Joining code
}

SIP (Session Initiation Protocol)#

Session Initiation Protocol (SIP) is a standardized communications protocol that has been widely adopted for managing multimedia communication sessions for voice and video calls. SIP may be used to establish connectivity between your communications infrastructures and Symbl's communications platform.

endpoint: {
type: 'sip',
uri: 'sip:555@your_sip_domain', // SIP URI to dial in
audioConfig: { // Optionally any audio configuration
sampleRate: 16000,
encoding: 'PCMU',
sampleSize: '16'
}
}