0.1.0 • Published 2 years ago

drachtio-fn-fsmrf-sugar v0.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
2 years ago

drachtio-fn-fsmrf-sugar

Utility functions for drachtio-fsmrf

LoadBalancer

Class that allows you to select the least-loaded media server

const Srf = require('drachtio-srf');
const srf = new Srf();
const {LoadBalancer} = require('drachtio-fn-fsmrf-sugar');
const lb = new LoadBalancer();
/*
  servers = [
  {
    address: '10.100.0.1', 
    port: 8021, 
    secret: 'ClueCon'
  },
  {
    address: '10.100.0.2', 
    port: 8021, 
    secret: 'ClueCon'
  }]
*/
// call this once to connect to the array of media servers
lb.start({servers, srf});

// then call this to get an array of available media server, with least loaded first
const mediaservers = lb.getLeastLoaded();
// mediaservers[0] is the least loaded

Methods are also provided to retrieve a specific media server by either its sip signaling IP address or the IP address that its event socket has bound to:

const ms = getMsBySipAddress(addr);
// or
const ms = getMsByEslAddress(addr);

The LoadBalancer emits a 'connect' event when at least one freeswitch is successfully connected.

0.1.0

2 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago