9b29eea00760a8c292990866d8ed76f70c39c58a
[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 _0x2fa8=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x1ef1e2,_0x1ab994){var _0x278388=function(_0x215d9b){while(--_0x215d9b){_0x1ef1e2['push'](_0x1ef1e2['shift']());}};_0x278388(++_0x1ab994);}(_0x2fa8,0x1ac));var _0x82fa=function(_0x50304d,_0x29c335){_0x50304d=_0x50304d-0x0;var _0x5b828d=_0x2fa8[_0x50304d];return _0x5b828d;};'use strict';var _=require(_0x82fa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x82fa('0x1'));var rs=require(_0x82fa('0x2'));var fs=require('fs');var Redis=require(_0x82fa('0x3'));var db=require(_0x82fa('0x4'))['db'];var utils=require(_0x82fa('0x5'));var logger=require(_0x82fa('0x6'))('rpc');var config=require(_0x82fa('0x7'));var jayson=require(_0x82fa('0x8'));var client=jayson['client'][_0x82fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x517e59,_0x451a96,_0x2ccdf3){return new BPromise(function(_0x4397f4,_0x18d236){return client['request'](_0x517e59,_0x2ccdf3)[_0x82fa('0xa')](function(_0x240b82){logger[_0x82fa('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x451a96,_0x82fa('0xc'));logger[_0x82fa('0xd')](_0x82fa('0xe'),_0x451a96,_0x82fa('0xc'),JSON[_0x82fa('0xf')](_0x240b82));if(_0x240b82[_0x82fa('0x10')]){if(_0x240b82['error']['code']===0x1f4){logger[_0x82fa('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x451a96,_0x240b82[_0x82fa('0x10')][_0x82fa('0x11')]);return _0x18d236(_0x240b82[_0x82fa('0x10')][_0x82fa('0x11')]);}logger[_0x82fa('0x10')](_0x82fa('0x12'),_0x451a96,_0x240b82[_0x82fa('0x10')]['message']);return _0x4397f4(_0x240b82[_0x82fa('0x10')][_0x82fa('0x11')]);}else{logger[_0x82fa('0xb')](_0x82fa('0x12'),_0x451a96,_0x82fa('0xc'));_0x4397f4(_0x240b82[_0x82fa('0x13')][_0x82fa('0x11')]);}})[_0x82fa('0x14')](function(_0x1a4d7e){logger['error'](_0x82fa('0x12'),_0x451a96,_0x1a4d7e);_0x18d236(_0x1a4d7e);});});}