ddd606f25e6b64288bb9f6a16bb834cf2b1c755f
[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 _0x8952=['JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x5f3c49,_0x2c9716){var _0x5259ac=function(_0x54eb42){while(--_0x54eb42){_0x5f3c49['push'](_0x5f3c49['shift']());}};_0x5259ac(++_0x2c9716);}(_0x8952,0x17e));var _0x2895=function(_0xc6c651,_0x239018){_0xc6c651=_0xc6c651-0x0;var _0xa1eec3=_0x8952[_0xc6c651];return _0xa1eec3;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});}