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 _0x45d8=['request\x20sent','debug','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x45d8,0x11a));var _0x845d=function(_0x366776,_0x48f0bf){_0x366776=_0x366776-0x0;var _0x34e2ad=_0x45d8[_0x366776];return _0x34e2ad;};'use strict';var _=require(_0x845d('0x0'));var util=require('util');var moment=require(_0x845d('0x1'));var BPromise=require(_0x845d('0x2'));var rs=require(_0x845d('0x3'));var fs=require('fs');var Redis=require(_0x845d('0x4'));var db=require(_0x845d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x845d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x845d('0x7'));var client=jayson['client'][_0x845d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bd978,_0x35452a,_0x45df9f){return new BPromise(function(_0x5f0644,_0x5f13ec){return client[_0x845d('0x9')](_0x1bd978,_0x45df9f)[_0x845d('0xa')](function(_0x4ef69f){logger[_0x845d('0xb')]('CmCompany,\x20%s,\x20%s',_0x35452a,_0x845d('0xc'));logger[_0x845d('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x35452a,_0x845d('0xc'),JSON[_0x845d('0xe')](_0x4ef69f));if(_0x4ef69f[_0x845d('0xf')]){if(_0x4ef69f['error'][_0x845d('0x10')]===0x1f4){logger[_0x845d('0xf')](_0x845d('0x11'),_0x35452a,_0x4ef69f[_0x845d('0xf')][_0x845d('0x12')]);return _0x5f13ec(_0x4ef69f['error']['message']);}logger[_0x845d('0xf')](_0x845d('0x11'),_0x35452a,_0x4ef69f[_0x845d('0xf')][_0x845d('0x12')]);return _0x5f0644(_0x4ef69f['error']['message']);}else{logger[_0x845d('0xb')](_0x845d('0x11'),_0x35452a,_0x845d('0xc'));_0x5f0644(_0x4ef69f[_0x845d('0x13')][_0x845d('0x12')]);}})[_0x845d('0x14')](function(_0x557b3f){logger['error'](_0x845d('0x11'),_0x35452a,_0x557b3f);_0x5f13ec(_0x557b3f);});});}