7953fb4730f43c9abfaf151f930e4b06911acc5d
[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 _0x37cf=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x37cf,0x133));var _0xf37c=function(_0x332e51,_0x4e3b00){_0x332e51=_0x332e51-0x0;var _0x2461dd=_0x37cf[_0x332e51];return _0x2461dd;};'use strict';var _=require('lodash');var util=require(_0xf37c('0x0'));var moment=require('moment');var BPromise=require(_0xf37c('0x1'));var rs=require(_0xf37c('0x2'));var fs=require('fs');var Redis=require(_0xf37c('0x3'));var db=require(_0xf37c('0x4'))['db'];var utils=require(_0xf37c('0x5'));var logger=require(_0xf37c('0x6'))(_0xf37c('0x7'));var config=require('../../config/environment');var jayson=require(_0xf37c('0x8'));var client=jayson['client'][_0xf37c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xedc009,_0x71ec3c,_0x2655eb){return new BPromise(function(_0x3c460d,_0x42d6cc){return client[_0xf37c('0xa')](_0xedc009,_0x2655eb)['then'](function(_0x3e4758){logger[_0xf37c('0xb')](_0xf37c('0xc'),_0x71ec3c,_0xf37c('0xd'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x71ec3c,_0xf37c('0xd'),JSON['stringify'](_0x3e4758));if(_0x3e4758[_0xf37c('0xe')]){if(_0x3e4758[_0xf37c('0xe')][_0xf37c('0xf')]===0x1f4){logger['error'](_0xf37c('0xc'),_0x71ec3c,_0x3e4758[_0xf37c('0xe')][_0xf37c('0x10')]);return _0x42d6cc(_0x3e4758[_0xf37c('0xe')][_0xf37c('0x10')]);}logger['error'](_0xf37c('0xc'),_0x71ec3c,_0x3e4758['error'][_0xf37c('0x10')]);return _0x3c460d(_0x3e4758[_0xf37c('0xe')][_0xf37c('0x10')]);}else{logger[_0xf37c('0xb')](_0xf37c('0xc'),_0x71ec3c,_0xf37c('0xd'));_0x3c460d(_0x3e4758[_0xf37c('0x11')][_0xf37c('0x10')]);}})[_0xf37c('0x12')](function(_0x4decb6){logger[_0xf37c('0xe')](_0xf37c('0xc'),_0x71ec3c,_0x4decb6);_0x42d6cc(_0x4decb6);});});}