<commit_before>var _os = require('os');
var _param = require('./param.json');
var _source = _os.hostname();

var _ari = require('ari-client');

var _interval = parseInt(process.argv[1]) || 1000;
var _last;

function poll()
{
    _ari.connect(_param.server, _param.username, _param.password, function(err, ari) {

            ari.channels.list(function(err, channels) {
                    console.log('ASTERISK_CHANNELS ' + channels.length);
            });

            ari.bridges.list(function(err, bridges) {
                    console.log('ASTERISK_BRIDGES ' + bridges.length);
            });

            ari.endpoints.list(function(err, endpoints) {
                    var sip_endpoints = 0;
                    for (var i = 0; i < endpoints.length; i++)
                    {
                            if (endpoints[i].technology == "SIP" && endpoints[i].status == 'online')
                            {
                            	sip_endpoints++;
                            }
                    }

                    console.log('ASTERISK_SIP_ENDPOINTS: ' + sip_endpoints);
            });
    });

	setTimeout(poll, _interval);
}
poll();<commit_msg>Fixed bug in computing online sip endpoints.<commit_after>var _os = require('os');
var _param = require('./param.json');
var _source = _os.hostname();

var _ari = require('ari-client');

var _interval = parseInt(process.argv[1]) || 1000;
var _last;

function poll()
{
    _ari.connect(_param.server, _param.username, _param.password, function(err, ari) {

            ari.channels.list(function(err, channels) {
                    console.log('ASTERISK_CHANNELS ' + channels.length);
            });

            ari.bridges.list(function(err, bridges) {
                    console.log('ASTERISK_BRIDGES ' + bridges.length);
            });

            ari.endpoints.list(function(err, endpoints) {
                    var sip_endpoints = 0;
                    for (var i = 0; i < endpoints.length; i++)
                    {
                            if (endpoints[i].technology == "SIP" && endpoints[i].state == "online")
                            {
                                    sip_endpoints++;
                            }
                    }

                    console.log('ASTERISK_SIP_ENDPOINTS: ' + sip_endpoints);
            });
    });

	setTimeout(poll, _interval);
}
poll();
{'fraction_non_alphanumeric': 0.13167858645351282, 'fraction_numerical': 0.005889777029869584, 'mean_word_length': 1.5819761129207384, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1703948', 'n_tokens_mistral': 707, 'n_tokens_neox': 657, 'n_words': 117}