d1c786b1d6e27a4117e4d594b8b04a30eaf52c03
[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 _0x9b8d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x9b8d,0x199));var _0xd9b8=function(_0x11908c,_0x547af6){_0x11908c=_0x11908c-0x0;var _0x10cd4e=_0x9b8d[_0x11908c];return _0x10cd4e;};'use strict';var _=require(_0xd9b8('0x0'));var util=require(_0xd9b8('0x1'));var moment=require(_0xd9b8('0x2'));var BPromise=require(_0xd9b8('0x3'));var rs=require(_0xd9b8('0x4'));var fs=require('fs');var Redis=require(_0xd9b8('0x5'));var db=require(_0xd9b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9b8('0x7'))(_0xd9b8('0x8'));var config=require(_0xd9b8('0x9'));var jayson=require(_0xd9b8('0xa'));var client=jayson['client'][_0xd9b8('0xb')]({'port':0x232a});config['redis']=_[_0xd9b8('0xc')](config[_0xd9b8('0xd')],{'host':_0xd9b8('0xe'),'port':0x18eb});var socket=require(_0xd9b8('0xf'))(new Redis(config['redis']));require(_0xd9b8('0x10'))['register'](socket);function respondWithRpcPromise(_0x16800a,_0x586797,_0x399ceb){return new BPromise(function(_0x20b4df,_0x4cf5d7){return client['request'](_0x16800a,_0x399ceb)[_0xd9b8('0x11')](function(_0x157df0){logger[_0xd9b8('0x12')]('CmList,\x20%s,\x20%s',_0x586797,_0xd9b8('0x13'));logger[_0xd9b8('0x14')](_0xd9b8('0x15'),_0x586797,'request\x20sent',JSON[_0xd9b8('0x16')](_0x157df0));if(_0x157df0[_0xd9b8('0x17')]){if(_0x157df0[_0xd9b8('0x17')][_0xd9b8('0x18')]===0x1f4){logger[_0xd9b8('0x17')](_0xd9b8('0x19'),_0x586797,_0x157df0[_0xd9b8('0x17')][_0xd9b8('0x1a')]);return _0x4cf5d7(_0x157df0[_0xd9b8('0x17')][_0xd9b8('0x1a')]);}logger[_0xd9b8('0x17')](_0xd9b8('0x19'),_0x586797,_0x157df0['error'][_0xd9b8('0x1a')]);return _0x20b4df(_0x157df0[_0xd9b8('0x17')]['message']);}else{logger[_0xd9b8('0x12')](_0xd9b8('0x19'),_0x586797,_0xd9b8('0x13'));_0x20b4df(_0x157df0[_0xd9b8('0x1b')][_0xd9b8('0x1a')]);}})[_0xd9b8('0x1c')](function(_0x1957c2){logger[_0xd9b8('0x17')]('CmList,\x20%s,\x20%s',_0x586797,_0x1957c2);_0x4cf5d7(_0x1957c2);});});}