821c296e6a3cc080c41d7512e6fc1ea3ac15b9d9
[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 _0x50b5=['info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then'];(function(_0x426323,_0x2ce530){var _0xa347f6=function(_0x267c9f){while(--_0x267c9f){_0x426323['push'](_0x426323['shift']());}};_0xa347f6(++_0x2ce530);}(_0x50b5,0x183));var _0x550b=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x50b5[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x550b('0x0'));var util=require(_0x550b('0x1'));var moment=require(_0x550b('0x2'));var BPromise=require('bluebird');var rs=require(_0x550b('0x3'));var fs=require('fs');var Redis=require(_0x550b('0x4'));var db=require(_0x550b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x550b('0x6'))('rpc');var config=require(_0x550b('0x7'));var jayson=require(_0x550b('0x8'));var client=jayson['client'][_0x550b('0x9')]({'port':0x232a});config[_0x550b('0xa')]=_[_0x550b('0xb')](config[_0x550b('0xa')],{'host':_0x550b('0xc'),'port':0x18eb});var socket=require(_0x550b('0xd'))(new Redis(config[_0x550b('0xa')]));require(_0x550b('0xe'))[_0x550b('0xf')](socket);function respondWithRpcPromise(_0x57f64f,_0x2223bf,_0xcacd69){return new BPromise(function(_0x58b974,_0x486e00){return client[_0x550b('0x10')](_0x57f64f,_0xcacd69)[_0x550b('0x11')](function(_0x46b14f){logger[_0x550b('0x12')](_0x550b('0x13'),_0x2223bf,'request\x20sent');logger['debug'](_0x550b('0x14'),_0x2223bf,'request\x20sent',JSON['stringify'](_0x46b14f));if(_0x46b14f[_0x550b('0x15')]){if(_0x46b14f[_0x550b('0x15')][_0x550b('0x16')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x2223bf,_0x46b14f[_0x550b('0x15')][_0x550b('0x17')]);return _0x486e00(_0x46b14f[_0x550b('0x15')][_0x550b('0x17')]);}logger['error'](_0x550b('0x13'),_0x2223bf,_0x46b14f[_0x550b('0x15')]['message']);return _0x58b974(_0x46b14f[_0x550b('0x15')][_0x550b('0x17')]);}else{logger[_0x550b('0x12')](_0x550b('0x13'),_0x2223bf,_0x550b('0x18'));_0x58b974(_0x46b14f[_0x550b('0x19')]['message']);}})[_0x550b('0x1a')](function(_0x536d7f){logger['error']('CmList,\x20%s,\x20%s',_0x2223bf,_0x536d7f);_0x486e00(_0x536d7f);});});}