How to use drachtio-modesl - 2 common examples

To help you get started, we’ve selected a few drachtio-modesl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github davehorton / drachtio-fsmrf / lib / mediaserver.js View on Github external
server.listen(listenPort, listenAddress, () => {
      this.listenAddress = server.address().address;
      this.listenPort = server.address().port ;
      this._server = new esl.Server({server: server, myevents:false}, () => {
        this.emit('connect') ;

        // exec 'sofia status' on the freeswitch server to find out
        // configuration information, including the sip address and port the media server is listening on
        this._conn.api('sofia status', (res) => {
          const status = res.getBody() ;
          let re = new RegExp(`^\\s*${profile}\\s.*sip:mod_sofia@((?:[0-9]{1,3}\\.){3}[0-9]{1,3}:\\d+)`, "m");
          let results = re.exec(status) ;
          if (null === results) throw new Error(`No ${profile} sip profile found on the media server: ${status}`);
          if (results) {
            this.sip.ipv4.udp.address = results[1] ;
          }

          // see if we have a TLS endpoint (Note: it needs to come after the RTP one in the sofia status output)
          re = new RegExp(`^\\s*${profile}\\s.*sip:mod_sofia@((?:[0-9]{1,3}\\.){3}[0-9]{1,3}:\\d+).*\\(TLS\\)`, "m");
          results = re.exec(status) ;
github davehorton / drachtio-fsmrf / lib / mrf.js View on Github external
const __x = (callback) => {
      const listener = _onError.bind(this, callback) ;
      debug(`Mrf#connect - connecting to ${address}:${port}`);
      const conn = new esl.Connection(address, port, secret, () => {

        //...until we have initially connected and created a MediaServer object (which takes over error reporting)
        debug('initial connection made');
        conn.removeListener('error', listener) ;

        const ms = new MediaServer(conn, this, listenAddress, listenPort, profile) ;

        ms.once('ready', () => {
          debug('Mrf#connect - media server is ready for action!');
          callback(null, ms) ;
        }) ;
      });

      conn.on('error', listener);
      conn.on('esl::event::raw::text/rude-rejection', _onError.bind(this, callback, new Error('acl-error')));
    };

drachtio-modesl

FreeSWITCH ESL Node.js Implementation

MPL-2.0
Latest version published 2 years ago

Package Health Score

39 / 100
Full package analysis

Popular drachtio-modesl functions