78a085e2403ae37b6afdd9d7556910601addbb4f
[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 _0xa85e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2cbde2,_0x94a41b){var _0x59b340=function(_0x4a7ec5){while(--_0x4a7ec5){_0x2cbde2['push'](_0x2cbde2['shift']());}};_0x59b340(++_0x94a41b);}(_0xa85e,0x154));var _0xea85=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0xa85e[_0x26d386];return _0x4ef9a8;};'use strict';var _=require(_0xea85('0x0'));var util=require(_0xea85('0x1'));var moment=require(_0xea85('0x2'));var BPromise=require(_0xea85('0x3'));var rs=require(_0xea85('0x4'));var fs=require('fs');var Redis=require(_0xea85('0x5'));var db=require(_0xea85('0x6'))['db'];var utils=require(_0xea85('0x7'));var logger=require(_0xea85('0x8'))(_0xea85('0x9'));var config=require(_0xea85('0xa'));var jayson=require(_0xea85('0xb'));var client=jayson[_0xea85('0xc')][_0xea85('0xd')]({'port':0x232a});config['redis']=_[_0xea85('0xe')](config[_0xea85('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xea85('0x10'))(new Redis(config[_0xea85('0xf')]));require(_0xea85('0x11'))[_0xea85('0x12')](socket);function respondWithRpcPromise(_0x4f320e,_0xca68b1,_0x2060e9){return new BPromise(function(_0x15a059,_0x4fa78d){return client[_0xea85('0x13')](_0x4f320e,_0x2060e9)['then'](function(_0x23b8fe){logger[_0xea85('0x14')](_0xea85('0x15'),_0xca68b1,_0xea85('0x16'));logger[_0xea85('0x17')](_0xea85('0x18'),_0xca68b1,_0xea85('0x16'),JSON[_0xea85('0x19')](_0x23b8fe));if(_0x23b8fe[_0xea85('0x1a')]){if(_0x23b8fe[_0xea85('0x1a')][_0xea85('0x1b')]===0x1f4){logger[_0xea85('0x1a')](_0xea85('0x15'),_0xca68b1,_0x23b8fe['error'][_0xea85('0x1c')]);return _0x4fa78d(_0x23b8fe['error'][_0xea85('0x1c')]);}logger[_0xea85('0x1a')](_0xea85('0x15'),_0xca68b1,_0x23b8fe[_0xea85('0x1a')]['message']);return _0x15a059(_0x23b8fe[_0xea85('0x1a')][_0xea85('0x1c')]);}else{logger[_0xea85('0x14')](_0xea85('0x15'),_0xca68b1,'request\x20sent');_0x15a059(_0x23b8fe[_0xea85('0x1d')][_0xea85('0x1c')]);}})[_0xea85('0x1e')](function(_0x4baf53){logger[_0xea85('0x1a')](_0xea85('0x15'),_0xca68b1,_0x4baf53);_0x4fa78d(_0x4baf53);});});}