Built motion from commit (unavailable).|2.5.14
[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 _0x0ccf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','request','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x1e7345,_0x18bcce){var _0x33017c=function(_0x2b274f){while(--_0x2b274f){_0x1e7345['push'](_0x1e7345['shift']());}};_0x33017c(++_0x18bcce);}(_0x0ccf,0x1d2));var _0xf0cc=function(_0x3e80e5,_0x5ba461){_0x3e80e5=_0x3e80e5-0x0;var _0x43a128=_0x0ccf[_0x3e80e5];return _0x43a128;};'use strict';var _=require(_0xf0cc('0x0'));var util=require(_0xf0cc('0x1'));var moment=require(_0xf0cc('0x2'));var BPromise=require(_0xf0cc('0x3'));var rs=require(_0xf0cc('0x4'));var fs=require('fs');var Redis=require(_0xf0cc('0x5'));var db=require(_0xf0cc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0cc('0x7'))(_0xf0cc('0x8'));var config=require(_0xf0cc('0x9'));var jayson=require(_0xf0cc('0xa'));var client=jayson['client'][_0xf0cc('0xb')]({'port':0x232a});config[_0xf0cc('0xc')]=_[_0xf0cc('0xd')](config[_0xf0cc('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf0cc('0xc')]));require('./notification.socket')['register'](socket);function respondWithRpcPromise(_0x14f988,_0x5dc0e8,_0x43336b){return new BPromise(function(_0xcc3773,_0x145f98){return client[_0xf0cc('0xe')](_0x14f988,_0x43336b)['then'](function(_0x498c64){logger['info'](_0xf0cc('0xf'),_0x5dc0e8,'request\x20sent');logger[_0xf0cc('0x10')](_0xf0cc('0x11'),_0x5dc0e8,_0xf0cc('0x12'),JSON[_0xf0cc('0x13')](_0x498c64));if(_0x498c64[_0xf0cc('0x14')]){if(_0x498c64[_0xf0cc('0x14')][_0xf0cc('0x15')]===0x1f4){logger[_0xf0cc('0x14')]('Notification,\x20%s,\x20%s',_0x5dc0e8,_0x498c64[_0xf0cc('0x14')]['message']);return _0x145f98(_0x498c64[_0xf0cc('0x14')][_0xf0cc('0x16')]);}logger['error'](_0xf0cc('0xf'),_0x5dc0e8,_0x498c64[_0xf0cc('0x14')][_0xf0cc('0x16')]);return _0xcc3773(_0x498c64[_0xf0cc('0x14')]['message']);}else{logger[_0xf0cc('0x17')](_0xf0cc('0xf'),_0x5dc0e8,_0xf0cc('0x12'));_0xcc3773(_0x498c64[_0xf0cc('0x18')][_0xf0cc('0x16')]);}})[_0xf0cc('0x19')](function(_0x50b867){logger[_0xf0cc('0x14')]('Notification,\x20%s,\x20%s',_0x5dc0e8,_0x50b867);_0x145f98(_0x50b867);});});}