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 _0xe1b7=['code','message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xe1b7,0x1bb));var _0x7e1b=function(_0x428667,_0x27483f){_0x428667=_0x428667-0x0;var _0x58bd18=_0xe1b7[_0x428667];return _0x58bd18;};'use strict';var _=require(_0x7e1b('0x0'));var util=require('util');var moment=require(_0x7e1b('0x1'));var BPromise=require(_0x7e1b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e1b('0x3'))['db'];var utils=require(_0x7e1b('0x4'));var logger=require(_0x7e1b('0x5'))(_0x7e1b('0x6'));var config=require(_0x7e1b('0x7'));var jayson=require(_0x7e1b('0x8'));var client=jayson[_0x7e1b('0x9')][_0x7e1b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46a4e7,_0x3abe2b,_0x217eca){return new BPromise(function(_0x3e5c53,_0x5a47aa){return client[_0x7e1b('0xb')](_0x46a4e7,_0x217eca)[_0x7e1b('0xc')](function(_0x4d9b2e){logger[_0x7e1b('0xd')](_0x7e1b('0xe'),_0x3abe2b,_0x7e1b('0xf'));logger['debug'](_0x7e1b('0x10'),_0x3abe2b,_0x7e1b('0xf'),JSON[_0x7e1b('0x11')](_0x4d9b2e));if(_0x4d9b2e['error']){if(_0x4d9b2e[_0x7e1b('0x12')][_0x7e1b('0x13')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x3abe2b,_0x4d9b2e['error'][_0x7e1b('0x14')]);return _0x5a47aa(_0x4d9b2e[_0x7e1b('0x12')][_0x7e1b('0x14')]);}logger[_0x7e1b('0x12')](_0x7e1b('0xe'),_0x3abe2b,_0x4d9b2e[_0x7e1b('0x12')]['message']);return _0x3e5c53(_0x4d9b2e[_0x7e1b('0x12')][_0x7e1b('0x14')]);}else{logger['info'](_0x7e1b('0xe'),_0x3abe2b,'request\x20sent');_0x3e5c53(_0x4d9b2e[_0x7e1b('0x15')][_0x7e1b('0x14')]);}})['catch'](function(_0xa485e9){logger[_0x7e1b('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3abe2b,_0xa485e9);_0x5a47aa(_0xa485e9);});});}