14ce01d61a9f96c14079f7a6b6d49b19258273f1
[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 _0xf07a=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0xf07a,0x86));var _0xaf07=function(_0x247f3f,_0x5f298e){_0x247f3f=_0x247f3f-0x0;var _0x1381e6=_0xf07a[_0x247f3f];return _0x1381e6;};'use strict';var _=require(_0xaf07('0x0'));var util=require(_0xaf07('0x1'));var moment=require('moment');var BPromise=require(_0xaf07('0x2'));var rs=require(_0xaf07('0x3'));var fs=require('fs');var Redis=require(_0xaf07('0x4'));var db=require(_0xaf07('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf07('0x6'));var config=require('../../config/environment');var jayson=require(_0xaf07('0x7'));var client=jayson['client'][_0xaf07('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b864c,_0x18e050,_0x378834){return new BPromise(function(_0x132995,_0x33fda4){return client[_0xaf07('0x9')](_0x5b864c,_0x378834)[_0xaf07('0xa')](function(_0x5cbecc){logger[_0xaf07('0xb')](_0xaf07('0xc'),_0x18e050,_0xaf07('0xd'));logger[_0xaf07('0xe')](_0xaf07('0xf'),_0x18e050,'request\x20sent',JSON[_0xaf07('0x10')](_0x5cbecc));if(_0x5cbecc[_0xaf07('0x11')]){if(_0x5cbecc[_0xaf07('0x11')][_0xaf07('0x12')]===0x1f4){logger[_0xaf07('0x11')](_0xaf07('0xc'),_0x18e050,_0x5cbecc['error']['message']);return _0x33fda4(_0x5cbecc[_0xaf07('0x11')][_0xaf07('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x18e050,_0x5cbecc[_0xaf07('0x11')][_0xaf07('0x13')]);return _0x132995(_0x5cbecc[_0xaf07('0x11')][_0xaf07('0x13')]);}else{logger[_0xaf07('0xb')](_0xaf07('0xc'),_0x18e050,'request\x20sent');_0x132995(_0x5cbecc[_0xaf07('0x14')][_0xaf07('0x13')]);}})[_0xaf07('0x15')](function(_0x4326b7){logger['error'](_0xaf07('0xc'),_0x18e050,_0x4326b7);_0x33fda4(_0x4326b7);});});}