1007c1074db98e41e50b4bc1d82f502828f20395
[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 _0xd230=['http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0xf65a82,_0x32be76){var _0x311838=function(_0x421f5d){while(--_0x421f5d){_0xf65a82['push'](_0xf65a82['shift']());}};_0x311838(++_0x32be76);}(_0xd230,0x107));var _0x0d23=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xd230[_0xa6cc5c];return _0x44803d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d23('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d23('0x1'));var db=require(_0x0d23('0x2'))['db'];var utils=require(_0x0d23('0x3'));var logger=require('../../config/logger')(_0x0d23('0x4'));var config=require('../../config/environment');var jayson=require(_0x0d23('0x5'));var client=jayson[_0x0d23('0x6')][_0x0d23('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34c2d2,_0x2abb34,_0x113a96){return new BPromise(function(_0x4685b7,_0x46f938){return client['request'](_0x34c2d2,_0x113a96)[_0x0d23('0x8')](function(_0x114931){logger[_0x0d23('0x9')](_0x0d23('0xa'),_0x2abb34,_0x0d23('0xb'));logger[_0x0d23('0xc')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x2abb34,_0x0d23('0xb'),JSON[_0x0d23('0xd')](_0x114931));if(_0x114931[_0x0d23('0xe')]){if(_0x114931['error'][_0x0d23('0xf')]===0x1f4){logger[_0x0d23('0xe')](_0x0d23('0xa'),_0x2abb34,_0x114931[_0x0d23('0xe')]['message']);return _0x46f938(_0x114931[_0x0d23('0xe')][_0x0d23('0x10')]);}logger['error'](_0x0d23('0xa'),_0x2abb34,_0x114931['error'][_0x0d23('0x10')]);return _0x4685b7(_0x114931[_0x0d23('0xe')]['message']);}else{logger[_0x0d23('0x9')]('JscriptySessionReport,\x20%s,\x20%s',_0x2abb34,_0x0d23('0xb'));_0x4685b7(_0x114931['result'][_0x0d23('0x10')]);}})[_0x0d23('0x11')](function(_0x4bf68d){logger[_0x0d23('0xe')](_0x0d23('0xa'),_0x2abb34,_0x4bf68d);_0x46f938(_0x4bf68d);});});}