Built motion from commit (unavailable).|2.5.22
[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 _0x60f3=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x60f3,0xf5));var _0x360f=function(_0x1265fa,_0x1a1fed){_0x1265fa=_0x1265fa-0x0;var _0x1fe35e=_0x60f3[_0x1265fa];return _0x1fe35e;};'use strict';var _=require(_0x360f('0x0'));var util=require(_0x360f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x360f('0x2'));var fs=require('fs');var Redis=require(_0x360f('0x3'));var db=require(_0x360f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x360f('0x5'))('rpc');var config=require(_0x360f('0x6'));var jayson=require(_0x360f('0x7'));var client=jayson[_0x360f('0x8')][_0x360f('0x9')]({'port':0x232a});config[_0x360f('0xa')]=_['defaults'](config[_0x360f('0xa')],{'host':_0x360f('0xb'),'port':0x18eb});var socket=require(_0x360f('0xc'))(new Redis(config['redis']));require(_0x360f('0xd'))[_0x360f('0xe')](socket);function respondWithRpcPromise(_0x18b105,_0x528cb8,_0x2d1c84){return new BPromise(function(_0x4b58f9,_0xd5f6b1){return client[_0x360f('0xf')](_0x18b105,_0x2d1c84)[_0x360f('0x10')](function(_0x584fc9){logger[_0x360f('0x11')](_0x360f('0x12'),_0x528cb8,_0x360f('0x13'));logger['debug'](_0x360f('0x14'),_0x528cb8,_0x360f('0x13'),JSON['stringify'](_0x584fc9));if(_0x584fc9['error']){if(_0x584fc9[_0x360f('0x15')]['code']===0x1f4){logger['error'](_0x360f('0x12'),_0x528cb8,_0x584fc9[_0x360f('0x15')][_0x360f('0x16')]);return _0xd5f6b1(_0x584fc9[_0x360f('0x15')][_0x360f('0x16')]);}logger[_0x360f('0x15')](_0x360f('0x12'),_0x528cb8,_0x584fc9['error']['message']);return _0x4b58f9(_0x584fc9[_0x360f('0x15')][_0x360f('0x16')]);}else{logger[_0x360f('0x11')](_0x360f('0x12'),_0x528cb8,_0x360f('0x13'));_0x4b58f9(_0x584fc9[_0x360f('0x17')]['message']);}})[_0x360f('0x18')](function(_0x198167){logger[_0x360f('0x15')]('UserNotification,\x20%s,\x20%s',_0x528cb8,_0x198167);_0xd5f6b1(_0x198167);});});}