Built motion from commit 994c64e1.|2.6.1
[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 _0xbd0e=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','http','defaults','redis','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x18f516,_0x5c154a){var _0x35f825=function(_0x1e8176){while(--_0x1e8176){_0x18f516['push'](_0x18f516['shift']());}};_0x35f825(++_0x5c154a);}(_0xbd0e,0xf3));var _0xebd0=function(_0x2b7fd3,_0x17556d){_0x2b7fd3=_0x2b7fd3-0x0;var _0x1bd260=_0xbd0e[_0x2b7fd3];return _0x1bd260;};'use strict';var _=require(_0xebd0('0x0'));var util=require(_0xebd0('0x1'));var moment=require(_0xebd0('0x2'));var BPromise=require(_0xebd0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebd0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xebd0('0x5'));var logger=require('../../config/logger')(_0xebd0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xebd0('0x7')]({'port':0x232a});config['redis']=_[_0xebd0('0x8')](config[_0xebd0('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebd0('0x9')]));require(_0xebd0('0xa'))[_0xebd0('0xb')](socket);function respondWithRpcPromise(_0x4c83b5,_0x265c9d,_0x17b7a3){return new BPromise(function(_0x456265,_0x4d0d36){return client[_0xebd0('0xc')](_0x4c83b5,_0x17b7a3)[_0xebd0('0xd')](function(_0x4e9b7c){logger['info'](_0xebd0('0xe'),_0x265c9d,_0xebd0('0xf'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x265c9d,_0xebd0('0xf'),JSON[_0xebd0('0x10')](_0x4e9b7c));if(_0x4e9b7c[_0xebd0('0x11')]){if(_0x4e9b7c[_0xebd0('0x11')][_0xebd0('0x12')]===0x1f4){logger['error'](_0xebd0('0xe'),_0x265c9d,_0x4e9b7c[_0xebd0('0x11')][_0xebd0('0x13')]);return _0x4d0d36(_0x4e9b7c['error'][_0xebd0('0x13')]);}logger[_0xebd0('0x11')](_0xebd0('0xe'),_0x265c9d,_0x4e9b7c[_0xebd0('0x11')][_0xebd0('0x13')]);return _0x456265(_0x4e9b7c['error'][_0xebd0('0x13')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x265c9d,_0xebd0('0xf'));_0x456265(_0x4e9b7c[_0xebd0('0x14')]['message']);}})[_0xebd0('0x15')](function(_0x4b31f9){logger[_0xebd0('0x11')](_0xebd0('0xe'),_0x265c9d,_0x4b31f9);_0x4d0d36(_0x4b31f9);});});}