2b030e986674ce0bb282a8c70a47233e77be39cd
[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 _0x751a=['register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter'];(function(_0x59c1b8,_0x251576){var _0x202875=function(_0x424b25){while(--_0x424b25){_0x59c1b8['push'](_0x59c1b8['shift']());}};_0x202875(++_0x251576);}(_0x751a,0xe4));var _0xa751=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x751a[_0x368e09];return _0x14b7df;};'use strict';var _=require(_0xa751('0x0'));var util=require(_0xa751('0x1'));var moment=require(_0xa751('0x2'));var BPromise=require('bluebird');var rs=require(_0xa751('0x3'));var fs=require('fs');var Redis=require(_0xa751('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa751('0x5'));var logger=require(_0xa751('0x6'))(_0xa751('0x7'));var config=require(_0xa751('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa751('0x9')]['http']({'port':0x232a});config[_0xa751('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa751('0xb'))(new Redis(config['redis']));require('./cmList.socket')[_0xa751('0xc')](socket);function respondWithRpcPromise(_0x10480f,_0x4bc5a5,_0xf1de21){return new BPromise(function(_0x43cefc,_0x5e4cb0){return client[_0xa751('0xd')](_0x10480f,_0xf1de21)[_0xa751('0xe')](function(_0x80bf73){logger['info'](_0xa751('0xf'),_0x4bc5a5,_0xa751('0x10'));logger[_0xa751('0x11')](_0xa751('0x12'),_0x4bc5a5,_0xa751('0x10'),JSON[_0xa751('0x13')](_0x80bf73));if(_0x80bf73[_0xa751('0x14')]){if(_0x80bf73[_0xa751('0x14')]['code']===0x1f4){logger[_0xa751('0x14')](_0xa751('0xf'),_0x4bc5a5,_0x80bf73[_0xa751('0x14')]['message']);return _0x5e4cb0(_0x80bf73[_0xa751('0x14')][_0xa751('0x15')]);}logger[_0xa751('0x14')](_0xa751('0xf'),_0x4bc5a5,_0x80bf73['error'][_0xa751('0x15')]);return _0x43cefc(_0x80bf73[_0xa751('0x14')][_0xa751('0x15')]);}else{logger[_0xa751('0x16')]('CmList,\x20%s,\x20%s',_0x4bc5a5,'request\x20sent');_0x43cefc(_0x80bf73[_0xa751('0x17')][_0xa751('0x15')]);}})['catch'](function(_0x22098e){logger[_0xa751('0x14')](_0xa751('0xf'),_0x4bc5a5,_0x22098e);_0x5e4cb0(_0x22098e);});});}