2f382e31fff26490ab1ead6daeb53b41be318d81
[motion2.git] / server / api / jscriptySessionReport / jscriptySessionReport.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 _0x8130=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x1f29b0,_0x527d05){var _0x766c9c=function(_0x5c7390){while(--_0x5c7390){_0x1f29b0['push'](_0x1f29b0['shift']());}};_0x766c9c(++_0x527d05);}(_0x8130,0x146));var _0x0813=function(_0x11e9bc,_0x15a8a0){_0x11e9bc=_0x11e9bc-0x0;var _0x1c45a4=_0x8130[_0x11e9bc];return _0x1c45a4;};'use strict';var _=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var moment=require('moment');var BPromise=require(_0x0813('0x2'));var rs=require(_0x0813('0x3'));var fs=require('fs');var Redis=require(_0x0813('0x4'));var db=require(_0x0813('0x5'))['db'];var utils=require(_0x0813('0x6'));var logger=require(_0x0813('0x7'))('rpc');var config=require(_0x0813('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0813('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2df45a,_0x2bbdfd,_0x19a508){return new BPromise(function(_0x2ab8f0,_0x115a90){return client[_0x0813('0xa')](_0x2df45a,_0x19a508)['then'](function(_0x44ec2c){logger[_0x0813('0xb')](_0x0813('0xc'),_0x2bbdfd,'request\x20sent');logger['debug'](_0x0813('0xd'),_0x2bbdfd,'request\x20sent',JSON[_0x0813('0xe')](_0x44ec2c));if(_0x44ec2c['error']){if(_0x44ec2c[_0x0813('0xf')][_0x0813('0x10')]===0x1f4){logger[_0x0813('0xf')](_0x0813('0xc'),_0x2bbdfd,_0x44ec2c['error']['message']);return _0x115a90(_0x44ec2c[_0x0813('0xf')][_0x0813('0x11')]);}logger['error'](_0x0813('0xc'),_0x2bbdfd,_0x44ec2c['error']['message']);return _0x2ab8f0(_0x44ec2c[_0x0813('0xf')][_0x0813('0x11')]);}else{logger['info'](_0x0813('0xc'),_0x2bbdfd,'request\x20sent');_0x2ab8f0(_0x44ec2c[_0x0813('0x12')][_0x0813('0x11')]);}})[_0x0813('0x13')](function(_0xee126d){logger[_0x0813('0xf')](_0x0813('0xc'),_0x2bbdfd,_0xee126d);_0x115a90(_0xee126d);});});}