Built motion from commit da24aabd.|2.6.20
[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 _0xef08=['then','info','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','UserNotification,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','request'];(function(_0x5184d1,_0x12d323){var _0x1a8857=function(_0x31b75c){while(--_0x31b75c){_0x5184d1['push'](_0x5184d1['shift']());}};_0x1a8857(++_0x12d323);}(_0xef08,0x104));var _0x8ef0=function(_0x55fe92,_0x1dfe8d){_0x55fe92=_0x55fe92-0x0;var _0x2bfae6=_0xef08[_0x55fe92];return _0x2bfae6;};'use strict';var _=require(_0x8ef0('0x0'));var util=require(_0x8ef0('0x1'));var moment=require(_0x8ef0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef0('0x3'))['db'];var utils=require(_0x8ef0('0x4'));var logger=require(_0x8ef0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ef0('0x6')][_0x8ef0('0x7')]({'port':0x232a});config[_0x8ef0('0x8')]=_['defaults'](config['redis'],{'host':_0x8ef0('0x9'),'port':0x18eb});var socket=require(_0x8ef0('0xa'))(new Redis(config[_0x8ef0('0x8')]));require(_0x8ef0('0xb'))['register'](socket);function respondWithRpcPromise(_0xfb0073,_0x4914c6,_0x36cc66){return new BPromise(function(_0x48cb0e,_0x175355){return client[_0x8ef0('0xc')](_0xfb0073,_0x36cc66)[_0x8ef0('0xd')](function(_0x8d86bf){logger[_0x8ef0('0xe')]('UserNotification,\x20%s,\x20%s',_0x4914c6,_0x8ef0('0xf'));logger['debug'](_0x8ef0('0x10'),_0x4914c6,_0x8ef0('0xf'),JSON['stringify'](_0x8d86bf));if(_0x8d86bf[_0x8ef0('0x11')]){if(_0x8d86bf[_0x8ef0('0x11')]['code']===0x1f4){logger[_0x8ef0('0x11')](_0x8ef0('0x12'),_0x4914c6,_0x8d86bf[_0x8ef0('0x11')][_0x8ef0('0x13')]);return _0x175355(_0x8d86bf[_0x8ef0('0x11')][_0x8ef0('0x13')]);}logger[_0x8ef0('0x11')](_0x8ef0('0x12'),_0x4914c6,_0x8d86bf[_0x8ef0('0x11')][_0x8ef0('0x13')]);return _0x48cb0e(_0x8d86bf[_0x8ef0('0x11')][_0x8ef0('0x13')]);}else{logger[_0x8ef0('0xe')](_0x8ef0('0x12'),_0x4914c6,_0x8ef0('0xf'));_0x48cb0e(_0x8d86bf['result']['message']);}})[_0x8ef0('0x14')](function(_0x2bcb1f){logger[_0x8ef0('0x11')]('UserNotification,\x20%s,\x20%s',_0x4914c6,_0x2bcb1f);_0x175355(_0x2bcb1f);});});}