marcelog / nami Goto Github PK
View Code? Open in Web Editor NEWAsterisk manager interface (ami) client for nodejs
Home Page: http://marcelog.github.com/Nami
License: Apache License 2.0
Asterisk manager interface (ami) client for nodejs
Home Page: http://marcelog.github.com/Nami
License: Apache License 2.0
The problem is in checking for welcome message.
In asterisk 10 ami has 1.2 version.
There is no way to correctly react on lost of connection.
I've recently got:
[2012-03-26 05:17:03.693] [INFO] console - warn - 'websocket parser error: reserved fields must be empty'
net.js:453
if (!this._handle) throw new Error('This socket is closed.');
^
Error: This socket is closed.
at Socket._write (net.js:453:28)
at Socket.write (net.js:446:15)
Because of asterisk has been restarted.
Hi,
Can you add new action CancelAtxfer
https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+ManagerAction_CancelAtxfer
Thank you!
Subj.
Hi,Sorry to bother you,I want to know if you plan to support goalng in the future.
When using the library there are get many debug log events printed to the console like the following:
[2016-02-26 11:47:56.036] [DEBUG] Nami.Client - Got event: Event { .....
[2016-02-26 11:47:56.036] [DEBUG] Nami.Client - Skipped 0 bytes
repeated thousands of times.
How do are these disabled?
Hi guys, thanks for the library, it rocks! ;). But I have a problemv with the "VoicemailUsersList" function, I'm not able to capture this event, I've tried different options. Any idea please?
ami.on('VoicemailUserEntry', function (entry) {
ami.on('namiVoicemailUserEntry', function (entry) {
ami.on('namiEvent', function (evt) {
[2014-10-27 22:01:57.970] [WARN] Nami.Client - Discarded: |ActionID: 1
Event: VoicemailUserEntry
VMContext: default
VoiceMailbox: 2000
Fullname: Support
Email:
Pager:
ServerEmail:
MailCommand:
Language:
TimeZone:
Callback:
Dialout:
UniqueID:
ExitContext:
SayDurationMinimum: 2
SayEnvelope: No
SayCID: No
AttachMessage: No
AttachmentFormat:
DeleteMessage: No
VolumeGain: 0.00
CanReview: Yes
CallOperator: Yes
MaxMessageCount: 100
MaxMessageLength: 0
NewMessageCount: 1|
You forgot QueueReset in array actions in actions.js
var actions = [
....
QueueReset,
..
]
Hi, I've realized that when sending an originate action with Nami in async mode (async:true), asterisk doesn't recognize the ActionID correctly, so it's impossible to trace the subsequent related events (like OriginateResponse Event)
The call itself proceeds, but with actionid recognized as "1".
Example captured with tcpdump from an Asterisk 1.8.7.0:
what nami.js sends:
id: 1
ActionID: 1
Action: Originate
actionid: 1982
channel: Local/xxxxxx@from-internal
context: from-internal
callerid: xxxxxx
exten: xxxxxx
async: true
priority: 1
timeout: 180000
what asterisk responds (when the 1st leg of the call has been established):
Event: OriginateResponse
Privilege: call,all
ActionID: 1
Response: Success
Channel: Local/xxxxxx@from-internal-8789;1
Context: from-internal
Exten: xxxxxx
Reason: 4
Uniqueid: 1402076400.50940
CallerIDNum: xxxxxx
CallerIDName: xxxxxx
I don't know why Nami sends the first two lines ("id:1" and "ActionID: 1") but it clearly has an effect on asterisk's interpretation of the ActionID.
Has anyone encountered this issue?
Thank you
The problem is that on Success response to this action we have "Result will follow", but we don't have followed events list.
In fact we have only one single event:
Event: DBGetResponse
Family: <family>
Key: <key>
Val: <value>
http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+DBGet
May be there is some other actions with such problems.
How about PJSIP actions?
PJSIPNotify
PJSIPQualify
PJSIPRegister
PJSIPShowEndpoint
PJSIPShowEndpoints
PJSIPShowRegistrationsInbound
PJSIPShowRegistrationsOutbound
PJSIPShowResourceLists
PJSIPShowSubscriptionsInbound
PJSIPShowSubscriptionsOutbound
PJSIPUnregister
Thanks, Jesús
I am using npm nami package inside Meteor app to listen to events from an Asterisk server. In server side, I have this code:
namiLib = Meteor.npmRequire "nami"
namiConfig =
"host": "..."
"port": 5038
"username": "..."
"secret": "...
nami = new namiLib.Nami namiConfig
If I remove the line nami = new namiLib.Nami namiConfig, the server runs fine. But with that line, the server stops at following step, and I cannot access http://localhost:3000, which is the default url for Meteor app. Nami package prevents Meteor from starting.
Any idea to help resolve this issue?
I have posted this question on Stackoverflow but still no solution except using other package instead of nami.
If i am using asterisk 1.8.13 with realtime configuration and i have for example two sip trunks (foo1, foo2) . And i send
new namiLib.Actions.SipQualifyPeer()
i get :
"[2012-09-19 15:18:39.865] [FATAL] Nami.App - Error cant execute sip qualify for the sip peer
[2012-09-19 15:18:39.865] [INFO] console - debug - 'websocket writing' '5:::{"name":"errorOnSipQualify","args":[{"peer":"foo1"}]}'
".
But if i use the following code with PAMI :
(new CommandAction("sip qualify peer foo1 load"))
And later i use the "sip qualify peer foo1" functions.
Is it possible to send additional parameters with the "SipQualifyPeer" Action ?.
In Nami.prototype.open we have:
this.socket.on('connect', this.onConnect);
instead of:
this.socket.on('connect', function () { self.onConnect() });
Hey marcelo ,
I'm in the middle of a trouble :D , im making an endpoint api tha takes a post , on that post a i have an an Action to Originate a call then i send the action , outside of that event i do the nami.open .
My problem is , if i leave it like that , the first request works , then the second one still runs the first action again and the second one , and so on .
If i put a nami.close in an outside function like the one you have StandardSend, i get the first action ok , but after that i get no action going to the AMI , but still the nami connects....
I know without giving you code could be difficult to get it but do you have any ideia what could be wrong ?
Thanks
I'm calling this inside the app.post
nami.on('namiConnected', function (event) {
var action = new namiLib.Actions.Originate()
action.Channel = 'LOCAL/' + callid + '@frm-gencalls'
action.Exten = AgentExtension
action.Context = 'frm-gencalls-ag'
action.Priority = '1'
// action.Callerid = 'AutoCalls <000>'
action.Variable = 'AgentExtension=' + AgentExtension + ',GCALLID=' + callid
action.Async = true
action.Timeout = 30000
standardSend(action)
})
nami.open()
https://wiki.asterisk.org/wiki/display/AST/ManagerAction_AGI
May be u should export Action too, for anyone can do something like this:
a = namiLib.Actions.Action('AGI');
If needed action isn't exist in lib?
hello.
is it somehow possible to return response in json format?
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
Hello!
I built a call center monitoring application with NAMI.
I'm currently working on another program (not node.js/nami) to Originate a call. Every so often I'm getting the crash on the monitoring application
(Paths changed)
/home/user/app/node_modules/nami/src/nami.js:70
this.responses[event.actionid].events.push(event);
^
TypeError: Cannot read property 'events' of undefined
at Nami.onRawEvent
(/home/user/app/node_modules/nami/src/nami.js:70:39)
at Nami.EventEmitter.emit (events.js:96:17)
at Nami.onRawMessage
(/home/user/app/node_modules/nami/src/nami.js:119:14)
at Nami.EventEmitter.emit (events.js:96:17)
at Nami.onData
(/home/user/app/node_modules/nami/src/nami.js:142:14)
at Socket.Nami.onWelcomeMessage
(/home/user/app/node_modules/nami/src/nami.js:182:18)
at Socket.EventEmitter.emit (events.js:96:17)
at TCP.onread (net.js:392:31)
Even though I can't reproduce this all the time, I think this is directly related to my Originate or checking for OriginateResponse..
Other info: npm ls
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └─┬ [email protected]
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
├── [email protected]
├── [email protected]
└─┬ [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
└── [email protected]
I think, in README.md should be explained how to configure log4j logging.
{ lines:
[ 'Event: VarSet',
'Privilege: dialplan,all',
'Channel: SIP/sip123456-000000be',
'Variable: MACRO_DEPTH',
'Value: 1',
'Uniqueid: 1399421255.190' ],
EOL: '\r\n',
variables: { MACRO_DEPTH: undefined },
event: 'VarSet',
privilege: 'dialplan,all',
channel: 'SIP/sip123456-000000be',
value: '1',
uniqueid: '1399421255.190' }
Hack in Message.prototype.unmarshall() that supposed to handle variables in event currently breaks resulted event obj for VarSet event.
There is no variable key in obj.
There is no values in variables storage.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.