Subject: [PATCH] Built motion from commit 22bc4a4.|0.0.18

From: Motion Team <[email-masked]>
Date: Mon, 11 Jan 2016 16:38:39 +0100

---
 package.json                       |    2 +-
 release-notes/changelog_0.0.17.txt |   27 -----
 release-notes/changelog_0.0.18.txt |   27 +++++
 server/app.js                      |  187 +++---------------------------------
 4 files changed, 40 insertions(+), 203 deletions(-)
 delete mode 100644 release-notes/changelog_0.0.17.txt
 create mode 100644 release-notes/changelog_0.0.18.txt

diff --git a/package.json b/package.json
index 24541d6..497d188 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "motion",
-  "version": "0.0.18",
+  "version": "0.0.19",
   "main": "server/app.js",
   "dependencies": {
     "accept-language-parser": "^1.0.2",
diff --git a/release-notes/changelog_0.0.17.txt b/release-notes/changelog_0.0.17.txt
deleted file mode 100644
index 2be4f73..0000000
--- a/release-notes/changelog_0.0.17.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# xCALLY MOTION Changelog
-
-- * 96837d8 - 2016-01-11: Asterisk Configuration File 
-- * 9626622 - 2016-01-11: fixed back compatibility languages 
-- * 4143fce - 2016-01-11: Updated reports APIs. 
-- * 7d148f3 - 2016-01-11: bower.json 
-- * d7331e9 - 2016-01-11: server side .yo-rc.json 
-- * d375539 - 2016-01-11: server side app.js + routes.js 
-- * e70d044 - 2016-01-11: server side models 
-- * 5127ffe - 2016-01-11: server side config 
-- * b773540 - 2016-01-11: server side API 
-- * 00f85ce - 2016-01-11: client side components 
-- * 6c68dbd - 2016-01-11: client side assets 
-- * a42a9fa - 2016-01-11: client side app modules 
-- * 8025ad7 - 2016-01-11: client components sidebar templates path 
-- * d804d0a - 2016-01-11: languages update 
-- * cc4abc0 - 2016-01-11: package.son 
-- * 77404a1 - 2016-01-08: Updated ReportTree seed 
-- * c342b5f - 2016-01-08: Report section tree view 
-- * 2ea412c - 2016-01-08: add integration action for voice trigger 
-- * 5ce445c - 2016-01-08: change foreign key to handle AccountId column for each integration 
-- * 0974ad1 - 2016-01-08: add random percentage for &quot;market&quot; 
-- * 2f5d1bc - 2016-01-05: Market update (item disposition) 
-- * 41cb71c - 2016-01-05: Update integration: model, route Update market: fake market only with our integrations Add mocha as dev dependencies 
-- * fa560ae - 2016-01-05: add danger notification (xAlert) 
-- * ce14827 - 2016-01-04: Ui grid table with remote sorting, filtering and grouping for reports. 
-
diff --git a/release-notes/changelog_0.0.18.txt b/release-notes/changelog_0.0.18.txt
new file mode 100644
index 0000000..2be4f73
--- /dev/null
+++ b/release-notes/changelog_0.0.18.txt
@@ -0,0 +1,27 @@
+# xCALLY MOTION Changelog
+
+- * 96837d8 - 2016-01-11: Asterisk Configuration File 
+- * 9626622 - 2016-01-11: fixed back compatibility languages 
+- * 4143fce - 2016-01-11: Updated reports APIs. 
+- * 7d148f3 - 2016-01-11: bower.json 
+- * d7331e9 - 2016-01-11: server side .yo-rc.json 
+- * d375539 - 2016-01-11: server side app.js + routes.js 
+- * e70d044 - 2016-01-11: server side models 
+- * 5127ffe - 2016-01-11: server side config 
+- * b773540 - 2016-01-11: server side API 
+- * 00f85ce - 2016-01-11: client side components 
+- * 6c68dbd - 2016-01-11: client side assets 
+- * a42a9fa - 2016-01-11: client side app modules 
+- * 8025ad7 - 2016-01-11: client components sidebar templates path 
+- * d804d0a - 2016-01-11: languages update 
+- * cc4abc0 - 2016-01-11: package.son 
+- * 77404a1 - 2016-01-08: Updated ReportTree seed 
+- * c342b5f - 2016-01-08: Report section tree view 
+- * 2ea412c - 2016-01-08: add integration action for voice trigger 
+- * 5ce445c - 2016-01-08: change foreign key to handle AccountId column for each integration 
+- * 0974ad1 - 2016-01-08: add random percentage for &quot;market&quot; 
+- * 2f5d1bc - 2016-01-05: Market update (item disposition) 
+- * 41cb71c - 2016-01-05: Update integration: model, route Update market: fake market only with our integrations Add mocha as dev dependencies 
+- * fa560ae - 2016-01-05: add danger notification (xAlert) 
+- * ce14827 - 2016-01-04: Ui grid table with remote sorting, filtering and grouping for reports. 
+
diff --git a/server/app.js b/server/app.js
index 384cf15..57d32fb 100644
--- a/server/app.js
+++ b/server/app.js
@@ -1,175 +1,12 @@
-/**
- * Main application file
- */
-
-'use strict';
-
-// Set default node environment to development
-process.env.NODE_ENV = process.env.NODE_ENV || 'development';
-process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;
-
-process.on('uncaughtException', function(err) {
-  if (typeof err === 'object') {
-    if (err.message) {
-      console.log('\nMessage: ' + err.message)
-    }
-    if (err.stack) {
-      console.log('\nStacktrace:')
-      console.log('====================')
-      console.log(err.stack);
-    }
-  } else {
-    console.log('dumpError :: argument is not an object');
-  }
-});
-
-var os = require('os');
-var http = require('http');
-var util = require('util');
-var crypto = require('crypto');
-
-var express = require('express');
-var models = require('./models');
-var config = require('./config/environment');
-
-var Setting = models.Setting;
-
-// Setup server
-var app = express();
-var server = require('http').createServer(app);
-var io = require('socket.io')(server, {
-  serveClient: (config.env === 'production') ? false : true,
-  path: '/socket.io-client'
-});
-
-var ami = require('asterisk-manager')(config.asterisk.port, config.asterisk.host,
-  config.asterisk.username, config.asterisk.password, true);
-ami.keepConnected();
-
-//Initialization Kue
-var kue = require('kue');
-kue.app.listen(3001);
-
-var cronjob = require('cron').CronJob;
-
-require('./config/express')(app);
-// require('./routes')(app);
-
-// Connect to database
-models
-  .sequelize
-  .sync()
-  .then(function() {
-
-    require('./routes')(app);
-
-    // Populate DB with sample data
-    if (config.seedDB) {
-      require('./config/seed');
-    }
-    //
-    // Start Cally Square Projects
-    require('./config/socketio')(io);
-    require('./config/kue.mail')(kue);
-    require('./config/kue.chat')(kue);
-    require('./config/kue.fax')(io, kue);
-    require('./config/automations/mail')();
-    require('./config/automations/fax')();
-    require('./config/triggers')();
-    require('./config/imap').init();
-    require('./config/smtp').init();
-    require('./config/ami')(ami);
-    require('./config/agi')();
-    require('./config/autodialer')(ami);
-    // require('./config/integration')(io, ami);
-
-    // Start server
-    server.listen(config.port, config.ip, function() {
-      console.log('Express server listening on %d, in %s mode', config.port, app.get('env'));
-
-      // var netw0= os.networkInterfaces();
-      // var myConf = null;
-      //
-      // for (var networkInterface in networkInterfaces) {
-      //   if (networkInterfaces.hasOwnProperty(networkInterface)) {
-      //
-      //     var addresses = networkInterfaces[networkInterface];
-      //
-      //     for (var address in addresses) {
-      //       if (addresses.hasOwnProperty(address)) {
-      //         if (config.ip === addresses[address].address) {
-      //           myConf = addresses[address];
-      //           break;
-      //         }
-      //       }
-      //     }
-      //   }
-      // }
-      //
-      // var postData = querystring.stringify(myConf);
-      //
-      // var options = {
-      //   hostname: '192.168.2.133',
-      //   port: 9000,
-      //   path: '/api/servers',
-      //   method: 'POST',
-      //   headers: {
-      //     'Content-Type': 'application/x-www-form-urlencoded',
-      //     'Content-Length': postData.length
-      //   }
-      // };
-      //
-      // var req = http.request(options, function(res) {
-      //   console.log('STATUS: ' + res.statusCode);
-      //   console.log('HEADERS: ' + JSON.stringify(res.headers));
-      //   res.setEncoding('utf8');
-      //   res.on('data', function(chunk) {
-      //     console.log('BODY: ' + chunk);
-      //
-      //     Setting
-      //       .upsert({
-      //         id: 1,
-      //         license: JSON.parse(chunk).license,
-      //         address: myConf.address,
-      //         netmask: myConf.netmask,
-      //         mac: myConf.mac
-      //       })
-      //       .then(function(setting) {
-      //         console.log(setting);
-      //       })
-      //       .catch(function(err) {
-      //         console.error(err);
-      //       });
-      //
-      //   });
-      //   res.on('end', function() {
-      //     console.log('No more data in response.')
-      //   })
-      // });
-      //
-      // req.on('error', function(e) {
-      //   console.log('problem with request: ' + e.message);
-      // });
-      //
-      // // write data to request body
-      // req.write(postData);
-      // req.end();
-    });
-  })
-  .catch(function(err) {
-    console.error(err);
-  });
-
-// Connect to database history
-models
-  .sequelize_history
-  .sync()
-  .then(function() {
-    require('./config/history')(cronjob);
-  })
-  .catch(function(err) {
-    console.error(err);
-  });
-
-// Expose app
-exports = module.exports = app;
\ No newline at end of file
-- 
1.7.1