Coder Social home page Coder Social logo

bigbluebutton / node-esl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from englercj/node-esl

2.0 8.0 5.0 386 KB

FreeSWITCH ESL implementation for Node.js; implements the full Event Socket Library specified in:

Home Page: http://englercj.github.com/node-esl/

License: Mozilla Public License 2.0

JavaScript 94.36% CSS 5.64%

node-esl's Introduction

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.

node-esl's People

Contributors

abelharisov avatar alexmarlo avatar cxreg avatar englercj avatar lxfontes avatar ritzalam avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.