2a5958eed3d1f3a061313e795b05bab680283b4c
[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 _0xb484=['request\x20sent','stringify','error','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','JscriptyAnswerReport,\x20%s,\x20%s','debug'];(function(_0x4e3e77,_0x3ab1ba){var _0x4418db=function(_0x188e1d){while(--_0x188e1d){_0x4e3e77['push'](_0x4e3e77['shift']());}};_0x4418db(++_0x3ab1ba);}(_0xb484,0xb1));var _0x4b48=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0xb484[_0x2e04ef];return _0x5722b0;};'use strict';var _=require('lodash');var util=require(_0x4b48('0x0'));var moment=require('moment');var BPromise=require(_0x4b48('0x1'));var rs=require(_0x4b48('0x2'));var fs=require('fs');var Redis=require(_0x4b48('0x3'));var db=require(_0x4b48('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b48('0x5'))(_0x4b48('0x6'));var config=require('../../config/environment');var jayson=require(_0x4b48('0x7'));var client=jayson[_0x4b48('0x8')][_0x4b48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4660be,_0x5a3599,_0x2e080a){return new BPromise(function(_0x194ecb,_0x102af3){return client['request'](_0x4660be,_0x2e080a)[_0x4b48('0xa')](function(_0x343b76){logger['info'](_0x4b48('0xb'),_0x5a3599,'request\x20sent');logger[_0x4b48('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5a3599,_0x4b48('0xd'),JSON[_0x4b48('0xe')](_0x343b76));if(_0x343b76[_0x4b48('0xf')]){if(_0x343b76[_0x4b48('0xf')]['code']===0x1f4){logger[_0x4b48('0xf')](_0x4b48('0xb'),_0x5a3599,_0x343b76[_0x4b48('0xf')][_0x4b48('0x10')]);return _0x102af3(_0x343b76[_0x4b48('0xf')][_0x4b48('0x10')]);}logger['error'](_0x4b48('0xb'),_0x5a3599,_0x343b76[_0x4b48('0xf')][_0x4b48('0x10')]);return _0x194ecb(_0x343b76[_0x4b48('0xf')]['message']);}else{logger[_0x4b48('0x11')](_0x4b48('0xb'),_0x5a3599,_0x4b48('0xd'));_0x194ecb(_0x343b76['result'][_0x4b48('0x10')]);}})[_0x4b48('0x12')](function(_0x33a9c1){logger[_0x4b48('0xf')](_0x4b48('0xb'),_0x5a3599,_0x33a9c1);_0x102af3(_0x33a9c1);});});}