2c27637f937610c067c6311802cf8953b7cd99e4
[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 _0x2428=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2cdf4e,_0x210079){var _0x5a4400=function(_0x297ee3){while(--_0x297ee3){_0x2cdf4e['push'](_0x2cdf4e['shift']());}};_0x5a4400(++_0x210079);}(_0x2428,0x172));var _0x8242=function(_0xdfbbd4,_0x464a05){_0xdfbbd4=_0xdfbbd4-0x0;var _0x33d7a9=_0x2428[_0xdfbbd4];return _0x33d7a9;};'use strict';var _=require(_0x8242('0x0'));var util=require(_0x8242('0x1'));var moment=require(_0x8242('0x2'));var BPromise=require(_0x8242('0x3'));var rs=require(_0x8242('0x4'));var fs=require('fs');var Redis=require(_0x8242('0x5'));var db=require(_0x8242('0x6'))['db'];var utils=require(_0x8242('0x7'));var logger=require(_0x8242('0x8'))(_0x8242('0x9'));var config=require(_0x8242('0xa'));var jayson=require(_0x8242('0xb'));var client=jayson['client'][_0x8242('0xc')]({'port':0x232a});config[_0x8242('0xd')]=_['defaults'](config[_0x8242('0xd')],{'host':_0x8242('0xe'),'port':0x18eb});var socket=require(_0x8242('0xf'))(new Redis(config['redis']));require(_0x8242('0x10'))[_0x8242('0x11')](socket);function respondWithRpcPromise(_0x452c73,_0x227993,_0x508b3f){return new BPromise(function(_0x160c53,_0x28a7ab){return client[_0x8242('0x12')](_0x452c73,_0x508b3f)['then'](function(_0x5bb506){logger[_0x8242('0x13')](_0x8242('0x14'),_0x227993,_0x8242('0x15'));logger['debug'](_0x8242('0x16'),_0x227993,_0x8242('0x15'),JSON[_0x8242('0x17')](_0x5bb506));if(_0x5bb506[_0x8242('0x18')]){if(_0x5bb506['error'][_0x8242('0x19')]===0x1f4){logger['error'](_0x8242('0x14'),_0x227993,_0x5bb506[_0x8242('0x18')]['message']);return _0x28a7ab(_0x5bb506['error'][_0x8242('0x1a')]);}logger['error']('CmList,\x20%s,\x20%s',_0x227993,_0x5bb506[_0x8242('0x18')][_0x8242('0x1a')]);return _0x160c53(_0x5bb506[_0x8242('0x18')][_0x8242('0x1a')]);}else{logger[_0x8242('0x13')](_0x8242('0x14'),_0x227993,'request\x20sent');_0x160c53(_0x5bb506[_0x8242('0x1b')][_0x8242('0x1a')]);}})[_0x8242('0x1c')](function(_0x1e53ad){logger[_0x8242('0x18')](_0x8242('0x14'),_0x227993,_0x1e53ad);_0x28a7ab(_0x1e53ad);});});}