npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

drachtio-modesl

v1.2.9

Published

FreeSWITCH ESL Node.js Implementation

Downloads

671

Readme

FreeSWITCH ESL Bindings for Node.js Build Status

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

Documentation - Event Socket Library Spec

Purpose

Though there is already a Node.js "library" for this on github, it does not actually implement the Event Socket Library interface, and instead has it's own thing. 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 esl.Server object that manages multiple esl.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:

var esl = require('modesl'),
conn = new esl.Connection('127.0.0.1', 8021, 'ClueCon', function() {
    conn.api('status', function(res) {
        //res is an esl.Event instance
        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.

Tests

To run the tests included with the module simply run the following in the root of the modesl folder:

npm test

TODO

  • Add tests for
  • esl.Connection
  • Add more examples for
  • IVR App
  • Faxing App
  • Add more abstraction/sugar functions
  • Better error messages on error event

License

This module is distributed under the Mozilla Public License 2.0.