3c84a77a9f807fbaaae6520f44bcd9d90a87a399
[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 _0xd00b=['then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request'];(function(_0x1ec3fe,_0x2bbc3d){var _0x23d25b=function(_0x32c1cf){while(--_0x32c1cf){_0x1ec3fe['push'](_0x1ec3fe['shift']());}};_0x23d25b(++_0x2bbc3d);}(_0xd00b,0x1d7));var _0xbd00=function(_0x240253,_0x34bb55){_0x240253=_0x240253-0x0;var _0x179a21=_0xd00b[_0x240253];return _0x179a21;};'use strict';var _=require(_0xbd00('0x0'));var util=require(_0xbd00('0x1'));var moment=require(_0xbd00('0x2'));var BPromise=require(_0xbd00('0x3'));var rs=require(_0xbd00('0x4'));var fs=require('fs');var Redis=require(_0xbd00('0x5'));var db=require(_0xbd00('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd00('0x7'))('rpc');var config=require(_0xbd00('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbd00('0x9')][_0xbd00('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a412c,_0x53cb9c,_0x28ccdc){return new BPromise(function(_0x36df9d,_0x590760){return client[_0xbd00('0xb')](_0x2a412c,_0x28ccdc)[_0xbd00('0xc')](function(_0x5a0259){logger[_0xbd00('0xd')](_0xbd00('0xe'),_0x53cb9c,_0xbd00('0xf'));logger[_0xbd00('0x10')](_0xbd00('0x11'),_0x53cb9c,_0xbd00('0xf'),JSON[_0xbd00('0x12')](_0x5a0259));if(_0x5a0259[_0xbd00('0x13')]){if(_0x5a0259['error'][_0xbd00('0x14')]===0x1f4){logger[_0xbd00('0x13')](_0xbd00('0xe'),_0x53cb9c,_0x5a0259[_0xbd00('0x13')][_0xbd00('0x15')]);return _0x590760(_0x5a0259['error'][_0xbd00('0x15')]);}logger['error'](_0xbd00('0xe'),_0x53cb9c,_0x5a0259[_0xbd00('0x13')][_0xbd00('0x15')]);return _0x36df9d(_0x5a0259[_0xbd00('0x13')][_0xbd00('0x15')]);}else{logger[_0xbd00('0xd')](_0xbd00('0xe'),_0x53cb9c,_0xbd00('0xf'));_0x36df9d(_0x5a0259['result']['message']);}})[_0xbd00('0x16')](function(_0x40c5e7){logger[_0xbd00('0x13')](_0xbd00('0xe'),_0x53cb9c,_0x40c5e7);_0x590760(_0x40c5e7);});});}