Built motion from commit (unavailable).|2.5.26
[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 _0x773e=['debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','http','redis','localhost','socket.io-emitter','./userNotification.socket','request','UserNotification,\x20%s,\x20%s','request\x20sent'];(function(_0x27507d,_0x1130c4){var _0x4b87ef=function(_0x3f6f36){while(--_0x3f6f36){_0x27507d['push'](_0x27507d['shift']());}};_0x4b87ef(++_0x1130c4);}(_0x773e,0xd9));var _0xe773=function(_0x2cc303,_0x2c4a2a){_0x2cc303=_0x2cc303-0x0;var _0x82a2ca=_0x773e[_0x2cc303];return _0x82a2ca;};'use strict';var _=require('lodash');var util=require(_0xe773('0x0'));var moment=require(_0xe773('0x1'));var BPromise=require('bluebird');var rs=require(_0xe773('0x2'));var fs=require('fs');var Redis=require(_0xe773('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe773('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe773('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe773('0x6')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe773('0x7')],{'host':_0xe773('0x8'),'port':0x18eb});var socket=require(_0xe773('0x9'))(new Redis(config['redis']));require(_0xe773('0xa'))['register'](socket);function respondWithRpcPromise(_0x49a007,_0x316faa,_0x3cc9df){return new BPromise(function(_0x3d42ba,_0x1ed916){return client[_0xe773('0xb')](_0x49a007,_0x3cc9df)['then'](function(_0x424d11){logger['info'](_0xe773('0xc'),_0x316faa,_0xe773('0xd'));logger[_0xe773('0xe')](_0xe773('0xf'),_0x316faa,'request\x20sent',JSON[_0xe773('0x10')](_0x424d11));if(_0x424d11['error']){if(_0x424d11['error'][_0xe773('0x11')]===0x1f4){logger[_0xe773('0x12')](_0xe773('0xc'),_0x316faa,_0x424d11[_0xe773('0x12')][_0xe773('0x13')]);return _0x1ed916(_0x424d11[_0xe773('0x12')]['message']);}logger['error'](_0xe773('0xc'),_0x316faa,_0x424d11['error'][_0xe773('0x13')]);return _0x3d42ba(_0x424d11[_0xe773('0x12')][_0xe773('0x13')]);}else{logger['info'](_0xe773('0xc'),_0x316faa,_0xe773('0xd'));_0x3d42ba(_0x424d11[_0xe773('0x14')][_0xe773('0x13')]);}})['catch'](function(_0x3115c6){logger['error'](_0xe773('0xc'),_0x316faa,_0x3115c6);_0x1ed916(_0x3115c6);});});}