marcelog / Nami

Asterisk manager interface (ami) client for nodejs
http://marcelog.github.com/Nami
Apache License 2.0
99 stars 59 forks source link

Error on the QuickStart example #48

Closed digas closed 8 years ago

digas commented 8 years ago

Hey, is just me or there is no definition of namiLib on the code ? Tried to implement the simple quickstart example and (the user on manager is ok so i know it can login) node complians with this.... can you give me a light ? thanks

nami.send(new namiLib.Actions.CoreShowChannelsAction(), function(response){ ^ ReferenceError: namiLib is not defined

sorry let me give you some versions: nami 0.7.1 node v4.4.0 (and tested it on v0.12.2 too) Asterisk 11.21.0

digas commented 8 years ago

Ok just forget it , i found the answer on the index.js file following the example there ,

var namiLib = require(__dirname + "node_modules/nami/src/nami.js");

Anyway still not in the good path 🈂️

response: 'Success', actionid: '0', message: 'Authentication accepted', events: [] } /Volumes/Wow/digas/shell/Repos/Django/webconference/node_monitor_calls/test.js:30 nami.send(new namiLib.Actions.CoreShowChannelsAction(), function(response){ ^

TypeError: namiLib.Actions.CoreShowChannelsAction is not a function at Nami. (/Volumes/Wow/digas/shell/Repos/Django/webconference/node_monitor_calls/test.js:30:15) at emitNone (events.js:67:13) at Nami.emit (events.js:166:7)

marcelog commented 8 years ago

You should:

var namiLib = require('nami');

Once nami is in your package.json. The example also works fine:

node src/index.js 127.0.0.1 5038 user secret
digas commented 8 years ago

Please confirm me this on the example you try to call a function : nami.send( new namiLib.Actions.CoreShowChannelsAction(),

But i only found on messages/actions.js CoreShowChannels() function and if i change it on the example it works ... is it ok ?