<commit_before>'use strict';

/*
# Respsonse Format

Outbound:
Date;CALL;ConnectionId;Extension;CallerId;CalledPhoneNumber;

Inbound:
Date;RING;ConnectionId;CallerId;CalledPhoneNumber;

Connected:
Date;CONNECT;ConnectionId;Extension;Number;

Disconnected:
Date;DISCONNECT;ConnectionID;DurationInSeconds;
*/

var net    = require('net');
var events = require('events');

var CallMonitor = function (host, port) {
  var self = this;
  this.call = {};
  events.EventEmitter.call(this);

  function fritzboxDateToUnix(string) {
    var d = string.match(/[0-9]{2}/g);
    var result = '';
    result += '20' + d[2] + '-' + d[1] + '-' + d[0];
    result += ' ' + d[3] + ':' + d[4] + ':' + d[5];
    return Math.floor(new Date(result).getTime() / 1000);
  }

  function parseMessage(message) {
    message = message
              .toString()
              .toLowerCase()
              .replace(/[\n\r]/g, '')
              .replace(/[\n\r]/)
              .replace(/;$/, '')
              .split(';');
    message[0] = fritzboxDateToUnix(message[0]);
    return message;
  }
<commit_msg>add default port 1012<commit_after>'use strict';

/*
# Respsonse Format

Outbound:
Date;CALL;ConnectionId;Extension;CallerId;CalledPhoneNumber;

Inbound:
Date;RING;ConnectionId;CallerId;CalledPhoneNumber;

Connected:
Date;CONNECT;ConnectionId;Extension;Number;

Disconnected:
Date;DISCONNECT;ConnectionID;DurationInSeconds;
*/

var net    = require('net');
var events = require('events');

var CallMonitor = function (host, port) {
  var self = this;
  this.call = {};
  events.EventEmitter.call(this);

  port = port || 1012;

  function fritzboxDateToUnix(string) {
    var d = string.match(/[0-9]{2}/g);
    var result = '';
    result += '20' + d[2] + '-' + d[1] + '-' + d[0];
    result += ' ' + d[3] + ':' + d[4] + ':' + d[5];
    return Math.floor(new Date(result).getTime() / 1000);
  }

  function parseMessage(buffer) {
    var message = buffer.toString()
                  .toLowerCase()
                  .replace(/[\n\r]$/, '')
                  .replace(/;$/, '')
                  .split(';');
    message[0] = fritzboxDateToUnix(message[0]);
    return message;
  }

{'fraction_non_alphanumeric': 0.17946345975948197, 'fraction_numerical': 0.01942645698427382, 'mean_word_length': 2.9907749077490773, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5224961', 'n_tokens_mistral': 754, 'n_tokens_neox': 742, 'n_words': 129}