b65ae716a9231ba38448a2745c99168697475374
[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 _0x4cda=['client','http','redis','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3a081b,_0x516437){var _0xb166c4=function(_0x22bc5d){while(--_0x22bc5d){_0x3a081b['push'](_0x3a081b['shift']());}};_0xb166c4(++_0x516437);}(_0x4cda,0x6a));var _0xa4cd=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x4cda[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xa4cd('0x0'));var util=require(_0xa4cd('0x1'));var moment=require(_0xa4cd('0x2'));var BPromise=require(_0xa4cd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4cd('0x4'));var db=require(_0xa4cd('0x5'))['db'];var utils=require(_0xa4cd('0x6'));var logger=require(_0xa4cd('0x7'))(_0xa4cd('0x8'));var config=require('../../config/environment');var jayson=require(_0xa4cd('0x9'));var client=jayson[_0xa4cd('0xa')][_0xa4cd('0xb')]({'port':0x232a});config[_0xa4cd('0xc')]=_['defaults'](config[_0xa4cd('0xc')],{'host':_0xa4cd('0xd'),'port':0x18eb});var socket=require(_0xa4cd('0xe'))(new Redis(config[_0xa4cd('0xc')]));require('./cmList.socket')[_0xa4cd('0xf')](socket);function respondWithRpcPromise(_0x58eba6,_0x24ecfc,_0x1508db){return new BPromise(function(_0x15ba04,_0x15a8e6){return client[_0xa4cd('0x10')](_0x58eba6,_0x1508db)[_0xa4cd('0x11')](function(_0x4eb4e7){logger[_0xa4cd('0x12')](_0xa4cd('0x13'),_0x24ecfc,'request\x20sent');logger[_0xa4cd('0x14')](_0xa4cd('0x15'),_0x24ecfc,_0xa4cd('0x16'),JSON[_0xa4cd('0x17')](_0x4eb4e7));if(_0x4eb4e7[_0xa4cd('0x18')]){if(_0x4eb4e7['error'][_0xa4cd('0x19')]===0x1f4){logger[_0xa4cd('0x18')](_0xa4cd('0x13'),_0x24ecfc,_0x4eb4e7[_0xa4cd('0x18')][_0xa4cd('0x1a')]);return _0x15a8e6(_0x4eb4e7['error'][_0xa4cd('0x1a')]);}logger[_0xa4cd('0x18')](_0xa4cd('0x13'),_0x24ecfc,_0x4eb4e7[_0xa4cd('0x18')][_0xa4cd('0x1a')]);return _0x15ba04(_0x4eb4e7[_0xa4cd('0x18')][_0xa4cd('0x1a')]);}else{logger[_0xa4cd('0x12')](_0xa4cd('0x13'),_0x24ecfc,_0xa4cd('0x16'));_0x15ba04(_0x4eb4e7[_0xa4cd('0x1b')][_0xa4cd('0x1a')]);}})[_0xa4cd('0x1c')](function(_0x4755a9){logger[_0xa4cd('0x18')](_0xa4cd('0x13'),_0x24ecfc,_0x4755a9);_0x15a8e6(_0x4755a9);});});}