Built motion from commit ffdca78c.|2.6.24
[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 _0x8498=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','then','info','UserNotification,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x4bde8f,_0x49e2a0){var _0x1c8cb3=function(_0x3a51ce){while(--_0x3a51ce){_0x4bde8f['push'](_0x4bde8f['shift']());}};_0x1c8cb3(++_0x49e2a0);}(_0x8498,0x1d4));var _0x8849=function(_0x246568,_0x57af04){_0x246568=_0x246568-0x0;var _0x19b302=_0x8498[_0x246568];return _0x19b302;};'use strict';var _=require(_0x8849('0x0'));var util=require(_0x8849('0x1'));var moment=require('moment');var BPromise=require(_0x8849('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8849('0x3'));var db=require(_0x8849('0x4'))['db'];var utils=require(_0x8849('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8849('0x6'));var jayson=require(_0x8849('0x7'));var client=jayson[_0x8849('0x8')][_0x8849('0x9')]({'port':0x232a});config['redis']=_[_0x8849('0xa')](config[_0x8849('0xb')],{'host':_0x8849('0xc'),'port':0x18eb});var socket=require(_0x8849('0xd'))(new Redis(config[_0x8849('0xb')]));require(_0x8849('0xe'))['register'](socket);function respondWithRpcPromise(_0xfe6ef4,_0x15030a,_0x44b789){return new BPromise(function(_0xeffa5f,_0x2e84dd){return client['request'](_0xfe6ef4,_0x44b789)[_0x8849('0xf')](function(_0x54bf4f){logger[_0x8849('0x10')](_0x8849('0x11'),_0x15030a,'request\x20sent');logger[_0x8849('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x15030a,_0x8849('0x13'),JSON[_0x8849('0x14')](_0x54bf4f));if(_0x54bf4f[_0x8849('0x15')]){if(_0x54bf4f[_0x8849('0x15')][_0x8849('0x16')]===0x1f4){logger[_0x8849('0x15')](_0x8849('0x11'),_0x15030a,_0x54bf4f[_0x8849('0x15')][_0x8849('0x17')]);return _0x2e84dd(_0x54bf4f[_0x8849('0x15')][_0x8849('0x17')]);}logger['error'](_0x8849('0x11'),_0x15030a,_0x54bf4f['error']['message']);return _0xeffa5f(_0x54bf4f[_0x8849('0x15')][_0x8849('0x17')]);}else{logger['info'](_0x8849('0x11'),_0x15030a,_0x8849('0x13'));_0xeffa5f(_0x54bf4f[_0x8849('0x18')][_0x8849('0x17')]);}})[_0x8849('0x19')](function(_0x461292){logger[_0x8849('0x15')](_0x8849('0x11'),_0x15030a,_0x461292);_0x2e84dd(_0x461292);});});}