Commit aa6e1b6f authored by PD0ZRY Rudy's avatar PD0ZRY Rudy
Browse files

Initial commit

parents
var options = {
'path':'/lh-dev',
'secure':true
}
var activeCallCount = 0
var activeCalls = {}
var socket = require('socket.io-client')('bm-lastheard.pi9noz.ampr.org',options);
socket.on('connect', function(){
console.log("Connected")
socket.on('mqtt', function (msg) {
var data = JSON.parse(msg.payload);
if (data['Event'] == "Session-Start")
{
activeCallCount++
activeCalls[data['SessionID']] = data
redrawDisplay()
}
if (data['Stop'] != 0)
{
if (activeCalls[data['SessionID']] != undefined)
{
activeCallCount--
delete(activeCalls[data['SessionID']])
redrawDisplay()
}
}
})
});
socket.on('event', function(data){
console.log(data)
});
socket.on('disconnect', function(){});
function redrawDisplay()
{
console.log('\033[2J');
console.log("Session count: " + activeCallCount);
console.log("Sessions:");
for (index in activeCalls) {
console.log(index + " " + activeCalls[index]['SourceCall'] + "\t" + activeCalls[index]['SourceID'] + "\t->\t"+activeCalls[index]['DestinationID'] + "\t\t"+activeCalls[index]['LinkName']);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment