59fd69f862d5d1bd4d5034e839db2d9fe524417e
[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 _0x1b48=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb'];(function(_0x26b908,_0x2d1d49){var _0x2dcaa2=function(_0x37077b){while(--_0x37077b){_0x26b908['push'](_0x26b908['shift']());}};_0x2dcaa2(++_0x2d1d49);}(_0x1b48,0xc2));var _0x81b4=function(_0x5f2647,_0x3dfa49){_0x5f2647=_0x5f2647-0x0;var _0xb95215=_0x1b48[_0x5f2647];return _0xb95215;};'use strict';var _=require('lodash');var util=require(_0x81b4('0x0'));var moment=require(_0x81b4('0x1'));var BPromise=require(_0x81b4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81b4('0x3'))['db'];var utils=require(_0x81b4('0x4'));var logger=require(_0x81b4('0x5'))(_0x81b4('0x6'));var config=require(_0x81b4('0x7'));var jayson=require(_0x81b4('0x8'));var client=jayson['client'][_0x81b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1153ff,_0x3d82f3,_0x194f41){return new BPromise(function(_0x28557e,_0xa81e87){return client[_0x81b4('0xa')](_0x1153ff,_0x194f41)[_0x81b4('0xb')](function(_0x4d1219){logger[_0x81b4('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x3d82f3,'request\x20sent');logger[_0x81b4('0xd')](_0x81b4('0xe'),_0x3d82f3,_0x81b4('0xf'),JSON[_0x81b4('0x10')](_0x4d1219));if(_0x4d1219[_0x81b4('0x11')]){if(_0x4d1219[_0x81b4('0x11')]['code']===0x1f4){logger[_0x81b4('0x11')](_0x81b4('0x12'),_0x3d82f3,_0x4d1219[_0x81b4('0x11')]['message']);return _0xa81e87(_0x4d1219[_0x81b4('0x11')][_0x81b4('0x13')]);}logger[_0x81b4('0x11')](_0x81b4('0x12'),_0x3d82f3,_0x4d1219['error'][_0x81b4('0x13')]);return _0x28557e(_0x4d1219['error'][_0x81b4('0x13')]);}else{logger['info'](_0x81b4('0x12'),_0x3d82f3,'request\x20sent');_0x28557e(_0x4d1219[_0x81b4('0x14')][_0x81b4('0x13')]);}})[_0x81b4('0x15')](function(_0x2e3801){logger[_0x81b4('0x11')](_0x81b4('0x12'),_0x3d82f3,_0x2e3801);_0xa81e87(_0x2e3801);});});}