Built motion from commit (unavailable).|2.5.11
[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 _0x23b8=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./notification.socket','register','then','info','Notification,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x1d238b,_0x46e25b){var _0x3cef2c=function(_0x3b2547){while(--_0x3b2547){_0x1d238b['push'](_0x1d238b['shift']());}};_0x3cef2c(++_0x46e25b);}(_0x23b8,0x173));var _0x823b=function(_0x4513e8,_0x16f480){_0x4513e8=_0x4513e8-0x0;var _0x1e8758=_0x23b8[_0x4513e8];return _0x1e8758;};'use strict';var _=require('lodash');var util=require(_0x823b('0x0'));var moment=require(_0x823b('0x1'));var BPromise=require(_0x823b('0x2'));var rs=require(_0x823b('0x3'));var fs=require('fs');var Redis=require(_0x823b('0x4'));var db=require(_0x823b('0x5'))['db'];var utils=require(_0x823b('0x6'));var logger=require('../../config/logger')(_0x823b('0x7'));var config=require(_0x823b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x823b('0x9')][_0x823b('0xa')]({'port':0x232a});config[_0x823b('0xb')]=_[_0x823b('0xc')](config[_0x823b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x823b('0xd'))(new Redis(config[_0x823b('0xb')]));require(_0x823b('0xe'))[_0x823b('0xf')](socket);function respondWithRpcPromise(_0x30a353,_0x1e6079,_0xdc5772){return new BPromise(function(_0x4d494c,_0x24c6b8){return client['request'](_0x30a353,_0xdc5772)[_0x823b('0x10')](function(_0x1ba037){logger[_0x823b('0x11')](_0x823b('0x12'),_0x1e6079,_0x823b('0x13'));logger['debug']('Notification,\x20%s,\x20%s,\x20%s',_0x1e6079,_0x823b('0x13'),JSON['stringify'](_0x1ba037));if(_0x1ba037[_0x823b('0x14')]){if(_0x1ba037[_0x823b('0x14')][_0x823b('0x15')]===0x1f4){logger[_0x823b('0x14')]('Notification,\x20%s,\x20%s',_0x1e6079,_0x1ba037['error'][_0x823b('0x16')]);return _0x24c6b8(_0x1ba037['error'][_0x823b('0x16')]);}logger[_0x823b('0x14')](_0x823b('0x12'),_0x1e6079,_0x1ba037[_0x823b('0x14')][_0x823b('0x16')]);return _0x4d494c(_0x1ba037[_0x823b('0x14')][_0x823b('0x16')]);}else{logger['info'](_0x823b('0x12'),_0x1e6079,_0x823b('0x13'));_0x4d494c(_0x1ba037[_0x823b('0x17')][_0x823b('0x16')]);}})[_0x823b('0x18')](function(_0x46e754){logger[_0x823b('0x14')](_0x823b('0x12'),_0x1e6079,_0x46e754);_0x24c6b8(_0x46e754);});});}