3aeac5aa086bbea7b5f1a9279a1276bfd540a260
[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 _0xedc8=['error','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0xedc8,0x8c));var _0x8edc=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xedc8[_0x172747];return _0x509692;};'use strict';var _=require(_0x8edc('0x0'));var util=require(_0x8edc('0x1'));var moment=require('moment');var BPromise=require(_0x8edc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8edc('0x3'));var db=require(_0x8edc('0x4'))['db'];var utils=require(_0x8edc('0x5'));var logger=require(_0x8edc('0x6'))(_0x8edc('0x7'));var config=require('../../config/environment');var jayson=require(_0x8edc('0x8'));var client=jayson['client'][_0x8edc('0x9')]({'port':0x232a});config['redis']=_[_0x8edc('0xa')](config[_0x8edc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8edc('0xc'))(new Redis(config[_0x8edc('0xb')]));require(_0x8edc('0xd'))[_0x8edc('0xe')](socket);function respondWithRpcPromise(_0x135529,_0x96f4ab,_0x6a7800){return new BPromise(function(_0x141961,_0x24a912){return client[_0x8edc('0xf')](_0x135529,_0x6a7800)[_0x8edc('0x10')](function(_0x677cfe){logger['info'](_0x8edc('0x11'),_0x96f4ab,'request\x20sent');logger[_0x8edc('0x12')](_0x8edc('0x13'),_0x96f4ab,_0x8edc('0x14'),JSON[_0x8edc('0x15')](_0x677cfe));if(_0x677cfe['error']){if(_0x677cfe[_0x8edc('0x16')]['code']===0x1f4){logger[_0x8edc('0x16')](_0x8edc('0x11'),_0x96f4ab,_0x677cfe[_0x8edc('0x16')][_0x8edc('0x17')]);return _0x24a912(_0x677cfe[_0x8edc('0x16')]['message']);}logger[_0x8edc('0x16')]('CmList,\x20%s,\x20%s',_0x96f4ab,_0x677cfe[_0x8edc('0x16')][_0x8edc('0x17')]);return _0x141961(_0x677cfe[_0x8edc('0x16')][_0x8edc('0x17')]);}else{logger[_0x8edc('0x18')](_0x8edc('0x11'),_0x96f4ab,_0x8edc('0x14'));_0x141961(_0x677cfe[_0x8edc('0x19')][_0x8edc('0x17')]);}})[_0x8edc('0x1a')](function(_0x1378b7){logger['error'](_0x8edc('0x11'),_0x96f4ab,_0x1378b7);_0x24a912(_0x1378b7);});});}