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 _0x853b=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x5ee893,_0x260e68){var _0x79ab0e=function(_0x3581f3){while(--_0x3581f3){_0x5ee893['push'](_0x5ee893['shift']());}};_0x79ab0e(++_0x260e68);}(_0x853b,0xe4));var _0xb853=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x853b[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xb853('0x0'));var util=require('util');var moment=require(_0xb853('0x1'));var BPromise=require(_0xb853('0x2'));var rs=require(_0xb853('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb853('0x4'))(_0xb853('0x5'));var config=require(_0xb853('0x6'));var jayson=require(_0xb853('0x7'));var client=jayson['client'][_0xb853('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2328f3,_0x20f38c,_0x2b709c){return new BPromise(function(_0x3dd0ee,_0x11ae9f){return client[_0xb853('0x9')](_0x2328f3,_0x2b709c)['then'](function(_0x599769){logger[_0xb853('0xa')](_0xb853('0xb'),_0x20f38c,'request\x20sent');logger[_0xb853('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x20f38c,_0xb853('0xd'),JSON[_0xb853('0xe')](_0x599769));if(_0x599769['error']){if(_0x599769[_0xb853('0xf')][_0xb853('0x10')]===0x1f4){logger['error'](_0xb853('0xb'),_0x20f38c,_0x599769[_0xb853('0xf')]['message']);return _0x11ae9f(_0x599769['error'][_0xb853('0x11')]);}logger['error'](_0xb853('0xb'),_0x20f38c,_0x599769[_0xb853('0xf')][_0xb853('0x11')]);return _0x3dd0ee(_0x599769['error'][_0xb853('0x11')]);}else{logger[_0xb853('0xa')](_0xb853('0xb'),_0x20f38c,'request\x20sent');_0x3dd0ee(_0x599769[_0xb853('0x12')][_0xb853('0x11')]);}})[_0xb853('0x13')](function(_0x3751fd){logger[_0xb853('0xf')](_0xb853('0xb'),_0x20f38c,_0x3751fd);_0x11ae9f(_0x3751fd);});});}