Built motion from commit (unavailable).|2.5.4
[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 _0x0135=['then','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./notification.socket','register','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0135,0xb4));var _0x5013=function(_0x14a75b,_0x2dab7a){_0x14a75b=_0x14a75b-0x0;var _0x826f3b=_0x0135[_0x14a75b];return _0x826f3b;};'use strict';var _=require('lodash');var util=require(_0x5013('0x0'));var moment=require(_0x5013('0x1'));var BPromise=require(_0x5013('0x2'));var rs=require(_0x5013('0x3'));var fs=require('fs');var Redis=require(_0x5013('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5013('0x5'));var logger=require(_0x5013('0x6'))(_0x5013('0x7'));var config=require('../../config/environment');var jayson=require(_0x5013('0x8'));var client=jayson[_0x5013('0x9')][_0x5013('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5013('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5013('0xc'))(new Redis(config[_0x5013('0xb')]));require(_0x5013('0xd'))[_0x5013('0xe')](socket);function respondWithRpcPromise(_0x2a299e,_0x4694fd,_0x5441a4){return new BPromise(function(_0x54fb61,_0x29df6c){return client[_0x5013('0xf')](_0x2a299e,_0x5441a4)[_0x5013('0x10')](function(_0x1f69e4){logger['info'](_0x5013('0x11'),_0x4694fd,'request\x20sent');logger[_0x5013('0x12')](_0x5013('0x13'),_0x4694fd,_0x5013('0x14'),JSON[_0x5013('0x15')](_0x1f69e4));if(_0x1f69e4[_0x5013('0x16')]){if(_0x1f69e4[_0x5013('0x16')][_0x5013('0x17')]===0x1f4){logger[_0x5013('0x16')](_0x5013('0x11'),_0x4694fd,_0x1f69e4[_0x5013('0x16')][_0x5013('0x18')]);return _0x29df6c(_0x1f69e4[_0x5013('0x16')]['message']);}logger['error'](_0x5013('0x11'),_0x4694fd,_0x1f69e4['error'][_0x5013('0x18')]);return _0x54fb61(_0x1f69e4[_0x5013('0x16')][_0x5013('0x18')]);}else{logger[_0x5013('0x19')](_0x5013('0x11'),_0x4694fd,_0x5013('0x14'));_0x54fb61(_0x1f69e4[_0x5013('0x1a')]['message']);}})[_0x5013('0x1b')](function(_0x65189){logger[_0x5013('0x16')](_0x5013('0x11'),_0x4694fd,_0x65189);_0x29df6c(_0x65189);});});}