Built motion from commit 5b761a7b.|2.5.36
[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 _0x4b92=['UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./userNotification.socket','register','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3b9277,_0x463f10){var _0x16fa13=function(_0x5ae96b){while(--_0x5ae96b){_0x3b9277['push'](_0x3b9277['shift']());}};_0x16fa13(++_0x463f10);}(_0x4b92,0xf9));var _0x24b9=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x4b92[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x24b9('0x0'));var util=require(_0x24b9('0x1'));var moment=require(_0x24b9('0x2'));var BPromise=require(_0x24b9('0x3'));var rs=require(_0x24b9('0x4'));var fs=require('fs');var Redis=require(_0x24b9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x24b9('0x6'));var logger=require(_0x24b9('0x7'))(_0x24b9('0x8'));var config=require(_0x24b9('0x9'));var jayson=require(_0x24b9('0xa'));var client=jayson['client'][_0x24b9('0xb')]({'port':0x232a});config[_0x24b9('0xc')]=_[_0x24b9('0xd')](config[_0x24b9('0xc')],{'host':_0x24b9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24b9('0xc')]));require(_0x24b9('0xf'))[_0x24b9('0x10')](socket);function respondWithRpcPromise(_0x33627b,_0x40f3fd,_0x3273c5){return new BPromise(function(_0x464177,_0x2cbe34){return client['request'](_0x33627b,_0x3273c5)[_0x24b9('0x11')](function(_0x5562d6){logger['info'](_0x24b9('0x12'),_0x40f3fd,_0x24b9('0x13'));logger[_0x24b9('0x14')](_0x24b9('0x15'),_0x40f3fd,_0x24b9('0x13'),JSON['stringify'](_0x5562d6));if(_0x5562d6[_0x24b9('0x16')]){if(_0x5562d6[_0x24b9('0x16')][_0x24b9('0x17')]===0x1f4){logger[_0x24b9('0x16')]('UserNotification,\x20%s,\x20%s',_0x40f3fd,_0x5562d6['error'][_0x24b9('0x18')]);return _0x2cbe34(_0x5562d6[_0x24b9('0x16')][_0x24b9('0x18')]);}logger[_0x24b9('0x16')]('UserNotification,\x20%s,\x20%s',_0x40f3fd,_0x5562d6[_0x24b9('0x16')][_0x24b9('0x18')]);return _0x464177(_0x5562d6[_0x24b9('0x16')][_0x24b9('0x18')]);}else{logger[_0x24b9('0x19')](_0x24b9('0x12'),_0x40f3fd,_0x24b9('0x13'));_0x464177(_0x5562d6[_0x24b9('0x1a')]['message']);}})['catch'](function(_0x49e287){logger[_0x24b9('0x16')](_0x24b9('0x12'),_0x40f3fd,_0x49e287);_0x2cbe34(_0x49e287);});});}