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 _0x3325=['bluebird','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x3325,0x9d));var _0x5332=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0x3325[_0x59f0dc];return _0x5b5445;};'use strict';var _=require(_0x5332('0x0'));var util=require(_0x5332('0x1'));var moment=require(_0x5332('0x2'));var BPromise=require(_0x5332('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5332('0x4'))('rpc');var config=require(_0x5332('0x5'));var jayson=require(_0x5332('0x6'));var client=jayson[_0x5332('0x7')][_0x5332('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21f586,_0x40ffeb,_0x4dc8ae){return new BPromise(function(_0x49d4b1,_0x261d9c){return client['request'](_0x21f586,_0x4dc8ae)[_0x5332('0x9')](function(_0x1b8e01){logger[_0x5332('0xa')](_0x5332('0xb'),_0x40ffeb,_0x5332('0xc'));logger['debug'](_0x5332('0xd'),_0x40ffeb,_0x5332('0xc'),JSON[_0x5332('0xe')](_0x1b8e01));if(_0x1b8e01['error']){if(_0x1b8e01[_0x5332('0xf')][_0x5332('0x10')]===0x1f4){logger[_0x5332('0xf')](_0x5332('0xb'),_0x40ffeb,_0x1b8e01[_0x5332('0xf')][_0x5332('0x11')]);return _0x261d9c(_0x1b8e01[_0x5332('0xf')][_0x5332('0x11')]);}logger['error'](_0x5332('0xb'),_0x40ffeb,_0x1b8e01[_0x5332('0xf')][_0x5332('0x11')]);return _0x49d4b1(_0x1b8e01['error'][_0x5332('0x11')]);}else{logger['info'](_0x5332('0xb'),_0x40ffeb,_0x5332('0xc'));_0x49d4b1(_0x1b8e01[_0x5332('0x12')][_0x5332('0x11')]);}})[_0x5332('0x13')](function(_0x5e1cff){logger[_0x5332('0xf')](_0x5332('0xb'),_0x40ffeb,_0x5e1cff);_0x261d9c(_0x5e1cff);});});}