nami-cc
v1.1.0
Published
fork https://github.com/marcelog/Nami An asterisk manager interface client, uses EventEmitter to communicate events, will allow you to send actions, and receive responses (and associated events), and also receive async events from server
Downloads
4
Maintainers
Readme
NAMI-CC
nami-cc 是一个 node 连接 asterisk 的 ami 库。 根据CC项目 Fork Nami
- 修改package.json, 重命名 nami-cc 发布到 NAM.
- 添加相关 action
- 删除冗余日志
安装
npm install nami-cc
-or- Download it from this repo :)
配置
Nami expects a configuration object, very much like this:
let namiConfig = {
host: "amihost",
port: 5038,
username: "admin",
secret: "secret"
};
快速开始
mkdir testnami
cd testnami
npm install nami
var nami = new (require("nami").Nami)(namiConfig);
nami.on('namiEvent', function (event) { });
nami.on('namiEventDial', function (event) { });
nami.on('namiEventVarSet', function (event) { });
nami.on('namiEventHangup', function (event) { });
process.on('SIGINT', function () {
nami.close();
process.exit();
});
nami.on('namiConnected', function (event) {
nami.send(new namiLib.Actions.CoreShowChannelsAction(), function(response){
console.log(' ---- Response: ' + util.inspect(response));
});
});
nami.open();
Adding variables to actions
Use the property 'variables' in the actions:
var action = new namiLib.Actions.Status();
action.variables = {
'var1': 'val1'
};
nami.send(action, function(response) {
...
});