f7ddf9b23620e784946f4994caa6d105f8c8711a
[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 _0xa010=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0x4ef826,_0x2e0ac8){var _0x154b8=function(_0x4fae58){while(--_0x4fae58){_0x4ef826['push'](_0x4ef826['shift']());}};_0x154b8(++_0x2e0ac8);}(_0xa010,0x17f));var _0x0a01=function(_0x2c0141,_0x7898a8){_0x2c0141=_0x2c0141-0x0;var _0x5346d6=_0xa010[_0x2c0141];return _0x5346d6;};'use strict';var _=require(_0x0a01('0x0'));var util=require(_0x0a01('0x1'));var moment=require(_0x0a01('0x2'));var BPromise=require(_0x0a01('0x3'));var rs=require(_0x0a01('0x4'));var fs=require('fs');var Redis=require(_0x0a01('0x5'));var db=require(_0x0a01('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a01('0x7'))(_0x0a01('0x8'));var config=require(_0x0a01('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0a01('0xa')][_0x0a01('0xb')]({'port':0x232a});config['redis']=_[_0x0a01('0xc')](config[_0x0a01('0xd')],{'host':_0x0a01('0xe'),'port':0x18eb});var socket=require(_0x0a01('0xf'))(new Redis(config[_0x0a01('0xd')]));require(_0x0a01('0x10'))[_0x0a01('0x11')](socket);function respondWithRpcPromise(_0x5ce558,_0x5cc79b,_0x116219){return new BPromise(function(_0xf25a30,_0x14a199){return client[_0x0a01('0x12')](_0x5ce558,_0x116219)[_0x0a01('0x13')](function(_0x1c333c){logger[_0x0a01('0x14')](_0x0a01('0x15'),_0x5cc79b,_0x0a01('0x16'));logger['debug'](_0x0a01('0x17'),_0x5cc79b,'request\x20sent',JSON[_0x0a01('0x18')](_0x1c333c));if(_0x1c333c['error']){if(_0x1c333c[_0x0a01('0x19')]['code']===0x1f4){logger['error'](_0x0a01('0x15'),_0x5cc79b,_0x1c333c[_0x0a01('0x19')][_0x0a01('0x1a')]);return _0x14a199(_0x1c333c['error']['message']);}logger[_0x0a01('0x19')]('CmList,\x20%s,\x20%s',_0x5cc79b,_0x1c333c['error'][_0x0a01('0x1a')]);return _0xf25a30(_0x1c333c['error'][_0x0a01('0x1a')]);}else{logger[_0x0a01('0x14')]('CmList,\x20%s,\x20%s',_0x5cc79b,_0x0a01('0x16'));_0xf25a30(_0x1c333c[_0x0a01('0x1b')][_0x0a01('0x1a')]);}})[_0x0a01('0x1c')](function(_0x1f5d24){logger[_0x0a01('0x19')](_0x0a01('0x15'),_0x5cc79b,_0x1f5d24);_0x14a199(_0x1f5d24);});});}