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 _0xf334=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x2eae80,_0x481d0b){var _0x48ca71=function(_0xd17f32){while(--_0xd17f32){_0x2eae80['push'](_0x2eae80['shift']());}};_0x48ca71(++_0x481d0b);}(_0xf334,0x7e));var _0x4f33=function(_0x27cb2a,_0x25e011){_0x27cb2a=_0x27cb2a-0x0;var _0x5e85c6=_0xf334[_0x27cb2a];return _0x5e85c6;};'use strict';var _=require('lodash');var util=require(_0x4f33('0x0'));var moment=require('moment');var BPromise=require(_0x4f33('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f33('0x2'))['db'];var utils=require(_0x4f33('0x3'));var logger=require(_0x4f33('0x4'))('rpc');var config=require(_0x4f33('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4f33('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aee45,_0xcf13df,_0x598ba9){return new BPromise(function(_0x3b6a78,_0x4a282b){return client[_0x4f33('0x7')](_0x2aee45,_0x598ba9)[_0x4f33('0x8')](function(_0x571f0b){logger['info'](_0x4f33('0x9'),_0xcf13df,_0x4f33('0xa'));logger[_0x4f33('0xb')](_0x4f33('0xc'),_0xcf13df,_0x4f33('0xa'),JSON[_0x4f33('0xd')](_0x571f0b));if(_0x571f0b[_0x4f33('0xe')]){if(_0x571f0b[_0x4f33('0xe')]['code']===0x1f4){logger[_0x4f33('0xe')]('ChatApplication,\x20%s,\x20%s',_0xcf13df,_0x571f0b[_0x4f33('0xe')]['message']);return _0x4a282b(_0x571f0b['error'][_0x4f33('0xf')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0xcf13df,_0x571f0b[_0x4f33('0xe')][_0x4f33('0xf')]);return _0x3b6a78(_0x571f0b[_0x4f33('0xe')][_0x4f33('0xf')]);}else{logger['info'](_0x4f33('0x9'),_0xcf13df,_0x4f33('0xa'));_0x3b6a78(_0x571f0b[_0x4f33('0x10')][_0x4f33('0xf')]);}})[_0x4f33('0x11')](function(_0x1c69de){logger[_0x4f33('0xe')](_0x4f33('0x9'),_0xcf13df,_0x1c69de);_0x4a282b(_0x1c69de);});});}