Built motion from commit c738b9ac.|2.6.25
[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 _0xa9a9=['error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x4c3a2f,_0x53e16c){var _0x35cec4=function(_0x3da3a5){while(--_0x3da3a5){_0x4c3a2f['push'](_0x4c3a2f['shift']());}};_0x35cec4(++_0x53e16c);}(_0xa9a9,0x12c));var _0x9a9a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa9a9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9a9a('0x0'));var util=require('util');var moment=require(_0x9a9a('0x1'));var BPromise=require(_0x9a9a('0x2'));var rs=require(_0x9a9a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a9a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a9a('0x5'))(_0x9a9a('0x6'));var config=require(_0x9a9a('0x7'));var jayson=require(_0x9a9a('0x8'));var client=jayson[_0x9a9a('0x9')][_0x9a9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f13b5,_0x7e7cf9,_0x191157){return new BPromise(function(_0x365cb9,_0x14728b){return client[_0x9a9a('0xb')](_0x4f13b5,_0x191157)['then'](function(_0x2bb613){logger[_0x9a9a('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x7e7cf9,_0x9a9a('0xd'));logger[_0x9a9a('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x7e7cf9,_0x9a9a('0xd'),JSON['stringify'](_0x2bb613));if(_0x2bb613['error']){if(_0x2bb613[_0x9a9a('0xf')][_0x9a9a('0x10')]===0x1f4){logger[_0x9a9a('0xf')](_0x9a9a('0x11'),_0x7e7cf9,_0x2bb613['error'][_0x9a9a('0x12')]);return _0x14728b(_0x2bb613[_0x9a9a('0xf')]['message']);}logger['error'](_0x9a9a('0x11'),_0x7e7cf9,_0x2bb613[_0x9a9a('0xf')]['message']);return _0x365cb9(_0x2bb613[_0x9a9a('0xf')][_0x9a9a('0x12')]);}else{logger['info'](_0x9a9a('0x11'),_0x7e7cf9,'request\x20sent');_0x365cb9(_0x2bb613[_0x9a9a('0x13')][_0x9a9a('0x12')]);}})[_0x9a9a('0x14')](function(_0x4900f8){logger[_0x9a9a('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x7e7cf9,_0x4900f8);_0x14728b(_0x4900f8);});});}