1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0xb732=['randomstring','../../config/environment','jayson/promise','client','http','request','then','info','debug','stringify','error','code','CmCompany,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird'];(function(_0x19a58a,_0xf539d5){var _0x1df6f4=function(_0x2abdaf){while(--_0x2abdaf){_0x19a58a['push'](_0x19a58a['shift']());}};_0x1df6f4(++_0xf539d5);}(_0xb732,0x1c8));var _0x2b73=function(_0x531722,_0x161aa9){_0x531722=_0x531722-0x0;var _0x3f1769=_0xb732[_0x531722];return _0x3f1769;};'use strict';var _=require(_0x2b73('0x0'));var util=require(_0x2b73('0x1'));var moment=require(_0x2b73('0x2'));var BPromise=require(_0x2b73('0x3'));var rs=require(_0x2b73('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2b73('0x5'));var jayson=require(_0x2b73('0x6'));var client=jayson[_0x2b73('0x7')][_0x2b73('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ee0b0,_0x12f95c,_0x188205){return new BPromise(function(_0xd25c8a,_0x2db598){return client[_0x2b73('0x9')](_0x1ee0b0,_0x188205)[_0x2b73('0xa')](function(_0x467af7){logger[_0x2b73('0xb')]('CmCompany,\x20%s,\x20%s',_0x12f95c,'request\x20sent');logger[_0x2b73('0xc')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x12f95c,'request\x20sent',JSON[_0x2b73('0xd')](_0x467af7));if(_0x467af7['error']){if(_0x467af7[_0x2b73('0xe')][_0x2b73('0xf')]===0x1f4){logger[_0x2b73('0xe')](_0x2b73('0x10'),_0x12f95c,_0x467af7[_0x2b73('0xe')][_0x2b73('0x11')]);return _0x2db598(_0x467af7['error'][_0x2b73('0x11')]);}logger[_0x2b73('0xe')]('CmCompany,\x20%s,\x20%s',_0x12f95c,_0x467af7[_0x2b73('0xe')]['message']);return _0xd25c8a(_0x467af7[_0x2b73('0xe')]['message']);}else{logger[_0x2b73('0xb')]('CmCompany,\x20%s,\x20%s',_0x12f95c,_0x2b73('0x12'));_0xd25c8a(_0x467af7[_0x2b73('0x13')][_0x2b73('0x11')]);}})['catch'](function(_0xaedae3){logger[_0x2b73('0xe')](_0x2b73('0x10'),_0x12f95c,_0xaedae3);_0x2db598(_0xaedae3);});});}