ba765c274288d5dea750dac6aa458b0fc29c5946
[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 _0x59d0=['error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x34bb68,_0x5b0079){var _0x3db9fb=function(_0x2c87bd){while(--_0x2c87bd){_0x34bb68['push'](_0x34bb68['shift']());}};_0x3db9fb(++_0x5b0079);}(_0x59d0,0xad));var _0x059d=function(_0x1a6817,_0x3cbd16){_0x1a6817=_0x1a6817-0x0;var _0x1ecee3=_0x59d0[_0x1a6817];return _0x1ecee3;};'use strict';var _=require(_0x059d('0x0'));var util=require(_0x059d('0x1'));var moment=require(_0x059d('0x2'));var BPromise=require('bluebird');var rs=require(_0x059d('0x3'));var fs=require('fs');var Redis=require(_0x059d('0x4'));var db=require(_0x059d('0x5'))['db'];var utils=require(_0x059d('0x6'));var logger=require(_0x059d('0x7'))('rpc');var config=require(_0x059d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x059d('0x9')][_0x059d('0xa')]({'port':0x232a});config[_0x059d('0xb')]=_[_0x059d('0xc')](config[_0x059d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x059d('0xd'))(new Redis(config['redis']));require(_0x059d('0xe'))[_0x059d('0xf')](socket);function respondWithRpcPromise(_0x28deed,_0x3ff977,_0x706df3){return new BPromise(function(_0xde161c,_0xbcb429){return client[_0x059d('0x10')](_0x28deed,_0x706df3)[_0x059d('0x11')](function(_0x588c8e){logger['info'](_0x059d('0x12'),_0x3ff977,'request\x20sent');logger[_0x059d('0x13')](_0x059d('0x14'),_0x3ff977,_0x059d('0x15'),JSON[_0x059d('0x16')](_0x588c8e));if(_0x588c8e['error']){if(_0x588c8e[_0x059d('0x17')][_0x059d('0x18')]===0x1f4){logger[_0x059d('0x17')](_0x059d('0x12'),_0x3ff977,_0x588c8e[_0x059d('0x17')][_0x059d('0x19')]);return _0xbcb429(_0x588c8e[_0x059d('0x17')][_0x059d('0x19')]);}logger[_0x059d('0x17')](_0x059d('0x12'),_0x3ff977,_0x588c8e[_0x059d('0x17')][_0x059d('0x19')]);return _0xde161c(_0x588c8e['error'][_0x059d('0x19')]);}else{logger[_0x059d('0x1a')](_0x059d('0x12'),_0x3ff977,_0x059d('0x15'));_0xde161c(_0x588c8e['result'][_0x059d('0x19')]);}})[_0x059d('0x1b')](function(_0x1e661a){logger['error'](_0x059d('0x12'),_0x3ff977,_0x1e661a);_0xbcb429(_0x1e661a);});});}