fad79a426e4711eae47bd564c381cdb52df9635d
[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 _0xad97=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x19dd8a,_0x4af545){var _0x6245d3=function(_0x16e70b){while(--_0x16e70b){_0x19dd8a['push'](_0x19dd8a['shift']());}};_0x6245d3(++_0x4af545);}(_0xad97,0x100));var _0x7ad9=function(_0x3a0bc0,_0x54dbfe){_0x3a0bc0=_0x3a0bc0-0x0;var _0x84ad8e=_0xad97[_0x3a0bc0];return _0x84ad8e;};'use strict';var _=require(_0x7ad9('0x0'));var util=require(_0x7ad9('0x1'));var moment=require(_0x7ad9('0x2'));var BPromise=require(_0x7ad9('0x3'));var rs=require(_0x7ad9('0x4'));var fs=require('fs');var Redis=require(_0x7ad9('0x5'));var db=require(_0x7ad9('0x6'))['db'];var utils=require(_0x7ad9('0x7'));var logger=require(_0x7ad9('0x8'))(_0x7ad9('0x9'));var config=require(_0x7ad9('0xa'));var jayson=require(_0x7ad9('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x7ad9('0xc')](config[_0x7ad9('0xd')],{'host':_0x7ad9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7ad9('0xf'))[_0x7ad9('0x10')](socket);function respondWithRpcPromise(_0xbfa695,_0x28950d,_0x4eac4e){return new BPromise(function(_0x528b44,_0x30e872){return client[_0x7ad9('0x11')](_0xbfa695,_0x4eac4e)[_0x7ad9('0x12')](function(_0x459f0d){logger[_0x7ad9('0x13')](_0x7ad9('0x14'),_0x28950d,_0x7ad9('0x15'));logger[_0x7ad9('0x16')](_0x7ad9('0x17'),_0x28950d,'request\x20sent',JSON[_0x7ad9('0x18')](_0x459f0d));if(_0x459f0d[_0x7ad9('0x19')]){if(_0x459f0d[_0x7ad9('0x19')]['code']===0x1f4){logger[_0x7ad9('0x19')]('CmList,\x20%s,\x20%s',_0x28950d,_0x459f0d['error'][_0x7ad9('0x1a')]);return _0x30e872(_0x459f0d[_0x7ad9('0x19')]['message']);}logger['error']('CmList,\x20%s,\x20%s',_0x28950d,_0x459f0d['error'][_0x7ad9('0x1a')]);return _0x528b44(_0x459f0d['error'][_0x7ad9('0x1a')]);}else{logger['info'](_0x7ad9('0x14'),_0x28950d,_0x7ad9('0x15'));_0x528b44(_0x459f0d[_0x7ad9('0x1b')][_0x7ad9('0x1a')]);}})[_0x7ad9('0x1c')](function(_0x4a997f){logger[_0x7ad9('0x19')](_0x7ad9('0x14'),_0x28950d,_0x4a997f);_0x30e872(_0x4a997f);});});}