aceddcde2f4620b162d3d05642e550b4722b0517
[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 _0x2cca=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x2cca,0x145));var _0xa2cc=function(_0x6ea071,_0x5a8623){_0x6ea071=_0x6ea071-0x0;var _0x5500e5=_0x2cca[_0x6ea071];return _0x5500e5;};'use strict';var _=require(_0xa2cc('0x0'));var util=require(_0xa2cc('0x1'));var moment=require(_0xa2cc('0x2'));var BPromise=require('bluebird');var rs=require(_0xa2cc('0x3'));var fs=require('fs');var Redis=require(_0xa2cc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2cc('0x5'));var logger=require(_0xa2cc('0x6'))(_0xa2cc('0x7'));var config=require(_0xa2cc('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa2cc('0x9')]({'port':0x232a});config[_0xa2cc('0xa')]=_['defaults'](config['redis'],{'host':_0xa2cc('0xb'),'port':0x18eb});var socket=require(_0xa2cc('0xc'))(new Redis(config[_0xa2cc('0xa')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x389b95,_0x3d5845,_0x4b1400){return new BPromise(function(_0x530092,_0x2613cd){return client['request'](_0x389b95,_0x4b1400)[_0xa2cc('0xd')](function(_0x5381ec){logger[_0xa2cc('0xe')](_0xa2cc('0xf'),_0x3d5845,_0xa2cc('0x10'));logger['debug'](_0xa2cc('0x11'),_0x3d5845,_0xa2cc('0x10'),JSON[_0xa2cc('0x12')](_0x5381ec));if(_0x5381ec['error']){if(_0x5381ec[_0xa2cc('0x13')]['code']===0x1f4){logger[_0xa2cc('0x13')](_0xa2cc('0xf'),_0x3d5845,_0x5381ec[_0xa2cc('0x13')][_0xa2cc('0x14')]);return _0x2613cd(_0x5381ec['error'][_0xa2cc('0x14')]);}logger[_0xa2cc('0x13')](_0xa2cc('0xf'),_0x3d5845,_0x5381ec[_0xa2cc('0x13')][_0xa2cc('0x14')]);return _0x530092(_0x5381ec[_0xa2cc('0x13')][_0xa2cc('0x14')]);}else{logger['info'](_0xa2cc('0xf'),_0x3d5845,'request\x20sent');_0x530092(_0x5381ec[_0xa2cc('0x15')][_0xa2cc('0x14')]);}})[_0xa2cc('0x16')](function(_0x4df128){logger[_0xa2cc('0x13')]('CmList,\x20%s,\x20%s',_0x3d5845,_0x4df128);_0x2613cd(_0x4df128);});});}