9e768190ebe96af246becdc22c928f0b18f9b5e7
[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 _0x04d9=['CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','CmList,\x20%s,\x20%s','debug'];(function(_0x4c6dcf,_0x2a672a){var _0x5ede9f=function(_0x54b7e3){while(--_0x54b7e3){_0x4c6dcf['push'](_0x4c6dcf['shift']());}};_0x5ede9f(++_0x2a672a);}(_0x04d9,0x156));var _0x904d=function(_0xec77fe,_0x5eafd0){_0xec77fe=_0xec77fe-0x0;var _0xecf67e=_0x04d9[_0xec77fe];return _0xecf67e;};'use strict';var _=require(_0x904d('0x0'));var util=require(_0x904d('0x1'));var moment=require(_0x904d('0x2'));var BPromise=require('bluebird');var rs=require(_0x904d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x904d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x904d('0x5'))('rpc');var config=require(_0x904d('0x6'));var jayson=require(_0x904d('0x7'));var client=jayson[_0x904d('0x8')][_0x904d('0x9')]({'port':0x232a});config[_0x904d('0xa')]=_[_0x904d('0xb')](config[_0x904d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x904d('0xc'))(new Redis(config[_0x904d('0xa')]));require('./cmList.socket')[_0x904d('0xd')](socket);function respondWithRpcPromise(_0x388b43,_0x14ed7b,_0x364c45){return new BPromise(function(_0x3d8da9,_0x27e5a3){return client['request'](_0x388b43,_0x364c45)[_0x904d('0xe')](function(_0x1d39b2){logger[_0x904d('0xf')](_0x904d('0x10'),_0x14ed7b,'request\x20sent');logger[_0x904d('0x11')](_0x904d('0x12'),_0x14ed7b,_0x904d('0x13'),JSON['stringify'](_0x1d39b2));if(_0x1d39b2[_0x904d('0x14')]){if(_0x1d39b2['error'][_0x904d('0x15')]===0x1f4){logger[_0x904d('0x14')](_0x904d('0x10'),_0x14ed7b,_0x1d39b2[_0x904d('0x14')][_0x904d('0x16')]);return _0x27e5a3(_0x1d39b2[_0x904d('0x14')][_0x904d('0x16')]);}logger[_0x904d('0x14')](_0x904d('0x10'),_0x14ed7b,_0x1d39b2[_0x904d('0x14')][_0x904d('0x16')]);return _0x3d8da9(_0x1d39b2['error'][_0x904d('0x16')]);}else{logger[_0x904d('0xf')]('CmList,\x20%s,\x20%s',_0x14ed7b,_0x904d('0x13'));_0x3d8da9(_0x1d39b2[_0x904d('0x17')]['message']);}})['catch'](function(_0x31ab8b){logger[_0x904d('0x14')](_0x904d('0x10'),_0x14ed7b,_0x31ab8b);_0x27e5a3(_0x31ab8b);});});}