asterisk.dm

0.1.1 • Public • Published

asterisk.dm

node.js asterisk pbx

This is based on "asterisk.io", developped by Zugravu Eugen Marius. That provide you to manage easily calls on your asterisk server

1. Install

2. How to use

2.1 AMI

2.1.1 Actions

2.1.2 Events

2.2 AGI

3. TODO

1. Install

npm install asterisk.dm

2. How to use

const VocalServer = require('asterisk.dm')
const path = require('path')

const vs = new VocalServer(path.resolve('./conf/ami.conf'), path.resolve('./conf/agi.conf'), path.resolve('./services/'))

vs.init().then(() => {
    vs.load()
})

ami.conf

{
    "domain": "127.0.0.1",
    "port": 5038,
    "login": "username",
    "pwd": "password"
}

agi.conf

{
    "domain": "127.0.0.1",
    "port": 4573,
}

You must defined a folder that will contains your services. A service can be written like :

module.exports = {
    exec: async function(vs) {
        try {
            const now = Date.now()/1000 + 3600*2
            await vs.command('Say Date "' + now + '" ""')
            await vs.command('Hangup')
        } catch(err) {
            console.log(err)
        }
    }
}

2.1 AMI

Read more at asterisk wiki for: actions, events.

This part is not tested yet. Probably work but... who know !

2.2 AGI

Documetation for agi commands on asterisk wiki page.

You can use all AGI commands that asterisk provides

3. TODO

  • UI: real time user interface
  • helpers : add fonctionnality to Vocal and VocalServer like getTones (catching multiple digits), conBridge (fusion 2 channels easily)

Package Sidebar

Install

npm i asterisk.dm

Weekly Downloads

0

Version

0.1.1

License

none

Unpacked Size

11.4 kB

Total Files

10

Last publish

Collaborators

  • dev-master