Built motion from commit 6f14c8ba.|2.6.29
[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 _0x2dc6=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','request','then','request\x20sent','debug','stringify','error','UserNotification,\x20%s,\x20%s','message','info','lodash'];(function(_0xb7368b,_0xf11033){var _0x37d43b=function(_0x4562ed){while(--_0x4562ed){_0xb7368b['push'](_0xb7368b['shift']());}};_0x37d43b(++_0xf11033);}(_0x2dc6,0x1d3));var _0x62dc=function(_0x327c17,_0x55fe50){_0x327c17=_0x327c17-0x0;var _0x52de75=_0x2dc6[_0x327c17];return _0x52de75;};'use strict';var _=require(_0x62dc('0x0'));var util=require(_0x62dc('0x1'));var moment=require(_0x62dc('0x2'));var BPromise=require(_0x62dc('0x3'));var rs=require(_0x62dc('0x4'));var fs=require('fs');var Redis=require(_0x62dc('0x5'));var db=require(_0x62dc('0x6'))['db'];var utils=require(_0x62dc('0x7'));var logger=require('../../config/logger')(_0x62dc('0x8'));var config=require(_0x62dc('0x9'));var jayson=require(_0x62dc('0xa'));var client=jayson[_0x62dc('0xb')]['http']({'port':0x232a});config[_0x62dc('0xc')]=_[_0x62dc('0xd')](config['redis'],{'host':_0x62dc('0xe'),'port':0x18eb});var socket=require(_0x62dc('0xf'))(new Redis(config['redis']));require(_0x62dc('0x10'))['register'](socket);function respondWithRpcPromise(_0x4aecc3,_0xc4daeb,_0x3459f9){return new BPromise(function(_0x287645,_0x3b3e36){return client[_0x62dc('0x11')](_0x4aecc3,_0x3459f9)[_0x62dc('0x12')](function(_0xd87b8d){logger['info']('UserNotification,\x20%s,\x20%s',_0xc4daeb,_0x62dc('0x13'));logger[_0x62dc('0x14')]('UserNotification,\x20%s,\x20%s,\x20%s',_0xc4daeb,_0x62dc('0x13'),JSON[_0x62dc('0x15')](_0xd87b8d));if(_0xd87b8d[_0x62dc('0x16')]){if(_0xd87b8d[_0x62dc('0x16')]['code']===0x1f4){logger[_0x62dc('0x16')](_0x62dc('0x17'),_0xc4daeb,_0xd87b8d[_0x62dc('0x16')][_0x62dc('0x18')]);return _0x3b3e36(_0xd87b8d[_0x62dc('0x16')][_0x62dc('0x18')]);}logger[_0x62dc('0x16')](_0x62dc('0x17'),_0xc4daeb,_0xd87b8d[_0x62dc('0x16')][_0x62dc('0x18')]);return _0x287645(_0xd87b8d[_0x62dc('0x16')][_0x62dc('0x18')]);}else{logger[_0x62dc('0x19')](_0x62dc('0x17'),_0xc4daeb,_0x62dc('0x13'));_0x287645(_0xd87b8d['result'][_0x62dc('0x18')]);}})['catch'](function(_0x2bb7e4){logger[_0x62dc('0x16')](_0x62dc('0x17'),_0xc4daeb,_0x2bb7e4);_0x3b3e36(_0x2bb7e4);});});}