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 _0x29f6=['../../mysqldb','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x1c6019,_0x2d117f){var _0x5e58b4=function(_0x404f20){while(--_0x404f20){_0x1c6019['push'](_0x1c6019['shift']());}};_0x5e58b4(++_0x2d117f);}(_0x29f6,0x1b5));var _0x629f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x29f6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x629f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x629f('0x1'));var rs=require(_0x629f('0x2'));var fs=require('fs');var Redis=require(_0x629f('0x3'));var db=require(_0x629f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x629f('0x5'));var config=require('../../config/environment');var jayson=require(_0x629f('0x6'));var client=jayson[_0x629f('0x7')][_0x629f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b94a5,_0x172fba,_0x5d9b17){return new BPromise(function(_0x3e7bb5,_0x22c0a6){return client[_0x629f('0x9')](_0x1b94a5,_0x5d9b17)[_0x629f('0xa')](function(_0x2ab8ff){logger[_0x629f('0xb')]('Automation,\x20%s,\x20%s',_0x172fba,_0x629f('0xc'));logger[_0x629f('0xd')](_0x629f('0xe'),_0x172fba,_0x629f('0xc'),JSON[_0x629f('0xf')](_0x2ab8ff));if(_0x2ab8ff[_0x629f('0x10')]){if(_0x2ab8ff[_0x629f('0x10')][_0x629f('0x11')]===0x1f4){logger['error'](_0x629f('0x12'),_0x172fba,_0x2ab8ff[_0x629f('0x10')]['message']);return _0x22c0a6(_0x2ab8ff[_0x629f('0x10')][_0x629f('0x13')]);}logger['error'](_0x629f('0x12'),_0x172fba,_0x2ab8ff['error'][_0x629f('0x13')]);return _0x3e7bb5(_0x2ab8ff[_0x629f('0x10')]['message']);}else{logger['info'](_0x629f('0x12'),_0x172fba,'request\x20sent');_0x3e7bb5(_0x2ab8ff['result'][_0x629f('0x13')]);}})[_0x629f('0x14')](function(_0x4ec2ed){logger['error']('Automation,\x20%s,\x20%s',_0x172fba,_0x4ec2ed);_0x22c0a6(_0x4ec2ed);});});}