7cf4d1c70722aec7e96fa21b24a2834556a89fd0
[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 _0xbccd=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x1767d2,_0x3f7131){var _0x41646d=function(_0x26bd06){while(--_0x26bd06){_0x1767d2['push'](_0x1767d2['shift']());}};_0x41646d(++_0x3f7131);}(_0xbccd,0x1b0));var _0xdbcc=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xbccd[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xdbcc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdbcc('0x1'));var rs=require(_0xdbcc('0x2'));var fs=require('fs');var Redis=require(_0xdbcc('0x3'));var db=require(_0xdbcc('0x4'))['db'];var utils=require(_0xdbcc('0x5'));var logger=require(_0xdbcc('0x6'))('rpc');var config=require(_0xdbcc('0x7'));var jayson=require(_0xdbcc('0x8'));var client=jayson[_0xdbcc('0x9')][_0xdbcc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7fe600,_0xf05e4a,_0x216289){return new BPromise(function(_0x22d783,_0x3124c7){return client[_0xdbcc('0xb')](_0x7fe600,_0x216289)[_0xdbcc('0xc')](function(_0x54f5ee){logger['info'](_0xdbcc('0xd'),_0xf05e4a,'request\x20sent');logger[_0xdbcc('0xe')](_0xdbcc('0xf'),_0xf05e4a,_0xdbcc('0x10'),JSON[_0xdbcc('0x11')](_0x54f5ee));if(_0x54f5ee[_0xdbcc('0x12')]){if(_0x54f5ee[_0xdbcc('0x12')][_0xdbcc('0x13')]===0x1f4){logger['error'](_0xdbcc('0xd'),_0xf05e4a,_0x54f5ee['error']['message']);return _0x3124c7(_0x54f5ee['error'][_0xdbcc('0x14')]);}logger[_0xdbcc('0x12')](_0xdbcc('0xd'),_0xf05e4a,_0x54f5ee[_0xdbcc('0x12')][_0xdbcc('0x14')]);return _0x22d783(_0x54f5ee[_0xdbcc('0x12')][_0xdbcc('0x14')]);}else{logger[_0xdbcc('0x15')]('JscriptySessionReport,\x20%s,\x20%s',_0xf05e4a,'request\x20sent');_0x22d783(_0x54f5ee[_0xdbcc('0x16')][_0xdbcc('0x14')]);}})[_0xdbcc('0x17')](function(_0x255aa2){logger[_0xdbcc('0x12')](_0xdbcc('0xd'),_0xf05e4a,_0x255aa2);_0x3124c7(_0x255aa2);});});}