Built motion from commit (unavailable).|2.5.2
[motion2.git] / server / api / notification / notification.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 _0x02f1=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./notification.socket','register','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ebc6c,_0x58a00b){var _0x3a826d=function(_0x27d7eb){while(--_0x27d7eb){_0x1ebc6c['push'](_0x1ebc6c['shift']());}};_0x3a826d(++_0x58a00b);}(_0x02f1,0x172));var _0x102f=function(_0x16c8f0,_0x3b5bc2){_0x16c8f0=_0x16c8f0-0x0;var _0x314930=_0x02f1[_0x16c8f0];return _0x314930;};'use strict';var _=require(_0x102f('0x0'));var util=require('util');var moment=require(_0x102f('0x1'));var BPromise=require(_0x102f('0x2'));var rs=require(_0x102f('0x3'));var fs=require('fs');var Redis=require(_0x102f('0x4'));var db=require(_0x102f('0x5'))['db'];var utils=require(_0x102f('0x6'));var logger=require(_0x102f('0x7'))('rpc');var config=require(_0x102f('0x8'));var jayson=require(_0x102f('0x9'));var client=jayson[_0x102f('0xa')][_0x102f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x102f('0xc')],{'host':_0x102f('0xd'),'port':0x18eb});var socket=require(_0x102f('0xe'))(new Redis(config['redis']));require(_0x102f('0xf'))[_0x102f('0x10')](socket);function respondWithRpcPromise(_0x3ae1bc,_0x2788dd,_0xecdef6){return new BPromise(function(_0x13d50d,_0x55848a){return client['request'](_0x3ae1bc,_0xecdef6)[_0x102f('0x11')](function(_0x2da36e){logger[_0x102f('0x12')](_0x102f('0x13'),_0x2788dd,_0x102f('0x14'));logger[_0x102f('0x15')]('Notification,\x20%s,\x20%s,\x20%s',_0x2788dd,_0x102f('0x14'),JSON[_0x102f('0x16')](_0x2da36e));if(_0x2da36e[_0x102f('0x17')]){if(_0x2da36e[_0x102f('0x17')][_0x102f('0x18')]===0x1f4){logger[_0x102f('0x17')]('Notification,\x20%s,\x20%s',_0x2788dd,_0x2da36e[_0x102f('0x17')][_0x102f('0x19')]);return _0x55848a(_0x2da36e[_0x102f('0x17')][_0x102f('0x19')]);}logger[_0x102f('0x17')]('Notification,\x20%s,\x20%s',_0x2788dd,_0x2da36e[_0x102f('0x17')]['message']);return _0x13d50d(_0x2da36e[_0x102f('0x17')]['message']);}else{logger[_0x102f('0x12')](_0x102f('0x13'),_0x2788dd,_0x102f('0x14'));_0x13d50d(_0x2da36e[_0x102f('0x1a')][_0x102f('0x19')]);}})[_0x102f('0x1b')](function(_0x450475){logger[_0x102f('0x17')](_0x102f('0x13'),_0x2788dd,_0x450475);_0x55848a(_0x450475);});});}