f49325c5bcf10a215643dbf293d98c0f46e54e32
[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 _0xba32=['request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','./cmList.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba32,0x15b));var _0x2ba3=function(_0x141782,_0x20a5de){_0x141782=_0x141782-0x0;var _0x504c01=_0xba32[_0x141782];return _0x504c01;};'use strict';var _=require('lodash');var util=require(_0x2ba3('0x0'));var moment=require(_0x2ba3('0x1'));var BPromise=require(_0x2ba3('0x2'));var rs=require(_0x2ba3('0x3'));var fs=require('fs');var Redis=require(_0x2ba3('0x4'));var db=require(_0x2ba3('0x5'))['db'];var utils=require(_0x2ba3('0x6'));var logger=require(_0x2ba3('0x7'))(_0x2ba3('0x8'));var config=require(_0x2ba3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2ba3('0xa')][_0x2ba3('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2ba3('0xc'),'port':0x18eb});var socket=require(_0x2ba3('0xd'))(new Redis(config[_0x2ba3('0xe')]));require(_0x2ba3('0xf'))[_0x2ba3('0x10')](socket);function respondWithRpcPromise(_0x51a791,_0x2aa0f7,_0x298261){return new BPromise(function(_0x4c5c18,_0x1efaa3){return client[_0x2ba3('0x11')](_0x51a791,_0x298261)['then'](function(_0x2c7f1c){logger[_0x2ba3('0x12')](_0x2ba3('0x13'),_0x2aa0f7,_0x2ba3('0x14'));logger[_0x2ba3('0x15')](_0x2ba3('0x16'),_0x2aa0f7,_0x2ba3('0x14'),JSON[_0x2ba3('0x17')](_0x2c7f1c));if(_0x2c7f1c[_0x2ba3('0x18')]){if(_0x2c7f1c[_0x2ba3('0x18')]['code']===0x1f4){logger[_0x2ba3('0x18')](_0x2ba3('0x13'),_0x2aa0f7,_0x2c7f1c[_0x2ba3('0x18')][_0x2ba3('0x19')]);return _0x1efaa3(_0x2c7f1c[_0x2ba3('0x18')][_0x2ba3('0x19')]);}logger[_0x2ba3('0x18')](_0x2ba3('0x13'),_0x2aa0f7,_0x2c7f1c[_0x2ba3('0x18')]['message']);return _0x4c5c18(_0x2c7f1c[_0x2ba3('0x18')][_0x2ba3('0x19')]);}else{logger[_0x2ba3('0x12')](_0x2ba3('0x13'),_0x2aa0f7,_0x2ba3('0x14'));_0x4c5c18(_0x2c7f1c[_0x2ba3('0x1a')][_0x2ba3('0x19')]);}})[_0x2ba3('0x1b')](function(_0x2bdfdf){logger['error']('CmList,\x20%s,\x20%s',_0x2aa0f7,_0x2bdfdf);_0x1efaa3(_0x2bdfdf);});});}