Built motion from commit (unavailable).|2.5.4
[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 _0xb011=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5f46ee,_0x550dbb){var _0x5f3804=function(_0x1fcd12){while(--_0x1fcd12){_0x5f46ee['push'](_0x5f46ee['shift']());}};_0x5f3804(++_0x550dbb);}(_0xb011,0x12a));var _0x1b01=function(_0x547ec1,_0x7a5a46){_0x547ec1=_0x547ec1-0x0;var _0x2a6069=_0xb011[_0x547ec1];return _0x2a6069;};'use strict';var _=require('lodash');var util=require(_0x1b01('0x0'));var moment=require(_0x1b01('0x1'));var BPromise=require(_0x1b01('0x2'));var rs=require(_0x1b01('0x3'));var fs=require('fs');var Redis=require(_0x1b01('0x4'));var db=require(_0x1b01('0x5'))['db'];var utils=require(_0x1b01('0x6'));var logger=require('../../config/logger')(_0x1b01('0x7'));var config=require(_0x1b01('0x8'));var jayson=require(_0x1b01('0x9'));var client=jayson[_0x1b01('0xa')][_0x1b01('0xb')]({'port':0x232a});config[_0x1b01('0xc')]=_[_0x1b01('0xd')](config[_0x1b01('0xc')],{'host':_0x1b01('0xe'),'port':0x18eb});var socket=require(_0x1b01('0xf'))(new Redis(config[_0x1b01('0xc')]));require('./cmList.socket')[_0x1b01('0x10')](socket);function respondWithRpcPromise(_0x22fa4c,_0x4d7b3a,_0x2d31ad){return new BPromise(function(_0x19aa77,_0x5b942b){return client[_0x1b01('0x11')](_0x22fa4c,_0x2d31ad)[_0x1b01('0x12')](function(_0x598c88){logger[_0x1b01('0x13')](_0x1b01('0x14'),_0x4d7b3a,_0x1b01('0x15'));logger[_0x1b01('0x16')]('CmList,\x20%s,\x20%s,\x20%s',_0x4d7b3a,_0x1b01('0x15'),JSON['stringify'](_0x598c88));if(_0x598c88[_0x1b01('0x17')]){if(_0x598c88['error'][_0x1b01('0x18')]===0x1f4){logger[_0x1b01('0x17')](_0x1b01('0x14'),_0x4d7b3a,_0x598c88[_0x1b01('0x17')]['message']);return _0x5b942b(_0x598c88[_0x1b01('0x17')][_0x1b01('0x19')]);}logger[_0x1b01('0x17')](_0x1b01('0x14'),_0x4d7b3a,_0x598c88['error'][_0x1b01('0x19')]);return _0x19aa77(_0x598c88['error'][_0x1b01('0x19')]);}else{logger[_0x1b01('0x13')](_0x1b01('0x14'),_0x4d7b3a,'request\x20sent');_0x19aa77(_0x598c88[_0x1b01('0x1a')][_0x1b01('0x19')]);}})[_0x1b01('0x1b')](function(_0x10dcbf){logger['error'](_0x1b01('0x14'),_0x4d7b3a,_0x10dcbf);_0x5b942b(_0x10dcbf);});});}