quick asterisk diaplan
JavaScript CoffeeScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
application fix Dec 1, 2014
examples change Readme Nov 27, 2014
function
test context can append array of include and exten Dec 3, 2014
.gitignore try jsdoc & jslint Nov 4, 2014
CHANGELOG.md
Gruntfile.js add tests Nov 28, 2014
LICENSE Initial commit Oct 30, 2014
README.md
context.js
dialplan.js
extension.js add include Dec 3, 2014
helper.coffee fix helper condition Dec 3, 2014
helper.js fix helper condition Dec 3, 2014
include.js add include Dec 3, 2014
index.js add include Dec 3, 2014
package.json change version for npm Dec 3, 2014

README.md

dialplan

generate asterisk dialplan on javascript / for use with node.js

https://wiki.asterisk.org/wiki/display/AST/The+Asterisk+Dialplan

Install

$ npm install dialplan [--save]

Use

var D = require('dialplan'),
    App = D.Application,
    Func = D.Function,
    H = D.Helper;

var array = [
    App.Verbose(0, H.$(Func.CDR('billsec'))),
    App.AGI('agi://127.0.0.1/agi', 'test', 12),
    App.AddQueueMember("Queue", "Member")
];

var exten = new D.Extension('_2XX');
exten.append(array);

var context = new D.Context('outgoing');
context.append(exten);

var dialplan = new D.Dialplan();
dialplan.append(context);

dialplan.save("/etc/asterisk/extensions_generated.conf", callback);

== Output extensions_generated.conf content ==
[outgoing]
exten=>_2XX,1,Verbose(0,${CDR(billsec)})
exten=>_2XX,2,AGI(agi://127.0.0.1/agi,test,12)
exten=>_2XX,3,AddQueueMember(Queue,Member)

Why use? Not raw dialplan

  1. Syntax highlight in editor
  2. Validate params
  3. Reusable code
  4. Always actual dialplan

Tests

$ npm test

Coverage

$ grunt coverage