Built motion from commit (unavailable).|2.5.7
[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 _0x23b0=['stringify','error','code','message','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s'];(function(_0xd59341,_0x5c0d98){var _0x51ee03=function(_0x3e7697){while(--_0x3e7697){_0xd59341['push'](_0xd59341['shift']());}};_0x51ee03(++_0x5c0d98);}(_0x23b0,0xc5));var _0x023b=function(_0x4bba51,_0x3dc3f4){_0x4bba51=_0x4bba51-0x0;var _0xfe2247=_0x23b0[_0x4bba51];return _0xfe2247;};'use strict';var _=require('lodash');var util=require(_0x023b('0x0'));var moment=require('moment');var BPromise=require(_0x023b('0x1'));var rs=require(_0x023b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x023b('0x3'))['db'];var utils=require(_0x023b('0x4'));var logger=require(_0x023b('0x5'))(_0x023b('0x6'));var config=require(_0x023b('0x7'));var jayson=require(_0x023b('0x8'));var client=jayson[_0x023b('0x9')]['http']({'port':0x232a});config[_0x023b('0xa')]=_[_0x023b('0xb')](config[_0x023b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x023b('0xa')]));require('./cmList.socket')[_0x023b('0xc')](socket);function respondWithRpcPromise(_0x8ce220,_0x531b81,_0x36c628){return new BPromise(function(_0x6bcd1b,_0x2c4e16){return client[_0x023b('0xd')](_0x8ce220,_0x36c628)[_0x023b('0xe')](function(_0x41c231){logger[_0x023b('0xf')](_0x023b('0x10'),_0x531b81,_0x023b('0x11'));logger['debug'](_0x023b('0x12'),_0x531b81,_0x023b('0x11'),JSON[_0x023b('0x13')](_0x41c231));if(_0x41c231[_0x023b('0x14')]){if(_0x41c231['error'][_0x023b('0x15')]===0x1f4){logger[_0x023b('0x14')](_0x023b('0x10'),_0x531b81,_0x41c231['error'][_0x023b('0x16')]);return _0x2c4e16(_0x41c231['error']['message']);}logger['error'](_0x023b('0x10'),_0x531b81,_0x41c231[_0x023b('0x14')][_0x023b('0x16')]);return _0x6bcd1b(_0x41c231[_0x023b('0x14')][_0x023b('0x16')]);}else{logger[_0x023b('0xf')](_0x023b('0x10'),_0x531b81,'request\x20sent');_0x6bcd1b(_0x41c231[_0x023b('0x17')][_0x023b('0x16')]);}})['catch'](function(_0x6bdb2){logger['error'](_0x023b('0x10'),_0x531b81,_0x6bdb2);_0x2c4e16(_0x6bdb2);});});}