Built motion from commit 863c3375.|2.6.28
[motion2.git] / server / api / userNotification / userNotification.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 _0x069b=['../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x188bbd,_0x49bb25){var _0x21410a=function(_0x21d3ef){while(--_0x21d3ef){_0x188bbd['push'](_0x188bbd['shift']());}};_0x21410a(++_0x49bb25);}(_0x069b,0x1ba));var _0xb069=function(_0x40836b,_0x575b50){_0x40836b=_0x40836b-0x0;var _0x271790=_0x069b[_0x40836b];return _0x271790;};'use strict';var _=require(_0xb069('0x0'));var util=require(_0xb069('0x1'));var moment=require(_0xb069('0x2'));var BPromise=require('bluebird');var rs=require(_0xb069('0x3'));var fs=require('fs');var Redis=require(_0xb069('0x4'));var db=require(_0xb069('0x5'))['db'];var utils=require(_0xb069('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb069('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb069('0x8')]['http']({'port':0x232a});config[_0xb069('0x9')]=_[_0xb069('0xa')](config['redis'],{'host':_0xb069('0xb'),'port':0x18eb});var socket=require(_0xb069('0xc'))(new Redis(config[_0xb069('0x9')]));require(_0xb069('0xd'))[_0xb069('0xe')](socket);function respondWithRpcPromise(_0x3ead21,_0x328c25,_0x33d64e){return new BPromise(function(_0x2ccc95,_0x2975b9){return client[_0xb069('0xf')](_0x3ead21,_0x33d64e)[_0xb069('0x10')](function(_0x43c9cb){logger[_0xb069('0x11')](_0xb069('0x12'),_0x328c25,_0xb069('0x13'));logger[_0xb069('0x14')](_0xb069('0x15'),_0x328c25,_0xb069('0x13'),JSON[_0xb069('0x16')](_0x43c9cb));if(_0x43c9cb[_0xb069('0x17')]){if(_0x43c9cb[_0xb069('0x17')][_0xb069('0x18')]===0x1f4){logger[_0xb069('0x17')]('UserNotification,\x20%s,\x20%s',_0x328c25,_0x43c9cb[_0xb069('0x17')][_0xb069('0x19')]);return _0x2975b9(_0x43c9cb[_0xb069('0x17')][_0xb069('0x19')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x328c25,_0x43c9cb[_0xb069('0x17')][_0xb069('0x19')]);return _0x2ccc95(_0x43c9cb['error'][_0xb069('0x19')]);}else{logger['info'](_0xb069('0x12'),_0x328c25,_0xb069('0x13'));_0x2ccc95(_0x43c9cb[_0xb069('0x1a')][_0xb069('0x19')]);}})[_0xb069('0x1b')](function(_0x258ff5){logger[_0xb069('0x17')]('UserNotification,\x20%s,\x20%s',_0x328c25,_0x258ff5);_0x2975b9(_0x258ff5);});});}