Built motion from commit (unavailable).|2.5.9
[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 _0xebc3=['client','redis','defaults','socket.io-emitter','register','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x171e9a,_0x3e9b42){var _0xdd9cc=function(_0x3b5fc1){while(--_0x3b5fc1){_0x171e9a['push'](_0x171e9a['shift']());}};_0xdd9cc(++_0x3e9b42);}(_0xebc3,0xd8));var _0x3ebc=function(_0x579d63,_0x54fd81){_0x579d63=_0x579d63-0x0;var _0x22d9ab=_0xebc3[_0x579d63];return _0x22d9ab;};'use strict';var _=require(_0x3ebc('0x0'));var util=require(_0x3ebc('0x1'));var moment=require('moment');var BPromise=require(_0x3ebc('0x2'));var rs=require(_0x3ebc('0x3'));var fs=require('fs');var Redis=require(_0x3ebc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ebc('0x5'));var logger=require('../../config/logger')(_0x3ebc('0x6'));var config=require(_0x3ebc('0x7'));var jayson=require(_0x3ebc('0x8'));var client=jayson[_0x3ebc('0x9')]['http']({'port':0x232a});config[_0x3ebc('0xa')]=_[_0x3ebc('0xb')](config[_0x3ebc('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3ebc('0xc'))(new Redis(config[_0x3ebc('0xa')]));require('./notification.socket')[_0x3ebc('0xd')](socket);function respondWithRpcPromise(_0x3429dc,_0x21106a,_0xa826b9){return new BPromise(function(_0x223dd8,_0x557da){return client['request'](_0x3429dc,_0xa826b9)[_0x3ebc('0xe')](function(_0x1ab016){logger[_0x3ebc('0xf')](_0x3ebc('0x10'),_0x21106a,_0x3ebc('0x11'));logger[_0x3ebc('0x12')](_0x3ebc('0x13'),_0x21106a,_0x3ebc('0x11'),JSON['stringify'](_0x1ab016));if(_0x1ab016[_0x3ebc('0x14')]){if(_0x1ab016[_0x3ebc('0x14')][_0x3ebc('0x15')]===0x1f4){logger['error'](_0x3ebc('0x10'),_0x21106a,_0x1ab016[_0x3ebc('0x14')][_0x3ebc('0x16')]);return _0x557da(_0x1ab016['error']['message']);}logger['error'](_0x3ebc('0x10'),_0x21106a,_0x1ab016[_0x3ebc('0x14')][_0x3ebc('0x16')]);return _0x223dd8(_0x1ab016['error'][_0x3ebc('0x16')]);}else{logger['info']('Notification,\x20%s,\x20%s',_0x21106a,'request\x20sent');_0x223dd8(_0x1ab016[_0x3ebc('0x17')][_0x3ebc('0x16')]);}})[_0x3ebc('0x18')](function(_0x5442bc){logger[_0x3ebc('0x14')](_0x3ebc('0x10'),_0x21106a,_0x5442bc);_0x557da(_0x5442bc);});});}