Built motion from commit ac06311e.|2.6.28
[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 _0x8bc2=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','register','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserNotification,\x20%s,\x20%s','message'];(function(_0x134e56,_0x4a1930){var _0x5c98aa=function(_0x204939){while(--_0x204939){_0x134e56['push'](_0x134e56['shift']());}};_0x5c98aa(++_0x4a1930);}(_0x8bc2,0x1e1));var _0x28bc=function(_0x337ad4,_0x115de9){_0x337ad4=_0x337ad4-0x0;var _0x5d1d84=_0x8bc2[_0x337ad4];return _0x5d1d84;};'use strict';var _=require(_0x28bc('0x0'));var util=require(_0x28bc('0x1'));var moment=require(_0x28bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x28bc('0x3'));var fs=require('fs');var Redis=require(_0x28bc('0x4'));var db=require(_0x28bc('0x5'))['db'];var utils=require(_0x28bc('0x6'));var logger=require('../../config/logger')(_0x28bc('0x7'));var config=require('../../config/environment');var jayson=require(_0x28bc('0x8'));var client=jayson['client'][_0x28bc('0x9')]({'port':0x232a});config[_0x28bc('0xa')]=_[_0x28bc('0xb')](config[_0x28bc('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x28bc('0xc'))(new Redis(config[_0x28bc('0xa')]));require('./userNotification.socket')[_0x28bc('0xd')](socket);function respondWithRpcPromise(_0x3c285c,_0x4acfcd,_0x5b6456){return new BPromise(function(_0x2b4125,_0x198ddb){return client['request'](_0x3c285c,_0x5b6456)[_0x28bc('0xe')](function(_0x32b9ac){logger[_0x28bc('0xf')]('UserNotification,\x20%s,\x20%s',_0x4acfcd,'request\x20sent');logger[_0x28bc('0x10')](_0x28bc('0x11'),_0x4acfcd,_0x28bc('0x12'),JSON[_0x28bc('0x13')](_0x32b9ac));if(_0x32b9ac[_0x28bc('0x14')]){if(_0x32b9ac[_0x28bc('0x14')]['code']===0x1f4){logger[_0x28bc('0x14')](_0x28bc('0x15'),_0x4acfcd,_0x32b9ac['error'][_0x28bc('0x16')]);return _0x198ddb(_0x32b9ac[_0x28bc('0x14')][_0x28bc('0x16')]);}logger[_0x28bc('0x14')]('UserNotification,\x20%s,\x20%s',_0x4acfcd,_0x32b9ac[_0x28bc('0x14')][_0x28bc('0x16')]);return _0x2b4125(_0x32b9ac[_0x28bc('0x14')][_0x28bc('0x16')]);}else{logger['info'](_0x28bc('0x15'),_0x4acfcd,_0x28bc('0x12'));_0x2b4125(_0x32b9ac['result'][_0x28bc('0x16')]);}})[_0x28bc('0x17')](function(_0x286b60){logger['error'](_0x28bc('0x15'),_0x4acfcd,_0x286b60);_0x198ddb(_0x286b60);});});}