Built motion from commit (unavailable).|2.5.0
[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 _0xf1a1=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','info','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Notification,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xf1a1,0x1cb));var _0x1f1a=function(_0xd5ba4e,_0x5ebd34){_0xd5ba4e=_0xd5ba4e-0x0;var _0x52d47f=_0xf1a1[_0xd5ba4e];return _0x52d47f;};'use strict';var _=require(_0x1f1a('0x0'));var util=require(_0x1f1a('0x1'));var moment=require(_0x1f1a('0x2'));var BPromise=require(_0x1f1a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f1a('0x4'));var db=require(_0x1f1a('0x5'))['db'];var utils=require(_0x1f1a('0x6'));var logger=require(_0x1f1a('0x7'))('rpc');var config=require(_0x1f1a('0x8'));var jayson=require(_0x1f1a('0x9'));var client=jayson[_0x1f1a('0xa')][_0x1f1a('0xb')]({'port':0x232a});config[_0x1f1a('0xc')]=_[_0x1f1a('0xd')](config[_0x1f1a('0xc')],{'host':_0x1f1a('0xe'),'port':0x18eb});var socket=require(_0x1f1a('0xf'))(new Redis(config['redis']));require(_0x1f1a('0x10'))[_0x1f1a('0x11')](socket);function respondWithRpcPromise(_0x194802,_0x214178,_0x38f871){return new BPromise(function(_0x47fea9,_0x1995d0){return client[_0x1f1a('0x12')](_0x194802,_0x38f871)['then'](function(_0x11d9dc){logger[_0x1f1a('0x13')]('Notification,\x20%s,\x20%s',_0x214178,'request\x20sent');logger[_0x1f1a('0x14')](_0x1f1a('0x15'),_0x214178,_0x1f1a('0x16'),JSON[_0x1f1a('0x17')](_0x11d9dc));if(_0x11d9dc['error']){if(_0x11d9dc[_0x1f1a('0x18')][_0x1f1a('0x19')]===0x1f4){logger[_0x1f1a('0x18')](_0x1f1a('0x1a'),_0x214178,_0x11d9dc[_0x1f1a('0x18')][_0x1f1a('0x1b')]);return _0x1995d0(_0x11d9dc[_0x1f1a('0x18')]['message']);}logger[_0x1f1a('0x18')]('Notification,\x20%s,\x20%s',_0x214178,_0x11d9dc[_0x1f1a('0x18')][_0x1f1a('0x1b')]);return _0x47fea9(_0x11d9dc[_0x1f1a('0x18')][_0x1f1a('0x1b')]);}else{logger[_0x1f1a('0x13')](_0x1f1a('0x1a'),_0x214178,_0x1f1a('0x16'));_0x47fea9(_0x11d9dc[_0x1f1a('0x1c')]['message']);}})['catch'](function(_0x1ce8cc){logger[_0x1f1a('0x18')](_0x1f1a('0x1a'),_0x214178,_0x1ce8cc);_0x1995d0(_0x1ce8cc);});});}