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 _0x403f=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x34d9d6,_0x181fbe){var _0x307d84=function(_0x538ea4){while(--_0x538ea4){_0x34d9d6['push'](_0x34d9d6['shift']());}};_0x307d84(++_0x181fbe);}(_0x403f,0xe3));var _0xf403=function(_0x2ea601,_0x4c3eaf){_0x2ea601=_0x2ea601-0x0;var _0x24b31c=_0x403f[_0x2ea601];return _0x24b31c;};'use strict';var _=require(_0xf403('0x0'));var util=require(_0xf403('0x1'));var moment=require('moment');var BPromise=require(_0xf403('0x2'));var rs=require(_0xf403('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf403('0x4'))['db'];var utils=require(_0xf403('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf403('0x6'));var jayson=require(_0xf403('0x7'));var client=jayson[_0xf403('0x8')][_0xf403('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15b7af,_0xce5740,_0x47a34d){return new BPromise(function(_0x489415,_0x3270eb){return client[_0xf403('0xa')](_0x15b7af,_0x47a34d)['then'](function(_0x4fc5dc){logger[_0xf403('0xb')](_0xf403('0xc'),_0xce5740,_0xf403('0xd'));logger['debug'](_0xf403('0xe'),_0xce5740,_0xf403('0xd'),JSON[_0xf403('0xf')](_0x4fc5dc));if(_0x4fc5dc['error']){if(_0x4fc5dc[_0xf403('0x10')][_0xf403('0x11')]===0x1f4){logger[_0xf403('0x10')]('ZohoField,\x20%s,\x20%s',_0xce5740,_0x4fc5dc[_0xf403('0x10')][_0xf403('0x12')]);return _0x3270eb(_0x4fc5dc[_0xf403('0x10')][_0xf403('0x12')]);}logger['error'](_0xf403('0xc'),_0xce5740,_0x4fc5dc[_0xf403('0x10')]['message']);return _0x489415(_0x4fc5dc[_0xf403('0x10')][_0xf403('0x12')]);}else{logger[_0xf403('0xb')](_0xf403('0xc'),_0xce5740,_0xf403('0xd'));_0x489415(_0x4fc5dc[_0xf403('0x13')][_0xf403('0x12')]);}})[_0xf403('0x14')](function(_0x27745b){logger[_0xf403('0x10')](_0xf403('0xc'),_0xce5740,_0x27745b);_0x3270eb(_0x27745b);});});}