8a485865a3cf39e4ef971636836f469d5a0ac783
[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 _0x8a54=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','info','debug','request\x20sent','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash'];(function(_0x40a2cd,_0x549aa9){var _0x30022e=function(_0x537f75){while(--_0x537f75){_0x40a2cd['push'](_0x40a2cd['shift']());}};_0x30022e(++_0x549aa9);}(_0x8a54,0xfb));var _0x48a5=function(_0x441fd0,_0x3ffbea){_0x441fd0=_0x441fd0-0x0;var _0x4154a7=_0x8a54[_0x441fd0];return _0x4154a7;};'use strict';var _=require(_0x48a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x48a5('0x1'));var rs=require(_0x48a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x48a5('0x3'))('rpc');var config=require(_0x48a5('0x4'));var jayson=require(_0x48a5('0x5'));var client=jayson[_0x48a5('0x6')][_0x48a5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a9c22,_0x54557e,_0x5141eb){return new BPromise(function(_0x4f2e81,_0x4c7865){return client['request'](_0x2a9c22,_0x5141eb)['then'](function(_0x36af2c){logger[_0x48a5('0x8')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x54557e,'request\x20sent');logger[_0x48a5('0x9')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x54557e,_0x48a5('0xa'),JSON[_0x48a5('0xb')](_0x36af2c));if(_0x36af2c[_0x48a5('0xc')]){if(_0x36af2c[_0x48a5('0xc')][_0x48a5('0xd')]===0x1f4){logger[_0x48a5('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x54557e,_0x36af2c[_0x48a5('0xc')][_0x48a5('0xe')]);return _0x4c7865(_0x36af2c[_0x48a5('0xc')]['message']);}logger[_0x48a5('0xc')](_0x48a5('0xf'),_0x54557e,_0x36af2c[_0x48a5('0xc')][_0x48a5('0xe')]);return _0x4f2e81(_0x36af2c[_0x48a5('0xc')]['message']);}else{logger['info'](_0x48a5('0xf'),_0x54557e,_0x48a5('0xa'));_0x4f2e81(_0x36af2c[_0x48a5('0x10')][_0x48a5('0xe')]);}})[_0x48a5('0x11')](function(_0x378760){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x54557e,_0x378760);_0x4c7865(_0x378760);});});}