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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gibme/asterisk-manager-interface

v22.0.0

Published

Asterisk Manager Interface

Readme

Asterisk Manager Interface

NPM License: MIT

A TypeScript client library for the Asterisk Manager Interface (AMI) with automatic reconnection, keep-alive support, and typed responses for common AMI actions.

Requirements

  • Node.js >= 22

Installation

yarn add @gibme/asterisk-manager-interface
# or
npm install @gibme/asterisk-manager-interface

Documentation

Full API documentation is available at https://gibme-npm.github.io/asterisk-manager-interface/

Quick Start

import AMI from '@gibme/asterisk-manager-interface';

const ami = new AMI({
    user: 'amiuser',
    password: 'amipassword',
    host: '127.0.0.1'
});

await ami.login();

// Ping the server
await ami.ping();

// List active channels
const channels = await ami.channels();

// Detect available channel drivers
const hasPJSIP = await ami.has_chan_pjsip();
const hasSIP = await ami.has_chan_sip();
const hasIAX2 = await ami.has_chan_iax2();

// Query PJSIP endpoints
if (hasPJSIP) {
    const endpoints = await ami.pjsip_endpoints();
    const contacts = await ami.pjsip_contacts();
}

// Send any arbitrary AMI action
const response = await ami.send({ Action: 'Status' });

await ami.close();

Constructor Options

| Option | Type | Default | Description | |---|---|---|---| | user | string | — | AMI username (required) | | password | string | — | AMI password (required) | | host | string | '127.0.0.1' | AMI server hostname or IP | | port | number | 5038 | AMI server port | | autoReconnect | boolean | true | Automatically reconnect on disconnect | | keepAlive | boolean | true | Send periodic ping commands | | keepAliveInterval | number | 30000 | Keep-alive ping interval (ms) | | connectionTimeout | number | 5000 | Socket connection timeout (ms) | | readInterval | number | 500 | Payload read interval (ms) |

API

Connection

  • login(user?, password?) — Authenticate with the AMI server
  • close() — Close the connection and clean up
  • ping() — Send a keep-alive ping
  • authenticated — Whether the client is currently authenticated

Channel Driver Detection

  • has_chan_sip() — Check if chan_sip is loaded
  • has_chan_pjsip() — Check if chan_pjsip is loaded
  • has_chan_iax2() — Check if chan_iax2 is loaded
  • moduleCheck(module) — Check if any Asterisk module is loaded

Peer & Endpoint Discovery

  • sip_peers() — List SIP peers
  • pjsip_endpoints() — List PJSIP endpoints
  • pjsip_contacts() — List PJSIP contacts
  • iax2_peers() — List IAX2 peers
  • channels() — List active channels

Asterisk Database

  • db_get(family, key) — Retrieve a database entry
  • db_get_tree(family?, key?) — Retrieve a database tree
  • db_put(family, key, value) — Store a database entry
  • db_del(family, key) — Delete a database entry
  • db_del_tree(family, key) — Delete a database tree

Generic Commands

  • send<ResponseType, RequestType>(payload) — Send any AMI action and await a typed response. Automatically handles authentication if not already logged in.

Events

The client extends EventEmitter and emits:

| Event | Payload | Description | |---|---|---| | connect | — | Socket connected to the server | | close | hadError?: boolean | Socket closed | | error | Error | Connection error | | response | T | AMI response packet received |

License

MIT