bfd7405969c4ec324d8e23f25fe0089bb364aec3
[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 _0xf976=['util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4fcd14,_0x55b2af){var _0x329a87=function(_0x466b77){while(--_0x466b77){_0x4fcd14['push'](_0x4fcd14['shift']());}};_0x329a87(++_0x55b2af);}(_0xf976,0x19d));var _0x6f97=function(_0x1500c8,_0x3545c7){_0x1500c8=_0x1500c8-0x0;var _0x1bb5dd=_0xf976[_0x1500c8];return _0x1bb5dd;};'use strict';var _=require(_0x6f97('0x0'));var util=require(_0x6f97('0x1'));var moment=require(_0x6f97('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f97('0x3'))['db'];var utils=require(_0x6f97('0x4'));var logger=require(_0x6f97('0x5'))(_0x6f97('0x6'));var config=require('../../config/environment');var jayson=require(_0x6f97('0x7'));var client=jayson[_0x6f97('0x8')][_0x6f97('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb3ff3e,_0x5d6d8c,_0x1bb973){return new BPromise(function(_0x32ef2e,_0x50c108){return client[_0x6f97('0xa')](_0xb3ff3e,_0x1bb973)[_0x6f97('0xb')](function(_0x3b7462){logger[_0x6f97('0xc')](_0x6f97('0xd'),_0x5d6d8c,_0x6f97('0xe'));logger[_0x6f97('0xf')](_0x6f97('0x10'),_0x5d6d8c,_0x6f97('0xe'),JSON[_0x6f97('0x11')](_0x3b7462));if(_0x3b7462[_0x6f97('0x12')]){if(_0x3b7462[_0x6f97('0x12')][_0x6f97('0x13')]===0x1f4){logger[_0x6f97('0x12')](_0x6f97('0xd'),_0x5d6d8c,_0x3b7462['error']['message']);return _0x50c108(_0x3b7462['error']['message']);}logger['error'](_0x6f97('0xd'),_0x5d6d8c,_0x3b7462['error'][_0x6f97('0x14')]);return _0x32ef2e(_0x3b7462['error'][_0x6f97('0x14')]);}else{logger['info'](_0x6f97('0xd'),_0x5d6d8c,_0x6f97('0xe'));_0x32ef2e(_0x3b7462[_0x6f97('0x15')]['message']);}})[_0x6f97('0x16')](function(_0x12eb45){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x5d6d8c,_0x12eb45);_0x50c108(_0x12eb45);});});}