d2c0d1aec9c81059945d18872015ae0fcbbcb36c
[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 _0x04d3=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x46ca8f,_0x22cd0d){var _0x2321a7=function(_0x172e08){while(--_0x172e08){_0x46ca8f['push'](_0x46ca8f['shift']());}};_0x2321a7(++_0x22cd0d);}(_0x04d3,0x19a));var _0x304d=function(_0x4af2ec,_0x456c48){_0x4af2ec=_0x4af2ec-0x0;var _0x2e5a82=_0x04d3[_0x4af2ec];return _0x2e5a82;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x304d('0x0'));var BPromise=require(_0x304d('0x1'));var rs=require(_0x304d('0x2'));var fs=require('fs');var Redis=require(_0x304d('0x3'));var db=require(_0x304d('0x4'))['db'];var utils=require(_0x304d('0x5'));var logger=require(_0x304d('0x6'))('rpc');var config=require(_0x304d('0x7'));var jayson=require(_0x304d('0x8'));var client=jayson[_0x304d('0x9')][_0x304d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb31e,_0x1bd6a4,_0x1a284f){return new BPromise(function(_0x4c91f4,_0x391060){return client[_0x304d('0xb')](_0x2bb31e,_0x1a284f)[_0x304d('0xc')](function(_0x32b6b5){logger[_0x304d('0xd')](_0x304d('0xe'),_0x1bd6a4,'request\x20sent');logger[_0x304d('0xf')](_0x304d('0x10'),_0x1bd6a4,'request\x20sent',JSON[_0x304d('0x11')](_0x32b6b5));if(_0x32b6b5['error']){if(_0x32b6b5[_0x304d('0x12')][_0x304d('0x13')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x1bd6a4,_0x32b6b5[_0x304d('0x12')][_0x304d('0x14')]);return _0x391060(_0x32b6b5[_0x304d('0x12')][_0x304d('0x14')]);}logger[_0x304d('0x12')](_0x304d('0xe'),_0x1bd6a4,_0x32b6b5['error'][_0x304d('0x14')]);return _0x4c91f4(_0x32b6b5[_0x304d('0x12')][_0x304d('0x14')]);}else{logger['info'](_0x304d('0xe'),_0x1bd6a4,_0x304d('0x15'));_0x4c91f4(_0x32b6b5[_0x304d('0x16')][_0x304d('0x14')]);}})[_0x304d('0x17')](function(_0x54ec22){logger[_0x304d('0x12')](_0x304d('0xe'),_0x1bd6a4,_0x54ec22);_0x391060(_0x54ec22);});});}