b1a2af7ee860d72c1a3e1a26741b130c5f6508f9
[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 _0x96a4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','CmList,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x179617,_0xa265d1){var _0x5c8714=function(_0x47ce13){while(--_0x47ce13){_0x179617['push'](_0x179617['shift']());}};_0x5c8714(++_0xa265d1);}(_0x96a4,0x13c));var _0x496a=function(_0x59811a,_0x521166){_0x59811a=_0x59811a-0x0;var _0x172f4a=_0x96a4[_0x59811a];return _0x172f4a;};'use strict';var _=require(_0x496a('0x0'));var util=require(_0x496a('0x1'));var moment=require(_0x496a('0x2'));var BPromise=require(_0x496a('0x3'));var rs=require(_0x496a('0x4'));var fs=require('fs');var Redis=require(_0x496a('0x5'));var db=require(_0x496a('0x6'))['db'];var utils=require(_0x496a('0x7'));var logger=require(_0x496a('0x8'))(_0x496a('0x9'));var config=require(_0x496a('0xa'));var jayson=require(_0x496a('0xb'));var client=jayson[_0x496a('0xc')][_0x496a('0xd')]({'port':0x232a});config['redis']=_[_0x496a('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x496a('0xf'))(new Redis(config[_0x496a('0x10')]));require(_0x496a('0x11'))[_0x496a('0x12')](socket);function respondWithRpcPromise(_0x4ffcb2,_0x22cd8b,_0xb74d1d){return new BPromise(function(_0x3c93fc,_0x1c94ae){return client[_0x496a('0x13')](_0x4ffcb2,_0xb74d1d)[_0x496a('0x14')](function(_0x48e2a6){logger[_0x496a('0x15')]('CmList,\x20%s,\x20%s',_0x22cd8b,_0x496a('0x16'));logger[_0x496a('0x17')](_0x496a('0x18'),_0x22cd8b,_0x496a('0x16'),JSON['stringify'](_0x48e2a6));if(_0x48e2a6[_0x496a('0x19')]){if(_0x48e2a6[_0x496a('0x19')]['code']===0x1f4){logger[_0x496a('0x19')](_0x496a('0x1a'),_0x22cd8b,_0x48e2a6[_0x496a('0x19')][_0x496a('0x1b')]);return _0x1c94ae(_0x48e2a6[_0x496a('0x19')][_0x496a('0x1b')]);}logger['error']('CmList,\x20%s,\x20%s',_0x22cd8b,_0x48e2a6[_0x496a('0x19')][_0x496a('0x1b')]);return _0x3c93fc(_0x48e2a6['error'][_0x496a('0x1b')]);}else{logger[_0x496a('0x15')](_0x496a('0x1a'),_0x22cd8b,_0x496a('0x16'));_0x3c93fc(_0x48e2a6[_0x496a('0x1c')][_0x496a('0x1b')]);}})['catch'](function(_0x4b060d){logger['error']('CmList,\x20%s,\x20%s',_0x22cd8b,_0x4b060d);_0x1c94ae(_0x4b060d);});});}