b2937070e6c5b2abf9b5dfa769a25a44fd4e98fb
[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 _0xc81a=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3fb7c6,_0x4e6d9d){var _0x4ed330=function(_0x4d717a){while(--_0x4d717a){_0x3fb7c6['push'](_0x3fb7c6['shift']());}};_0x4ed330(++_0x4e6d9d);}(_0xc81a,0x100));var _0xac81=function(_0x31d90b,_0x2b178b){_0x31d90b=_0x31d90b-0x0;var _0x376175=_0xc81a[_0x31d90b];return _0x376175;};'use strict';var _=require(_0xac81('0x0'));var util=require(_0xac81('0x1'));var moment=require(_0xac81('0x2'));var BPromise=require(_0xac81('0x3'));var rs=require(_0xac81('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac81('0x5'))['db'];var utils=require(_0xac81('0x6'));var logger=require(_0xac81('0x7'))(_0xac81('0x8'));var config=require(_0xac81('0x9'));var jayson=require(_0xac81('0xa'));var client=jayson[_0xac81('0xb')][_0xac81('0xc')]({'port':0x232a});config[_0xac81('0xd')]=_[_0xac81('0xe')](config[_0xac81('0xd')],{'host':_0xac81('0xf'),'port':0x18eb});var socket=require(_0xac81('0x10'))(new Redis(config[_0xac81('0xd')]));require(_0xac81('0x11'))[_0xac81('0x12')](socket);function respondWithRpcPromise(_0x596bd7,_0x29b213,_0x5dcbe4){return new BPromise(function(_0xb2b0b7,_0x4db8db){return client[_0xac81('0x13')](_0x596bd7,_0x5dcbe4)['then'](function(_0x5bbb40){logger['info'](_0xac81('0x14'),_0x29b213,_0xac81('0x15'));logger[_0xac81('0x16')](_0xac81('0x17'),_0x29b213,_0xac81('0x15'),JSON[_0xac81('0x18')](_0x5bbb40));if(_0x5bbb40[_0xac81('0x19')]){if(_0x5bbb40[_0xac81('0x19')][_0xac81('0x1a')]===0x1f4){logger[_0xac81('0x19')](_0xac81('0x14'),_0x29b213,_0x5bbb40[_0xac81('0x19')][_0xac81('0x1b')]);return _0x4db8db(_0x5bbb40[_0xac81('0x19')][_0xac81('0x1b')]);}logger['error'](_0xac81('0x14'),_0x29b213,_0x5bbb40['error']['message']);return _0xb2b0b7(_0x5bbb40[_0xac81('0x19')][_0xac81('0x1b')]);}else{logger[_0xac81('0x1c')]('CmList,\x20%s,\x20%s',_0x29b213,'request\x20sent');_0xb2b0b7(_0x5bbb40[_0xac81('0x1d')][_0xac81('0x1b')]);}})[_0xac81('0x1e')](function(_0x3544b1){logger[_0xac81('0x19')]('CmList,\x20%s,\x20%s',_0x29b213,_0x3544b1);_0x4db8db(_0x3544b1);});});}