Built motion from commit (unavailable).|2.3.4
[motion2.git] / server / api / jscriptyAnswerReport / jscriptyAnswerReport.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 _0x6302=['moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x4a690d,_0x51473d){var _0x31e44c=function(_0x442593){while(--_0x442593){_0x4a690d['push'](_0x4a690d['shift']());}};_0x31e44c(++_0x51473d);}(_0x6302,0x109));var _0x2630=function(_0x16bb42,_0x52a3b9){_0x16bb42=_0x16bb42-0x0;var _0x3a342b=_0x6302[_0x16bb42];return _0x3a342b;};'use strict';var _=require('lodash');var util=require(_0x2630('0x0'));var moment=require(_0x2630('0x1'));var BPromise=require(_0x2630('0x2'));var rs=require(_0x2630('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2630('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2630('0x5'));var jayson=require(_0x2630('0x6'));var client=jayson[_0x2630('0x7')][_0x2630('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2867f8,_0x19231a,_0x2e1867){return new BPromise(function(_0x353f73,_0x581f4d){return client['request'](_0x2867f8,_0x2e1867)[_0x2630('0x9')](function(_0x10ffdf){logger['info'](_0x2630('0xa'),_0x19231a,'request\x20sent');logger[_0x2630('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x19231a,_0x2630('0xc'),JSON[_0x2630('0xd')](_0x10ffdf));if(_0x10ffdf[_0x2630('0xe')]){if(_0x10ffdf[_0x2630('0xe')][_0x2630('0xf')]===0x1f4){logger[_0x2630('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x19231a,_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);return _0x581f4d(_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);}logger['error'](_0x2630('0xa'),_0x19231a,_0x10ffdf[_0x2630('0xe')][_0x2630('0x10')]);return _0x353f73(_0x10ffdf['error'][_0x2630('0x10')]);}else{logger['info'](_0x2630('0xa'),_0x19231a,_0x2630('0xc'));_0x353f73(_0x10ffdf[_0x2630('0x11')][_0x2630('0x10')]);}})[_0x2630('0x12')](function(_0x18b2b0){logger[_0x2630('0xe')](_0x2630('0xa'),_0x19231a,_0x18b2b0);_0x581f4d(_0x18b2b0);});});}