Built motion from commit 538092ac.|2.6.10
[motion2.git] / server / api / userNotification / userNotification.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
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.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x334a=['stringify','error','UserNotification,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','then','info','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x3a4d9c,_0x1e0bd5){var _0x5eae64=function(_0x4f83da){while(--_0x4f83da){_0x3a4d9c['push'](_0x3a4d9c['shift']());}};_0x5eae64(++_0x1e0bd5);}(_0x334a,0x123));var _0xa334=function(_0x5a7226,_0x138e12){_0x5a7226=_0x5a7226-0x0;var _0x4fef07=_0x334a[_0x5a7226];return _0x4fef07;};'use strict';var _=require(_0xa334('0x0'));var util=require(_0xa334('0x1'));var moment=require(_0xa334('0x2'));var BPromise=require(_0xa334('0x3'));var rs=require(_0xa334('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa334('0x5'))['db'];var utils=require(_0xa334('0x6'));var logger=require(_0xa334('0x7'))(_0xa334('0x8'));var config=require(_0xa334('0x9'));var jayson=require(_0xa334('0xa'));var client=jayson[_0xa334('0xb')][_0xa334('0xc')]({'port':0x232a});config[_0xa334('0xd')]=_[_0xa334('0xe')](config[_0xa334('0xd')],{'host':_0xa334('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa334('0xd')]));require(_0xa334('0x10'))['register'](socket);function respondWithRpcPromise(_0x28774a,_0x3b690e,_0x20501d){return new BPromise(function(_0x4c2822,_0x38501f){return client['request'](_0x28774a,_0x20501d)[_0xa334('0x11')](function(_0x103fbe){logger[_0xa334('0x12')]('UserNotification,\x20%s,\x20%s',_0x3b690e,_0xa334('0x13'));logger['debug'](_0xa334('0x14'),_0x3b690e,_0xa334('0x13'),JSON[_0xa334('0x15')](_0x103fbe));if(_0x103fbe['error']){if(_0x103fbe[_0xa334('0x16')]['code']===0x1f4){logger[_0xa334('0x16')](_0xa334('0x17'),_0x3b690e,_0x103fbe[_0xa334('0x16')][_0xa334('0x18')]);return _0x38501f(_0x103fbe['error'][_0xa334('0x18')]);}logger[_0xa334('0x16')](_0xa334('0x17'),_0x3b690e,_0x103fbe['error'][_0xa334('0x18')]);return _0x4c2822(_0x103fbe[_0xa334('0x16')][_0xa334('0x18')]);}else{logger[_0xa334('0x12')](_0xa334('0x17'),_0x3b690e,_0xa334('0x13'));_0x4c2822(_0x103fbe[_0xa334('0x19')][_0xa334('0x18')]);}})['catch'](function(_0x2423a5){logger[_0xa334('0x16')](_0xa334('0x17'),_0x3b690e,_0x2423a5);_0x38501f(_0x2423a5);});});}