Built motion from commit (unavailable).|2.5.27
[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 _0xf75a=['../../config/environment','client','http','redis','defaults','./cmList.socket','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xf75a,0x1c9));var _0xaf75=function(_0x34f456,_0x271849){_0x34f456=_0x34f456-0x0;var _0x589f55=_0xf75a[_0x34f456];return _0x589f55;};'use strict';var _=require(_0xaf75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaf75('0x1'));var fs=require('fs');var Redis=require(_0xaf75('0x2'));var db=require(_0xaf75('0x3'))['db'];var utils=require(_0xaf75('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xaf75('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xaf75('0x6')][_0xaf75('0x7')]({'port':0x232a});config[_0xaf75('0x8')]=_[_0xaf75('0x9')](config[_0xaf75('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaf75('0xa'))[_0xaf75('0xb')](socket);function respondWithRpcPromise(_0x3d7b8a,_0xa430eb,_0x3f289d){return new BPromise(function(_0x3cf542,_0xc810db){return client['request'](_0x3d7b8a,_0x3f289d)['then'](function(_0x58581e){logger[_0xaf75('0xc')](_0xaf75('0xd'),_0xa430eb,_0xaf75('0xe'));logger[_0xaf75('0xf')]('CmList,\x20%s,\x20%s,\x20%s',_0xa430eb,_0xaf75('0xe'),JSON[_0xaf75('0x10')](_0x58581e));if(_0x58581e[_0xaf75('0x11')]){if(_0x58581e[_0xaf75('0x11')][_0xaf75('0x12')]===0x1f4){logger[_0xaf75('0x11')](_0xaf75('0xd'),_0xa430eb,_0x58581e[_0xaf75('0x11')]['message']);return _0xc810db(_0x58581e[_0xaf75('0x11')][_0xaf75('0x13')]);}logger[_0xaf75('0x11')](_0xaf75('0xd'),_0xa430eb,_0x58581e['error']['message']);return _0x3cf542(_0x58581e[_0xaf75('0x11')][_0xaf75('0x13')]);}else{logger[_0xaf75('0xc')](_0xaf75('0xd'),_0xa430eb,_0xaf75('0xe'));_0x3cf542(_0x58581e[_0xaf75('0x14')]['message']);}})['catch'](function(_0x59821b){logger[_0xaf75('0x11')](_0xaf75('0xd'),_0xa430eb,_0x59821b);_0xc810db(_0x59821b);});});}