8c16dc14749e21a9931312a687dbac94fd541e43
[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 _0x1883=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1400e3,_0x24bcc6){var _0x3d285b=function(_0x6bc469){while(--_0x6bc469){_0x1400e3['push'](_0x1400e3['shift']());}};_0x3d285b(++_0x24bcc6);}(_0x1883,0xab));var _0x3188=function(_0x3efdc1,_0x5c2418){_0x3efdc1=_0x3efdc1-0x0;var _0x17f380=_0x1883[_0x3efdc1];return _0x17f380;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24f2f1,_0x3ce7fd,_0x3e3afb){return new BPromise(function(_0x5c8f26,_0x446ab7){return client[_0x3188('0xe')](_0x24f2f1,_0x3e3afb)['then'](function(_0x2213b5){logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));logger[_0x3188('0x11')](_0x3188('0x12'),_0x3ce7fd,'request\x20sent',JSON[_0x3188('0x13')](_0x2213b5));if(_0x2213b5[_0x3188('0x14')]){if(_0x2213b5['error']['code']===0x1f4){logger[_0x3188('0x14')](_0x3188('0xf'),_0x3ce7fd,_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);return _0x446ab7(_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);}logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x2213b5['error']['message']);return _0x5c8f26(_0x2213b5[_0x3188('0x14')]['message']);}else{logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));_0x5c8f26(_0x2213b5[_0x3188('0x16')][_0x3188('0x15')]);}})[_0x3188('0x17')](function(_0x259321){logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x259321);_0x446ab7(_0x259321);});});}