9d0a849d907caad105e21671e01ffb9f8bd3ba63
[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 _0x22c9=['result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message'];(function(_0x575d72,_0xca45c4){var _0x3559a2=function(_0x1f3efd){while(--_0x1f3efd){_0x575d72['push'](_0x575d72['shift']());}};_0x3559a2(++_0xca45c4);}(_0x22c9,0x8b));var _0x922c=function(_0xe9c8e4,_0x3aa2f6){_0xe9c8e4=_0xe9c8e4-0x0;var _0x2037fa=_0x22c9[_0xe9c8e4];return _0x2037fa;};'use strict';var _=require(_0x922c('0x0'));var util=require(_0x922c('0x1'));var moment=require(_0x922c('0x2'));var BPromise=require(_0x922c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x922c('0x4'))['db'];var utils=require(_0x922c('0x5'));var logger=require(_0x922c('0x6'))(_0x922c('0x7'));var config=require(_0x922c('0x8'));var jayson=require(_0x922c('0x9'));var client=jayson[_0x922c('0xa')][_0x922c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35451c,_0x1408d3,_0x395fc1){return new BPromise(function(_0xe8b783,_0x9fac83){return client[_0x922c('0xc')](_0x35451c,_0x395fc1)[_0x922c('0xd')](function(_0x5b4599){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x1408d3,'request\x20sent');logger[_0x922c('0xe')](_0x922c('0xf'),_0x1408d3,_0x922c('0x10'),JSON[_0x922c('0x11')](_0x5b4599));if(_0x5b4599[_0x922c('0x12')]){if(_0x5b4599[_0x922c('0x12')][_0x922c('0x13')]===0x1f4){logger['error'](_0x922c('0x14'),_0x1408d3,_0x5b4599[_0x922c('0x12')][_0x922c('0x15')]);return _0x9fac83(_0x5b4599['error']['message']);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x1408d3,_0x5b4599['error'][_0x922c('0x15')]);return _0xe8b783(_0x5b4599[_0x922c('0x12')][_0x922c('0x15')]);}else{logger['info'](_0x922c('0x14'),_0x1408d3,'request\x20sent');_0xe8b783(_0x5b4599[_0x922c('0x16')][_0x922c('0x15')]);}})['catch'](function(_0x567856){logger[_0x922c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x1408d3,_0x567856);_0x9fac83(_0x567856);});});}