Built motion from commit (unavailable).|2.5.24
[motion2.git] / server / api / userNotification / userNotification.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 _0x72a5=['result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','localhost','redis','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5b34c0,_0x3ad403){var _0x242bd3=function(_0x51d0ce){while(--_0x51d0ce){_0x5b34c0['push'](_0x5b34c0['shift']());}};_0x242bd3(++_0x3ad403);}(_0x72a5,0x1a6));var _0x572a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x572a('0x0'));var moment=require(_0x572a('0x1'));var BPromise=require(_0x572a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x572a('0x3'))['db'];var utils=require(_0x572a('0x4'));var logger=require(_0x572a('0x5'))('rpc');var config=require(_0x572a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x572a('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x572a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x572a('0x9')]));require(_0x572a('0xa'))[_0x572a('0xb')](socket);function respondWithRpcPromise(_0x37ae90,_0x14c69c,_0x85660e){return new BPromise(function(_0x1d867d,_0x5c2e0c){return client['request'](_0x37ae90,_0x85660e)[_0x572a('0xc')](function(_0xbd35bb){logger[_0x572a('0xd')](_0x572a('0xe'),_0x14c69c,_0x572a('0xf'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x14c69c,_0x572a('0xf'),JSON['stringify'](_0xbd35bb));if(_0xbd35bb[_0x572a('0x10')]){if(_0xbd35bb[_0x572a('0x10')][_0x572a('0x11')]===0x1f4){logger[_0x572a('0x10')]('UserNotification,\x20%s,\x20%s',_0x14c69c,_0xbd35bb[_0x572a('0x10')][_0x572a('0x12')]);return _0x5c2e0c(_0xbd35bb['error']['message']);}logger[_0x572a('0x10')](_0x572a('0xe'),_0x14c69c,_0xbd35bb[_0x572a('0x10')][_0x572a('0x12')]);return _0x1d867d(_0xbd35bb[_0x572a('0x10')][_0x572a('0x12')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x14c69c,_0x572a('0xf'));_0x1d867d(_0xbd35bb[_0x572a('0x13')][_0x572a('0x12')]);}})[_0x572a('0x14')](function(_0x61d91e){logger[_0x572a('0x10')](_0x572a('0xe'),_0x14c69c,_0x61d91e);_0x5c2e0c(_0x61d91e);});});}