npm install asterisk-manager
apt-get install node
apt-get install nodejs-legacy
root@asterisk-dominicana:~# node hello.js
Hello World
Doing the call script
/**
* port: port server
* host: host server
* username: username for authentication
* password: username's password for authentication
* events: this parameter determines whether events are emited.
**/
var ami = new require('asterisk-manager')('5038','localhost','admin','mypass456', true);
// In case of any connectiviy problems we got you coverd.
ami.keepConnected();
// Listen for any/all AMI events.
ami.on('managerevent', function(evt) {});
// Listen for specific AMI events. A list of event names can be found at
// https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+AMI+Events
ami.on('hangup', function(evt) {});
ami.on('confbridgejoin', function(evt) {});
// Listen for Action responses.
ami.on('response', function(evt) {});
// Perform an AMI Action. A list of actions can be found at
// https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+AMI+Actions
ami.action({
'action':'originate',
'channel':'SIP/102',
'context':'internal',
'exten':0,
'priority':1,
'variable':{
'name1':'value1',
'name2':'value2'
}
}, function(err, res) {});
running the script node call.js
http://www.igorescobar.com/blog/2014/08/13/working-with-asterisk-and-node-js/
https://github.com/pipobscure/NodeJS-AsteriskManager
https://www.sinologic.net/blog/2015-03/como-hacer-aplicaciones-node-js-y-asterisk.html
No hay comentarios:
Publicar un comentario