527cc094e4e85fa7da24da0bbef8d5984a095a33
[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 _0xe63b=['../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xe63b,0x189));var _0xbe63=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0xe63b[_0x31172e];return _0x414ada;};'use strict';var _=require(_0xbe63('0x0'));var util=require('util');var moment=require(_0xbe63('0x1'));var BPromise=require(_0xbe63('0x2'));var rs=require(_0xbe63('0x3'));var fs=require('fs');var Redis=require(_0xbe63('0x4'));var db=require(_0xbe63('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe63('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbe63('0x7'));var client=jayson[_0xbe63('0x8')][_0xbe63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30654d,_0x237762,_0xd3d51){return new BPromise(function(_0x438c51,_0x18590b){return client[_0xbe63('0xa')](_0x30654d,_0xd3d51)[_0xbe63('0xb')](function(_0x53e31d){logger[_0xbe63('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x237762,_0xbe63('0xd'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x237762,_0xbe63('0xd'),JSON[_0xbe63('0xe')](_0x53e31d));if(_0x53e31d['error']){if(_0x53e31d[_0xbe63('0xf')][_0xbe63('0x10')]===0x1f4){logger[_0xbe63('0xf')](_0xbe63('0x11'),_0x237762,_0x53e31d[_0xbe63('0xf')][_0xbe63('0x12')]);return _0x18590b(_0x53e31d['error']['message']);}logger[_0xbe63('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x237762,_0x53e31d[_0xbe63('0xf')][_0xbe63('0x12')]);return _0x438c51(_0x53e31d[_0xbe63('0xf')][_0xbe63('0x12')]);}else{logger[_0xbe63('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x237762,'request\x20sent');_0x438c51(_0x53e31d[_0xbe63('0x13')][_0xbe63('0x12')]);}})[_0xbe63('0x14')](function(_0x278432){logger[_0xbe63('0xf')](_0xbe63('0x11'),_0x237762,_0x278432);_0x18590b(_0x278432);});});}