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 _0x4142=['stringify','error','code','message','ChatApplication,\x20%s,\x20%s','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4142,0x1f4));var _0x2414=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4142[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2414('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2414('0x1'));var db=require(_0x2414('0x2'))['db'];var utils=require(_0x2414('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x2414('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x2414('0x5')][_0x2414('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x58895f,_0x321050,_0x50c5ad){return new BPromise(function(_0x43a54f,_0x36e886){return client[_0x2414('0x7')](_0x58895f,_0x50c5ad)[_0x2414('0x8')](function(_0x3d6b06){logger[_0x2414('0x9')]('ChatApplication,\x20%s,\x20%s',_0x321050,_0x2414('0xa'));logger[_0x2414('0xb')](_0x2414('0xc'),_0x321050,'request\x20sent',JSON[_0x2414('0xd')](_0x3d6b06));if(_0x3d6b06[_0x2414('0xe')]){if(_0x3d6b06[_0x2414('0xe')][_0x2414('0xf')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x321050,_0x3d6b06[_0x2414('0xe')][_0x2414('0x10')]);return _0x36e886(_0x3d6b06[_0x2414('0xe')]['message']);}logger[_0x2414('0xe')]('ChatApplication,\x20%s,\x20%s',_0x321050,_0x3d6b06[_0x2414('0xe')]['message']);return _0x43a54f(_0x3d6b06['error'][_0x2414('0x10')]);}else{logger[_0x2414('0x9')](_0x2414('0x11'),_0x321050,'request\x20sent');_0x43a54f(_0x3d6b06['result']['message']);}})[_0x2414('0x12')](function(_0x8cca88){logger['error'](_0x2414('0x11'),_0x321050,_0x8cca88);_0x36e886(_0x8cca88);});});}