Built motion from commit 10af8726.|2.6.34
[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 _0x7bfc=['error','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xa6e9e7,_0x532212){var _0x276a74=function(_0x4dbcbd){while(--_0x4dbcbd){_0xa6e9e7['push'](_0xa6e9e7['shift']());}};_0x276a74(++_0x532212);}(_0x7bfc,0xb4));var _0xc7bf=function(_0x290972,_0x252280){_0x290972=_0x290972-0x0;var _0x57890e=_0x7bfc[_0x290972];return _0x57890e;};'use strict';var _=require(_0xc7bf('0x0'));var util=require(_0xc7bf('0x1'));var moment=require(_0xc7bf('0x2'));var BPromise=require(_0xc7bf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7bf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc7bf('0x5'));var config=require('../../config/environment');var jayson=require(_0xc7bf('0x6'));var client=jayson[_0xc7bf('0x7')][_0xc7bf('0x8')]({'port':0x232a});config[_0xc7bf('0x9')]=_[_0xc7bf('0xa')](config['redis'],{'host':_0xc7bf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7bf('0x9')]));require(_0xc7bf('0xc'))[_0xc7bf('0xd')](socket);function respondWithRpcPromise(_0x1732f0,_0x35addc,_0x293cb2){return new BPromise(function(_0x5bb023,_0x1ffd48){return client[_0xc7bf('0xe')](_0x1732f0,_0x293cb2)[_0xc7bf('0xf')](function(_0x457873){logger['info'](_0xc7bf('0x10'),_0x35addc,_0xc7bf('0x11'));logger[_0xc7bf('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x35addc,'request\x20sent',JSON[_0xc7bf('0x13')](_0x457873));if(_0x457873['error']){if(_0x457873[_0xc7bf('0x14')]['code']===0x1f4){logger[_0xc7bf('0x14')](_0xc7bf('0x10'),_0x35addc,_0x457873[_0xc7bf('0x14')][_0xc7bf('0x15')]);return _0x1ffd48(_0x457873[_0xc7bf('0x14')][_0xc7bf('0x15')]);}logger['error'](_0xc7bf('0x10'),_0x35addc,_0x457873[_0xc7bf('0x14')][_0xc7bf('0x15')]);return _0x5bb023(_0x457873[_0xc7bf('0x14')][_0xc7bf('0x15')]);}else{logger[_0xc7bf('0x16')](_0xc7bf('0x10'),_0x35addc,_0xc7bf('0x11'));_0x5bb023(_0x457873[_0xc7bf('0x17')][_0xc7bf('0x15')]);}})[_0xc7bf('0x18')](function(_0x500032){logger[_0xc7bf('0x14')](_0xc7bf('0x10'),_0x35addc,_0x500032);_0x1ffd48(_0x500032);});});}