Built motion from commit (unavailable).|2.5.1
[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 _0xf6c4=['client','http','redis','defaults','socket.io-emitter','./notification.socket','register','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x41ab5c,_0x14800f){var _0xab348=function(_0x46ea20){while(--_0x46ea20){_0x41ab5c['push'](_0x41ab5c['shift']());}};_0xab348(++_0x14800f);}(_0xf6c4,0x1ee));var _0x4f6c=function(_0x371912,_0x4cd2cc){_0x371912=_0x371912-0x0;var _0x4f740d=_0xf6c4[_0x371912];return _0x4f740d;};'use strict';var _=require(_0x4f6c('0x0'));var util=require(_0x4f6c('0x1'));var moment=require(_0x4f6c('0x2'));var BPromise=require(_0x4f6c('0x3'));var rs=require(_0x4f6c('0x4'));var fs=require('fs');var Redis=require(_0x4f6c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4f6c('0x6'))(_0x4f6c('0x7'));var config=require(_0x4f6c('0x8'));var jayson=require(_0x4f6c('0x9'));var client=jayson[_0x4f6c('0xa')][_0x4f6c('0xb')]({'port':0x232a});config[_0x4f6c('0xc')]=_[_0x4f6c('0xd')](config[_0x4f6c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f6c('0xe'))(new Redis(config[_0x4f6c('0xc')]));require(_0x4f6c('0xf'))[_0x4f6c('0x10')](socket);function respondWithRpcPromise(_0x3589c9,_0xf238fe,_0x436453){return new BPromise(function(_0x4ebd8c,_0x119f76){return client['request'](_0x3589c9,_0x436453)[_0x4f6c('0x11')](function(_0x371d22){logger[_0x4f6c('0x12')](_0x4f6c('0x13'),_0xf238fe,_0x4f6c('0x14'));logger[_0x4f6c('0x15')](_0x4f6c('0x16'),_0xf238fe,_0x4f6c('0x14'),JSON['stringify'](_0x371d22));if(_0x371d22[_0x4f6c('0x17')]){if(_0x371d22['error'][_0x4f6c('0x18')]===0x1f4){logger[_0x4f6c('0x17')]('Notification,\x20%s,\x20%s',_0xf238fe,_0x371d22['error'][_0x4f6c('0x19')]);return _0x119f76(_0x371d22[_0x4f6c('0x17')][_0x4f6c('0x19')]);}logger[_0x4f6c('0x17')](_0x4f6c('0x13'),_0xf238fe,_0x371d22['error'][_0x4f6c('0x19')]);return _0x4ebd8c(_0x371d22[_0x4f6c('0x17')][_0x4f6c('0x19')]);}else{logger[_0x4f6c('0x12')](_0x4f6c('0x13'),_0xf238fe,_0x4f6c('0x14'));_0x4ebd8c(_0x371d22[_0x4f6c('0x1a')][_0x4f6c('0x19')]);}})[_0x4f6c('0x1b')](function(_0x36f725){logger[_0x4f6c('0x17')](_0x4f6c('0x13'),_0xf238fe,_0x36f725);_0x119f76(_0x36f725);});});}