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 _0xfe99=['../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','CannedAnswer,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x53dc0c,_0x2fc7c9){var _0x1ee17a=function(_0x56b36b){while(--_0x56b36b){_0x53dc0c['push'](_0x53dc0c['shift']());}};_0x1ee17a(++_0x2fc7c9);}(_0xfe99,0xd6));var _0x9fe9=function(_0x2a27a9,_0x13d9a2){_0x2a27a9=_0x2a27a9-0x0;var _0x39e145=_0xfe99[_0x2a27a9];return _0x39e145;};'use strict';var _=require(_0x9fe9('0x0'));var util=require(_0x9fe9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9fe9('0x2'));var fs=require('fs');var Redis=require(_0x9fe9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9fe9('0x4'));var logger=require(_0x9fe9('0x5'))('rpc');var config=require(_0x9fe9('0x6'));var jayson=require(_0x9fe9('0x7'));var client=jayson[_0x9fe9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42c126,_0x52d4b9,_0x394dc0){return new BPromise(function(_0x1dd0fd,_0x982c35){return client[_0x9fe9('0x9')](_0x42c126,_0x394dc0)['then'](function(_0x20f7c9){logger[_0x9fe9('0xa')]('CannedAnswer,\x20%s,\x20%s',_0x52d4b9,_0x9fe9('0xb'));logger[_0x9fe9('0xc')](_0x9fe9('0xd'),_0x52d4b9,'request\x20sent',JSON[_0x9fe9('0xe')](_0x20f7c9));if(_0x20f7c9['error']){if(_0x20f7c9[_0x9fe9('0xf')]['code']===0x1f4){logger[_0x9fe9('0xf')](_0x9fe9('0x10'),_0x52d4b9,_0x20f7c9[_0x9fe9('0xf')]['message']);return _0x982c35(_0x20f7c9[_0x9fe9('0xf')]['message']);}logger[_0x9fe9('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x52d4b9,_0x20f7c9[_0x9fe9('0xf')][_0x9fe9('0x11')]);return _0x1dd0fd(_0x20f7c9[_0x9fe9('0xf')][_0x9fe9('0x11')]);}else{logger[_0x9fe9('0xa')](_0x9fe9('0x10'),_0x52d4b9,'request\x20sent');_0x1dd0fd(_0x20f7c9[_0x9fe9('0x12')][_0x9fe9('0x11')]);}})[_0x9fe9('0x13')](function(_0x476d02){logger[_0x9fe9('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x52d4b9,_0x476d02);_0x982c35(_0x476d02);});});}