Built motion from commit (unavailable).|2.5.0
[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 _0xcbf8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird'];(function(_0x59cd5b,_0x326910){var _0x44a463=function(_0x5a02b0){while(--_0x5a02b0){_0x59cd5b['push'](_0x59cd5b['shift']());}};_0x44a463(++_0x326910);}(_0xcbf8,0xcf));var _0x8cbf=function(_0x41ad7b,_0x141ab8){_0x41ad7b=_0x41ad7b-0x0;var _0x2004b5=_0xcbf8[_0x41ad7b];return _0x2004b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8cbf('0x0'));var rs=require(_0x8cbf('0x1'));var fs=require('fs');var Redis=require(_0x8cbf('0x2'));var db=require(_0x8cbf('0x3'))['db'];var utils=require(_0x8cbf('0x4'));var logger=require(_0x8cbf('0x5'))(_0x8cbf('0x6'));var config=require(_0x8cbf('0x7'));var jayson=require(_0x8cbf('0x8'));var client=jayson['client'][_0x8cbf('0x9')]({'port':0x232a});config[_0x8cbf('0xa')]=_[_0x8cbf('0xb')](config[_0x8cbf('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8cbf('0xc'))(new Redis(config[_0x8cbf('0xa')]));require(_0x8cbf('0xd'))[_0x8cbf('0xe')](socket);function respondWithRpcPromise(_0xd46c5,_0x5eadcc,_0x24c0f1){return new BPromise(function(_0x3b7ad2,_0x29077d){return client[_0x8cbf('0xf')](_0xd46c5,_0x24c0f1)[_0x8cbf('0x10')](function(_0x52d2b5){logger[_0x8cbf('0x11')](_0x8cbf('0x12'),_0x5eadcc,'request\x20sent');logger['debug']('Notification,\x20%s,\x20%s,\x20%s',_0x5eadcc,_0x8cbf('0x13'),JSON[_0x8cbf('0x14')](_0x52d2b5));if(_0x52d2b5[_0x8cbf('0x15')]){if(_0x52d2b5[_0x8cbf('0x15')][_0x8cbf('0x16')]===0x1f4){logger['error']('Notification,\x20%s,\x20%s',_0x5eadcc,_0x52d2b5[_0x8cbf('0x15')][_0x8cbf('0x17')]);return _0x29077d(_0x52d2b5[_0x8cbf('0x15')][_0x8cbf('0x17')]);}logger[_0x8cbf('0x15')](_0x8cbf('0x12'),_0x5eadcc,_0x52d2b5['error'][_0x8cbf('0x17')]);return _0x3b7ad2(_0x52d2b5['error'][_0x8cbf('0x17')]);}else{logger['info'](_0x8cbf('0x12'),_0x5eadcc,_0x8cbf('0x13'));_0x3b7ad2(_0x52d2b5[_0x8cbf('0x18')]['message']);}})[_0x8cbf('0x19')](function(_0x21ee54){logger[_0x8cbf('0x15')](_0x8cbf('0x12'),_0x5eadcc,_0x21ee54);_0x29077d(_0x21ee54);});});}