171564b53475ba477a67f7d966ba26e32f27710f
[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 _0x6a47=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x4877c9,_0xf9d45e){var _0x1845ea=function(_0x2daf78){while(--_0x2daf78){_0x4877c9['push'](_0x4877c9['shift']());}};_0x1845ea(++_0xf9d45e);}(_0x6a47,0x112));var _0x76a4=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x6a47[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x76a4('0x0'));var util=require(_0x76a4('0x1'));var moment=require(_0x76a4('0x2'));var BPromise=require(_0x76a4('0x3'));var rs=require(_0x76a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76a4('0x5'))['db'];var utils=require(_0x76a4('0x6'));var logger=require('../../config/logger')(_0x76a4('0x7'));var config=require(_0x76a4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x76a4('0x9')][_0x76a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51b5c5,_0x364fe8,_0xb1de4d){return new BPromise(function(_0x53d422,_0x24a5fd){return client[_0x76a4('0xb')](_0x51b5c5,_0xb1de4d)[_0x76a4('0xc')](function(_0x557fa7){logger[_0x76a4('0xd')](_0x76a4('0xe'),_0x364fe8,_0x76a4('0xf'));logger[_0x76a4('0x10')](_0x76a4('0x11'),_0x364fe8,_0x76a4('0xf'),JSON[_0x76a4('0x12')](_0x557fa7));if(_0x557fa7[_0x76a4('0x13')]){if(_0x557fa7[_0x76a4('0x13')]['code']===0x1f4){logger[_0x76a4('0x13')](_0x76a4('0xe'),_0x364fe8,_0x557fa7[_0x76a4('0x13')]['message']);return _0x24a5fd(_0x557fa7[_0x76a4('0x13')][_0x76a4('0x14')]);}logger['error'](_0x76a4('0xe'),_0x364fe8,_0x557fa7[_0x76a4('0x13')]['message']);return _0x53d422(_0x557fa7['error'][_0x76a4('0x14')]);}else{logger[_0x76a4('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x364fe8,_0x76a4('0xf'));_0x53d422(_0x557fa7[_0x76a4('0x15')][_0x76a4('0x14')]);}})[_0x76a4('0x16')](function(_0x2c73f0){logger[_0x76a4('0x13')](_0x76a4('0xe'),_0x364fe8,_0x2c73f0);_0x24a5fd(_0x2c73f0);});});}