Built motion from commit (unavailable).|2.5.27
[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 _0x790f=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x790f,0xdf));var _0xf790=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0x790f[_0x32c012];return _0x48562e;};'use strict';var _=require('lodash');var util=require(_0xf790('0x0'));var moment=require(_0xf790('0x1'));var BPromise=require('bluebird');var rs=require(_0xf790('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf790('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf790('0x4'))(_0xf790('0x5'));var config=require(_0xf790('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf790('0x7')]({'port':0x232a});config[_0xf790('0x8')]=_[_0xf790('0x9')](config[_0xf790('0x8')],{'host':_0xf790('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf790('0x8')]));require(_0xf790('0xb'))[_0xf790('0xc')](socket);function respondWithRpcPromise(_0x3d5fcd,_0x391480,_0x2a6428){return new BPromise(function(_0x239620,_0x1bfea1){return client[_0xf790('0xd')](_0x3d5fcd,_0x2a6428)['then'](function(_0x11a7e9){logger[_0xf790('0xe')](_0xf790('0xf'),_0x391480,'request\x20sent');logger[_0xf790('0x10')](_0xf790('0x11'),_0x391480,_0xf790('0x12'),JSON[_0xf790('0x13')](_0x11a7e9));if(_0x11a7e9['error']){if(_0x11a7e9[_0xf790('0x14')][_0xf790('0x15')]===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x391480,_0x11a7e9[_0xf790('0x14')][_0xf790('0x16')]);return _0x1bfea1(_0x11a7e9[_0xf790('0x14')]['message']);}logger[_0xf790('0x14')](_0xf790('0xf'),_0x391480,_0x11a7e9[_0xf790('0x14')][_0xf790('0x16')]);return _0x239620(_0x11a7e9[_0xf790('0x14')]['message']);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x391480,_0xf790('0x12'));_0x239620(_0x11a7e9[_0xf790('0x17')][_0xf790('0x16')]);}})[_0xf790('0x18')](function(_0x422818){logger[_0xf790('0x14')]('UserNotification,\x20%s,\x20%s',_0x391480,_0x422818);_0x1bfea1(_0x422818);});});}