TypeScript
Need help with node-esl?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.
englercj

Description

FreeSWITCH ESL implementation for Node.js; implements the full Event Socket Library specified in: http://wiki.freeswitch.org/wiki/Esl

134 Stars 77 Forks MIT License 256 Commits 9 Opened issues

Services available

Need anything else?

FreeSWITCH ESL Bindings for Node.js Build Status

A Library for handling low-level FreeSWITCH ESLconnections, and associated ESLevents.

API Documentation - API Events - Event Socket Library Spec

Purpose

This library was written to implement the full Event Socket Library interface, and provide a meaningful semantic when dealing with FreeSWITCH in Node.js.

This library supports both "Inbound" (connection going into FreeSWITCH) and "Outbound" (connections coming out of FreeSWITCH). Also included is a helper

Server
object that manages multiple
Connection
objects; making it trivial to have multiple "Outbound" connections from FreeSWITCH.

Installation

The easiest way to install is via npm:

npm install modesl

As in "Mod ESL".

Usage

The most basic usage example is to open a connection, and send a status command:

const esl = require('modesl');

const connectionOptions = { host: '127.0.0.1', port: 8021, }; const connection = esl.Connection.createInbound(connectionOptions, 'ClueCon', function () { connection.api('status', function (res) { console.log(res.getBody()); }); });

Something to be aware of is that all functions that interact with FreeSWITCH are asynchronous on the Library side. However, there are many functions (

api
,
execute
, etc) that are synchronous on the FreeSWITCH side. Because of this the event you will get back in your callback on, for example,
api
and the same command on
bgapi
will be different.

The

api
command's callback will be executed immediately when the
command/reply
message is received, with all the returned data. However, that same command using
bgapi
will not call the callback when the
command/reply
message is received, this is because FreeSWITCH returns the
command/reply
message immediately for background commands before the command is run. The Library will automatically track the command, and call the callback on the
BACKGROUND_JOB
message that denotes a completed Background Job.

The body for the same command issued with

api
and
bgapi
should be the same; even when the headers, event type, and time it takes for the callback to execute are different. The Library attempts to smooth these differences out by providing a common interface, even though behind the scenes things are quite different.

License

This module is distributed under the MIT License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.