Have ideas to improve npm?Join in the discussion! »

    node-rayo

    0.0.2 • Public • Published

    node-rayo is a node client for the popular Rayo protocol

    Installation

    To install and use node-rayo, use npm:

    $ npm install node-rayo
    

    Dependencies

    node-rayo depends on the jab xmpp library which has some native dependencies for XML processing.

    Ubuntu/Debian

    sudo apt-get install libexpat1 libexpat1-dev libicu-dev -y
    

    Fedora/Red Hat

    sudo yum install expat expat-devel libicu libicu-devel -y
    

    Windows

    Download and install this file

    Mac OSX

    curl -O http://surfnet.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz
    tar xzvf expat-2.0.1.tar.gz
    cd expat-2.0.1
    ./configure
    make
    make check
    sudo make install
    cd ..
    source /etc/profile
    

    Usage

    Include node-rayo:

    var rayo = require('node-rayo');

    To get started, create a connection with rayo.Connection():

    conn = new rayo.Connection({
      host: 'prism.host.com',
      jabberId: 'youruser@jabber.org',
      jabberPass: 'pass',
      debug: false,
      ping: true   
    });

    You can then use conn.create() to create a Rayo command:

    dial = conn.create('dial', {
      to: 'sip:someuser@sip2sip.info',
      from: 'sip:rayo@test.net'
    });
     

    Once your command is created, you can listen to events specific to that command:

    dial.on('ringing', function(cmd) {
      return log.info("Call ringing...");
    });
    dial.on('answered', function(cmd) {
      return log.info("Call answered!");
    });

    And then send that command (note dial, component and mixer commands require command.listen(cmd.id); to wire up event handlers):

    return conn.send(dial, function(cmd) {
      return dial.listen(cmd.id);
    });

    Finally, connect!

    conn.connect();

    Examples

    You can view more complete examples in both CoffeeScript and JavaScript in the examples folder.

    Keywords

    none

    Install

    npm i node-rayo

    DownloadsWeekly Downloads

    1

    Version

    0.0.2

    License

    none

    Last publish

    Collaborators

    • avatar
    • avatar