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 _0xd504=['UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','info'];(function(_0x573972,_0x308c5f){var _0x3b012b=function(_0x403755){while(--_0x403755){_0x573972['push'](_0x573972['shift']());}};_0x3b012b(++_0x308c5f);}(_0xd504,0x6d));var _0x4d50=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xd504[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x4d50('0x0'));var util=require(_0x4d50('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d50('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d50('0x3'))['db'];var utils=require(_0x4d50('0x4'));var logger=require(_0x4d50('0x5'))(_0x4d50('0x6'));var config=require(_0x4d50('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4d50('0x8')][_0x4d50('0x9')]({'port':0x232a});config['redis']=_[_0x4d50('0xa')](config[_0x4d50('0xb')],{'host':_0x4d50('0xc'),'port':0x18eb});var socket=require(_0x4d50('0xd'))(new Redis(config[_0x4d50('0xb')]));require(_0x4d50('0xe'))['register'](socket);function respondWithRpcPromise(_0x39fa09,_0x1b55a7,_0x2448b0){return new BPromise(function(_0x3cb6f9,_0x17ac91){return client['request'](_0x39fa09,_0x2448b0)['then'](function(_0x23a545){logger[_0x4d50('0xf')](_0x4d50('0x10'),_0x1b55a7,_0x4d50('0x11'));logger['debug'](_0x4d50('0x12'),_0x1b55a7,_0x4d50('0x11'),JSON[_0x4d50('0x13')](_0x23a545));if(_0x23a545[_0x4d50('0x14')]){if(_0x23a545[_0x4d50('0x14')][_0x4d50('0x15')]===0x1f4){logger[_0x4d50('0x14')](_0x4d50('0x10'),_0x1b55a7,_0x23a545[_0x4d50('0x14')]['message']);return _0x17ac91(_0x23a545[_0x4d50('0x14')][_0x4d50('0x16')]);}logger['error'](_0x4d50('0x10'),_0x1b55a7,_0x23a545['error'][_0x4d50('0x16')]);return _0x3cb6f9(_0x23a545['error'][_0x4d50('0x16')]);}else{logger[_0x4d50('0xf')](_0x4d50('0x10'),_0x1b55a7,'request\x20sent');_0x3cb6f9(_0x23a545[_0x4d50('0x17')][_0x4d50('0x16')]);}})[_0x4d50('0x18')](function(_0x4f5e33){logger[_0x4d50('0x14')](_0x4d50('0x10'),_0x1b55a7,_0x4f5e33);_0x17ac91(_0x4f5e33);});});}