Built motion from commit e02f907f.|2.6.14
[motion2.git] / server / api / cmList / cmList.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x504b=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash'];(function(_0x793c45,_0x22a198){var _0x379aa7=function(_0x415005){while(--_0x415005){_0x793c45['push'](_0x793c45['shift']());}};_0x379aa7(++_0x22a198);}(_0x504b,0x8b));var _0xb504=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x504b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb504('0x0'));var util=require('util');var moment=require(_0xb504('0x1'));var BPromise=require(_0xb504('0x2'));var rs=require(_0xb504('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb504('0x4'))['db'];var utils=require(_0xb504('0x5'));var logger=require('../../config/logger')(_0xb504('0x6'));var config=require('../../config/environment');var jayson=require(_0xb504('0x7'));var client=jayson[_0xb504('0x8')][_0xb504('0x9')]({'port':0x232a});config[_0xb504('0xa')]=_[_0xb504('0xb')](config[_0xb504('0xa')],{'host':_0xb504('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb504('0xa')]));require(_0xb504('0xd'))[_0xb504('0xe')](socket);function respondWithRpcPromise(_0x4beb1a,_0x1d9c29,_0x275ae5){return new BPromise(function(_0xe6e7d5,_0x4f9a40){return client[_0xb504('0xf')](_0x4beb1a,_0x275ae5)[_0xb504('0x10')](function(_0x23b44c){logger[_0xb504('0x11')](_0xb504('0x12'),_0x1d9c29,_0xb504('0x13'));logger[_0xb504('0x14')](_0xb504('0x15'),_0x1d9c29,_0xb504('0x13'),JSON[_0xb504('0x16')](_0x23b44c));if(_0x23b44c['error']){if(_0x23b44c['error'][_0xb504('0x17')]===0x1f4){logger[_0xb504('0x18')](_0xb504('0x12'),_0x1d9c29,_0x23b44c[_0xb504('0x18')][_0xb504('0x19')]);return _0x4f9a40(_0x23b44c['error'][_0xb504('0x19')]);}logger[_0xb504('0x18')](_0xb504('0x12'),_0x1d9c29,_0x23b44c[_0xb504('0x18')][_0xb504('0x19')]);return _0xe6e7d5(_0x23b44c[_0xb504('0x18')][_0xb504('0x19')]);}else{logger[_0xb504('0x11')]('CmList,\x20%s,\x20%s',_0x1d9c29,'request\x20sent');_0xe6e7d5(_0x23b44c[_0xb504('0x1a')][_0xb504('0x19')]);}})[_0xb504('0x1b')](function(_0x50d9dd){logger[_0xb504('0x18')](_0xb504('0x12'),_0x1d9c29,_0x50d9dd);_0x4f9a40(_0x50d9dd);});});}