npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sip-mrcp

v1.3.2

Published

A SIP/MRCP module that permits to write MRCPv2 client/server apps and tools

Downloads

60

Readme

sip-mrcp

A nodejs SIP/MRCP module that permits to implement MRCPv2 client/server apps.

installation

npm install sip-mrcp

Usage

const sip_mrcp = require('sip-mrcp')
const mrcp = require('mrcp')

const server = new sip_mrcp.SipMrcpStack({
    sip_options: { // see available options at https://github.com/kirm/sip.js/blob/master/doc/api.markdown
        address: '127.0.0.1',
        port: 8092,
        publicAddress: '127.0.0.1',
    },
    rtp_options: {
        local_ip: '127.0.0.1',
        local_ports: [10002],
    },
    mrcp_options: {
        local_port: '9002',
    },
    new_session_callback: new_session => { 
        // accept or refuse the session
        const answer_payload = {
            id: 0,
            codec_name: 'PCMU',
            clock_rate: 8000,
        }

        new_session.accept(answer_payload)

        // or
        // new_session.refuse(404, 'Not Found')

        // on a session you can wait for mrcp_msg and rtp_data:

        new_session.on('mrcp_msg', msg => { // do something }

        new_session.on('rtp_data', msg => { // do something }
    },
})

const client = new sip_mrcp.SipMrcpStack({
    sip_options: { // see available options at https://github.com/kirm/sip.js/blob/master/doc/api.markdown
        address: '127.0.0.1',
        port: 8091,
        publicAddress: '127.0.0.1',
    },
    rtp_options: {
        local_ip: '127.0.0.1',
        local_ports: [10000], // list of RTP ports to be used by the stack
    },
    mrcp_options:{
        local_port: '9001',
    }
})

const sip_uri = "sip:[email protected]:8092"
const resource_type = "speechsynth"

const pcmu = 0
const offer_payloads = [
    {
        id: 0,
        codec_name: 'PCMU',
        clock_rate: 8000,
    },
    {
        id: 8,
        codec_name: 'PCMA',
        clock_rate: 8000,
    }
]

client.create_session(sip_uri, resource_type, offer_payloads, (error, new_session) => {
    if(error) {
        console.error(error)
        process.exit(1)
    }

    console.info("new_session created")

    // once you have a session, you can send MRCP requests

    new_session.send_mrcp_msg(SOME_MRCP_MESSAGE)

    // and handle MRCP msgs and RTP data

    new_session.on('mrcp_msg', msg => { // do something }

    new_session.on('rtp_data', msg => { // do something }
})

See samples/server.js and samples/client.js.

They were written to interact with each other.

You can test by cloning the repo and doing:

npm install

Then start them on separate shells:

node samples/server.js
node samples/client.js