Created
June 15, 2017 06:08
-
-
Save kschingiz/962805421127eeeee346ef43051e7d5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Meteor.startup(function(){ | |
var namiConfig = { | |
host: "IP address", | |
port: 5038, | |
username: "username", | |
secret: "secret" | |
}; | |
var nami = new (Meteor.npmRequire("nami").Nami)(namiConfig); | |
// nami.on('namiEvent', Meteor.bindEnvironment(function (event) { | |
// console.log(event); | |
// })); | |
nami.on('namiEventDialEnd', Meteor.bindEnvironment(function(event) { | |
Dials.remove({uniqueid: event.uniqueid}); | |
})); | |
nami.on('namiEventBridgeLeave', Meteor.bindEnvironment(function(event) { | |
console.log(' ---- namiEventBridgeLeave ---- ', event); | |
if(event.context == "from-internal"){ | |
Meteor.call("endDial", event.uniqueid); | |
} | |
})); | |
nami.on("namiEventBridgeEnter", Meteor.bindEnvironment(function(event){ | |
console.log('--- namiEventBridgeEnter ----'); | |
if(event.context == "from-internal"){ | |
Meteor.call("newDial", event, function(error, result){ | |
if(error){ | |
console.log("error", error); | |
} | |
}); | |
} | |
})); | |
nami.on('namiConnected', Meteor.bindEnvironment(function (event) { | |
console.log(' ---- Connected ---- ', event); | |
})); | |
nami.on('namiConnectionClose', function (event) { | |
console.log('Reconnecting...'); | |
setTimeout(function () { nami.open(); }, 1000); | |
}); | |
nami.logLevel = 0; | |
nami.open(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment