e064fd7ef41ba4f87e6e598595fd7d0e134178e2
[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 _0x2ed8=['debug','Notification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent'];(function(_0x4a795c,_0x25327d){var _0x32eea8=function(_0x89f8f1){while(--_0x89f8f1){_0x4a795c['push'](_0x4a795c['shift']());}};_0x32eea8(++_0x25327d);}(_0x2ed8,0x1e7));var _0x82ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ed8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x82ed('0x0'));var util=require(_0x82ed('0x1'));var moment=require(_0x82ed('0x2'));var BPromise=require(_0x82ed('0x3'));var rs=require(_0x82ed('0x4'));var fs=require('fs');var Redis=require(_0x82ed('0x5'));var db=require(_0x82ed('0x6'))['db'];var utils=require(_0x82ed('0x7'));var logger=require(_0x82ed('0x8'))(_0x82ed('0x9'));var config=require(_0x82ed('0xa'));var jayson=require(_0x82ed('0xb'));var client=jayson[_0x82ed('0xc')][_0x82ed('0xd')]({'port':0x232a});config['redis']=_[_0x82ed('0xe')](config[_0x82ed('0xf')],{'host':_0x82ed('0x10'),'port':0x18eb});var socket=require(_0x82ed('0x11'))(new Redis(config[_0x82ed('0xf')]));require(_0x82ed('0x12'))[_0x82ed('0x13')](socket);function respondWithRpcPromise(_0x587e1d,_0x436108,_0x568281){return new BPromise(function(_0x5b32a9,_0x19537d){return client[_0x82ed('0x14')](_0x587e1d,_0x568281)[_0x82ed('0x15')](function(_0x47981b){logger[_0x82ed('0x16')](_0x82ed('0x17'),_0x436108,_0x82ed('0x18'));logger[_0x82ed('0x19')](_0x82ed('0x1a'),_0x436108,_0x82ed('0x18'),JSON['stringify'](_0x47981b));if(_0x47981b[_0x82ed('0x1b')]){if(_0x47981b[_0x82ed('0x1b')][_0x82ed('0x1c')]===0x1f4){logger[_0x82ed('0x1b')]('Notification,\x20%s,\x20%s',_0x436108,_0x47981b[_0x82ed('0x1b')][_0x82ed('0x1d')]);return _0x19537d(_0x47981b[_0x82ed('0x1b')]['message']);}logger[_0x82ed('0x1b')]('Notification,\x20%s,\x20%s',_0x436108,_0x47981b['error'][_0x82ed('0x1d')]);return _0x5b32a9(_0x47981b[_0x82ed('0x1b')]['message']);}else{logger[_0x82ed('0x16')](_0x82ed('0x17'),_0x436108,_0x82ed('0x18'));_0x5b32a9(_0x47981b[_0x82ed('0x1e')]['message']);}})[_0x82ed('0x1f')](function(_0x183c19){logger['error']('Notification,\x20%s,\x20%s',_0x436108,_0x183c19);_0x19537d(_0x183c19);});});}