Built motion from commit (unavailable).|2.5.15
[motion2.git] / server / api / notification / notification.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 _0x0c55=['defaults','localhost','socket.io-emitter','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x413727,_0x203b7f){var _0x57cc85=function(_0x4158d7){while(--_0x4158d7){_0x413727['push'](_0x413727['shift']());}};_0x57cc85(++_0x203b7f);}(_0x0c55,0x154));var _0x50c5=function(_0x3051fc,_0x56493f){_0x3051fc=_0x3051fc-0x0;var _0x471239=_0x0c55[_0x3051fc];return _0x471239;};'use strict';var _=require('lodash');var util=require(_0x50c5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50c5('0x1'));var fs=require('fs');var Redis=require(_0x50c5('0x2'));var db=require(_0x50c5('0x3'))['db'];var utils=require(_0x50c5('0x4'));var logger=require('../../config/logger')(_0x50c5('0x5'));var config=require(_0x50c5('0x6'));var jayson=require(_0x50c5('0x7'));var client=jayson[_0x50c5('0x8')][_0x50c5('0x9')]({'port':0x232a});config[_0x50c5('0xa')]=_[_0x50c5('0xb')](config[_0x50c5('0xa')],{'host':_0x50c5('0xc'),'port':0x18eb});var socket=require(_0x50c5('0xd'))(new Redis(config[_0x50c5('0xa')]));require('./notification.socket')[_0x50c5('0xe')](socket);function respondWithRpcPromise(_0x48d2cb,_0x4e4804,_0x576ee0){return new BPromise(function(_0x1e5019,_0x55b1aa){return client[_0x50c5('0xf')](_0x48d2cb,_0x576ee0)[_0x50c5('0x10')](function(_0x3efc3d){logger[_0x50c5('0x11')](_0x50c5('0x12'),_0x4e4804,_0x50c5('0x13'));logger[_0x50c5('0x14')](_0x50c5('0x15'),_0x4e4804,_0x50c5('0x13'),JSON[_0x50c5('0x16')](_0x3efc3d));if(_0x3efc3d[_0x50c5('0x17')]){if(_0x3efc3d[_0x50c5('0x17')][_0x50c5('0x18')]===0x1f4){logger['error'](_0x50c5('0x12'),_0x4e4804,_0x3efc3d[_0x50c5('0x17')][_0x50c5('0x19')]);return _0x55b1aa(_0x3efc3d[_0x50c5('0x17')][_0x50c5('0x19')]);}logger[_0x50c5('0x17')](_0x50c5('0x12'),_0x4e4804,_0x3efc3d[_0x50c5('0x17')]['message']);return _0x1e5019(_0x3efc3d[_0x50c5('0x17')][_0x50c5('0x19')]);}else{logger[_0x50c5('0x11')](_0x50c5('0x12'),_0x4e4804,'request\x20sent');_0x1e5019(_0x3efc3d['result'][_0x50c5('0x19')]);}})[_0x50c5('0x1a')](function(_0x516023){logger['error'](_0x50c5('0x12'),_0x4e4804,_0x516023);_0x55b1aa(_0x516023);});});}