Built motion from commit 14588770.|2.5.38
[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 _0x24ef=['code','message','info','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','register','request','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0x24ef,0x124));var _0xf24e=function(_0x3be244,_0x8d6c7e){_0x3be244=_0x3be244-0x0;var _0x256e64=_0x24ef[_0x3be244];return _0x256e64;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf24e('0x0'));var rs=require(_0xf24e('0x1'));var fs=require('fs');var Redis=require(_0xf24e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf24e('0x3'));var logger=require(_0xf24e('0x4'))(_0xf24e('0x5'));var config=require(_0xf24e('0x6'));var jayson=require(_0xf24e('0x7'));var client=jayson[_0xf24e('0x8')]['http']({'port':0x232a});config['redis']=_[_0xf24e('0x9')](config[_0xf24e('0xa')],{'host':_0xf24e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf24e('0xa')]));require('./userNotification.socket')[_0xf24e('0xc')](socket);function respondWithRpcPromise(_0x22d4b2,_0x3d85e8,_0x854917){return new BPromise(function(_0x1e8953,_0x58516f){return client[_0xf24e('0xd')](_0x22d4b2,_0x854917)['then'](function(_0x45f086){logger['info'](_0xf24e('0xe'),_0x3d85e8,_0xf24e('0xf'));logger[_0xf24e('0x10')](_0xf24e('0x11'),_0x3d85e8,_0xf24e('0xf'),JSON[_0xf24e('0x12')](_0x45f086));if(_0x45f086[_0xf24e('0x13')]){if(_0x45f086[_0xf24e('0x13')][_0xf24e('0x14')]===0x1f4){logger[_0xf24e('0x13')](_0xf24e('0xe'),_0x3d85e8,_0x45f086[_0xf24e('0x13')][_0xf24e('0x15')]);return _0x58516f(_0x45f086[_0xf24e('0x13')][_0xf24e('0x15')]);}logger['error'](_0xf24e('0xe'),_0x3d85e8,_0x45f086[_0xf24e('0x13')][_0xf24e('0x15')]);return _0x1e8953(_0x45f086[_0xf24e('0x13')][_0xf24e('0x15')]);}else{logger[_0xf24e('0x16')](_0xf24e('0xe'),_0x3d85e8,'request\x20sent');_0x1e8953(_0x45f086['result']['message']);}})[_0xf24e('0x17')](function(_0x58a7b2){logger[_0xf24e('0x13')](_0xf24e('0xe'),_0x3d85e8,_0x58a7b2);_0x58516f(_0x58a7b2);});});}