Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including drachtio-mw-auth-parser with all npm packages installed. Try it out:

var drachtioMwAuthParser = require("drachtio-mw-auth-parser")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

drachtio-mw-auth-parser v0.1.0

drachtio middleware for parsing SIP Authorization header

drachtio-mw-auth-parser Build Status NPM version

drachtio middleware for parsing SIP Authorization header, supporting Digest and Basic authorization

Usage

const Srf = require('drachtio-srf');
const srf = new Srf();
const authParser = require('drachtio-mw-auth-parser') ;

srf.connect({...}) ;

srf.use(authParser) ;

srf.register(( req, res ) => {
  console.log(req.authorization) ;
  /*
    Digest: username="103482",realm="sip.drachtio.org",nonce="df24fd41-4fc5-416f-b163-90f774ca0358" \
      uri="sip:73.15.46.10:6060",algorithm=MD5,response="a4881ad854cc0677158206ac9fa90e3b", \
      qop=auth,nc=00000032,cnonce="ea5cec20"

    console.log =>
    {
      scheme: 'digest',
      username: '103482',
      realm: 'sip.drachtio.org',
      nonce: 'df24fd41-4fc5-416f-b163-90f774ca0358',
      uri: 'sip:72.1.46.10:6060',
      algorithm: 'MD5',
      response: 'a4881ad854cc0677158206ac9fa90e3b',
      qop: 'auth',
      nc: '00000032',
      cnonce: 'ea5cec20'
    }
   */
}) ;
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free