marcelog / Nami

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

Not an issue , this is more a request for help #55

Closed digas closed 3 years ago

digas commented 3 years ago

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()
digas commented 3 years ago

I solved the problem not using the event namiConnected to trigger the call Origination action, and opening the connection with nami.open , before that.