Built motion from commit (unavailable).|2.3.10
[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 _0x595c=['code','message','info','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2c7b8e,_0x27d472){var _0x53eb65=function(_0x467dc2){while(--_0x467dc2){_0x2c7b8e['push'](_0x2c7b8e['shift']());}};_0x53eb65(++_0x27d472);}(_0x595c,0x147));var _0xc595=function(_0x1b58c1,_0x616a39){_0x1b58c1=_0x1b58c1-0x0;var _0x87c861=_0x595c[_0x1b58c1];return _0x87c861;};'use strict';var _=require('lodash');var util=require(_0xc595('0x0'));var moment=require(_0xc595('0x1'));var BPromise=require(_0xc595('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc595('0x3'));var logger=require(_0xc595('0x4'))(_0xc595('0x5'));var config=require(_0xc595('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc595('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10c9cf,_0x3781ba,_0x394aa9){return new BPromise(function(_0x3f20b2,_0x497b80){return client['request'](_0x10c9cf,_0x394aa9)[_0xc595('0x8')](function(_0x11ac0a){logger['info'](_0xc595('0x9'),_0x3781ba,_0xc595('0xa'));logger[_0xc595('0xb')](_0xc595('0xc'),_0x3781ba,'request\x20sent',JSON[_0xc595('0xd')](_0x11ac0a));if(_0x11ac0a['error']){if(_0x11ac0a[_0xc595('0xe')][_0xc595('0xf')]===0x1f4){logger[_0xc595('0xe')](_0xc595('0x9'),_0x3781ba,_0x11ac0a[_0xc595('0xe')][_0xc595('0x10')]);return _0x497b80(_0x11ac0a['error']['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x3781ba,_0x11ac0a['error'][_0xc595('0x10')]);return _0x3f20b2(_0x11ac0a['error'][_0xc595('0x10')]);}else{logger[_0xc595('0x11')](_0xc595('0x9'),_0x3781ba,_0xc595('0xa'));_0x3f20b2(_0x11ac0a['result'][_0xc595('0x10')]);}})[_0xc595('0x12')](function(_0x51282e){logger[_0xc595('0xe')](_0xc595('0x9'),_0x3781ba,_0x51282e);_0x497b80(_0x51282e);});});}