84c3d6427ce207000bf372bcc75570cc0357b53d
[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 _0x51ce=['../../config/environment','client','http','defaults','redis','./cmList.socket','register','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c8750,_0x101df8){var _0x2a2c98=function(_0x4b65db){while(--_0x4b65db){_0x3c8750['push'](_0x3c8750['shift']());}};_0x2a2c98(++_0x101df8);}(_0x51ce,0xd9));var _0xe51c=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x51ce[_0x254076];return _0x21a93e;};'use strict';var _=require(_0xe51c('0x0'));var util=require(_0xe51c('0x1'));var moment=require(_0xe51c('0x2'));var BPromise=require(_0xe51c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe51c('0x4'));var db=require(_0xe51c('0x5'))['db'];var utils=require(_0xe51c('0x6'));var logger=require(_0xe51c('0x7'))('rpc');var config=require(_0xe51c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe51c('0x9')][_0xe51c('0xa')]({'port':0x232a});config['redis']=_[_0xe51c('0xb')](config[_0xe51c('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe51c('0xc')]));require(_0xe51c('0xd'))[_0xe51c('0xe')](socket);function respondWithRpcPromise(_0x514315,_0x4fc5a2,_0x3539c2){return new BPromise(function(_0xfd6183,_0x45bbf3){return client['request'](_0x514315,_0x3539c2)['then'](function(_0x58922a){logger[_0xe51c('0xf')]('CmList,\x20%s,\x20%s',_0x4fc5a2,_0xe51c('0x10'));logger[_0xe51c('0x11')](_0xe51c('0x12'),_0x4fc5a2,_0xe51c('0x10'),JSON[_0xe51c('0x13')](_0x58922a));if(_0x58922a[_0xe51c('0x14')]){if(_0x58922a['error'][_0xe51c('0x15')]===0x1f4){logger[_0xe51c('0x14')](_0xe51c('0x16'),_0x4fc5a2,_0x58922a[_0xe51c('0x14')][_0xe51c('0x17')]);return _0x45bbf3(_0x58922a['error'][_0xe51c('0x17')]);}logger[_0xe51c('0x14')](_0xe51c('0x16'),_0x4fc5a2,_0x58922a[_0xe51c('0x14')]['message']);return _0xfd6183(_0x58922a['error'][_0xe51c('0x17')]);}else{logger[_0xe51c('0xf')]('CmList,\x20%s,\x20%s',_0x4fc5a2,_0xe51c('0x10'));_0xfd6183(_0x58922a[_0xe51c('0x18')]['message']);}})['catch'](function(_0x2de36b){logger[_0xe51c('0x14')](_0xe51c('0x16'),_0x4fc5a2,_0x2de36b);_0x45bbf3(_0x2de36b);});});}