Built motion from commit (unavailable).|2.5.21
[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 _0xa42e=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./notification.socket','register','request','then','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0xc19079,_0x1544a8){var _0x5e49b4=function(_0x15811b){while(--_0x15811b){_0xc19079['push'](_0xc19079['shift']());}};_0x5e49b4(++_0x1544a8);}(_0xa42e,0x17b));var _0xea42=function(_0x3969fc,_0xcd8a45){_0x3969fc=_0x3969fc-0x0;var _0x6fef30=_0xa42e[_0x3969fc];return _0x6fef30;};'use strict';var _=require(_0xea42('0x0'));var util=require(_0xea42('0x1'));var moment=require(_0xea42('0x2'));var BPromise=require('bluebird');var rs=require(_0xea42('0x3'));var fs=require('fs');var Redis=require(_0xea42('0x4'));var db=require(_0xea42('0x5'))['db'];var utils=require(_0xea42('0x6'));var logger=require(_0xea42('0x7'))(_0xea42('0x8'));var config=require('../../config/environment');var jayson=require(_0xea42('0x9'));var client=jayson[_0xea42('0xa')][_0xea42('0xb')]({'port':0x232a});config[_0xea42('0xc')]=_[_0xea42('0xd')](config[_0xea42('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea42('0xc')]));require(_0xea42('0xe'))[_0xea42('0xf')](socket);function respondWithRpcPromise(_0x533d8e,_0x5e5dbc,_0x2b8538){return new BPromise(function(_0x31fda9,_0x12135f){return client[_0xea42('0x10')](_0x533d8e,_0x2b8538)[_0xea42('0x11')](function(_0x228859){logger['info'](_0xea42('0x12'),_0x5e5dbc,'request\x20sent');logger[_0xea42('0x13')](_0xea42('0x14'),_0x5e5dbc,_0xea42('0x15'),JSON[_0xea42('0x16')](_0x228859));if(_0x228859[_0xea42('0x17')]){if(_0x228859[_0xea42('0x17')][_0xea42('0x18')]===0x1f4){logger['error'](_0xea42('0x12'),_0x5e5dbc,_0x228859[_0xea42('0x17')][_0xea42('0x19')]);return _0x12135f(_0x228859[_0xea42('0x17')][_0xea42('0x19')]);}logger[_0xea42('0x17')](_0xea42('0x12'),_0x5e5dbc,_0x228859['error']['message']);return _0x31fda9(_0x228859['error'][_0xea42('0x19')]);}else{logger[_0xea42('0x1a')](_0xea42('0x12'),_0x5e5dbc,_0xea42('0x15'));_0x31fda9(_0x228859[_0xea42('0x1b')][_0xea42('0x19')]);}})[_0xea42('0x1c')](function(_0xae85f){logger[_0xea42('0x17')](_0xea42('0x12'),_0x5e5dbc,_0xae85f);_0x12135f(_0xae85f);});});}