1d7cf131ed328d23d12e15409e4c42f0b1ae3f87
[motion2.git] / server / api / voiceDialReport / voiceDialReport.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 _0xd89a=['code','message','result','VoiceDialReport','body','options','then','CreateVoiceDialReport','debug','UpdateVoiceDialReport','update','attributes','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0xd89a,0x151));var _0xad89=function(_0x192b1e,_0x578930){_0x192b1e=_0x192b1e-0x0;var _0x5db684=_0xd89a[_0x192b1e];return _0x5db684;};'use strict';var _=require('lodash');var util=require(_0xad89('0x0'));var moment=require(_0xad89('0x1'));var BPromise=require(_0xad89('0x2'));var rs=require(_0xad89('0x3'));var fs=require('fs');var Redis=require(_0xad89('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xad89('0x5'));var logger=require(_0xad89('0x6'))(_0xad89('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x560f2f,_0x1842d3,_0x1e2f3c){return new BPromise(function(_0x9ed3ea,_0x107ff5){return client['request'](_0x560f2f,_0x1e2f3c)['then'](function(_0x2532f6){logger[_0xad89('0x8')](_0xad89('0x9'),_0x1842d3,_0xad89('0xa'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1842d3,_0xad89('0xa'),JSON[_0xad89('0xb')](_0x2532f6));if(_0x2532f6['error']){if(_0x2532f6[_0xad89('0xc')][_0xad89('0xd')]===0x1f4){logger[_0xad89('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x1842d3,_0x2532f6['error'][_0xad89('0xe')]);return _0x107ff5(_0x2532f6[_0xad89('0xc')]['message']);}logger['error'](_0xad89('0x9'),_0x1842d3,_0x2532f6['error'][_0xad89('0xe')]);return _0x9ed3ea(_0x2532f6[_0xad89('0xc')][_0xad89('0xe')]);}else{logger[_0xad89('0x8')](_0xad89('0x9'),_0x1842d3,'request\x20sent');_0x9ed3ea(_0x2532f6[_0xad89('0xf')][_0xad89('0xe')]);}})['catch'](function(_0xf2ef8e){logger[_0xad89('0xc')](_0xad89('0x9'),_0x1842d3,_0xf2ef8e);_0x107ff5(_0xf2ef8e);});});}exports['CreateVoiceDialReport']=function(_0x53be39){var _0xeb055f=this;return new Promise(function(_0x2f1fc4,_0x13f8e3){return db[_0xad89('0x10')]['create'](_0x53be39[_0xad89('0x11')],{'raw':_0x53be39[_0xad89('0x12')]?_0x53be39[_0xad89('0x12')]['raw']===undefined?!![]:![]:!![]})[_0xad89('0x13')](function(_0x3ad5da){logger['info'](_0xad89('0x14'),_0x53be39);logger[_0xad89('0x15')]('CreateVoiceDialReport',_0x53be39,JSON[_0xad89('0xb')](_0x3ad5da));_0x2f1fc4(_0x3ad5da);})['catch'](function(_0x3ec5b8){logger['error']('CreateVoiceDialReport',_0x3ec5b8[_0xad89('0xe')],_0x53be39);_0x13f8e3(_0xeb055f['error'](0x1f4,_0x3ec5b8[_0xad89('0xe')]));});});};exports[_0xad89('0x16')]=function(_0x1e458d){var _0x4f964d=this;return new Promise(function(_0x436a0f,_0x399d58){return db['VoiceDialReport'][_0xad89('0x17')](_0x1e458d[_0xad89('0x11')],{'raw':_0x1e458d[_0xad89('0x12')]?_0x1e458d[_0xad89('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e458d[_0xad89('0x12')]?_0x1e458d['options']['where']||null:null,'attributes':_0x1e458d['options']?_0x1e458d[_0xad89('0x12')][_0xad89('0x18')]||null:null,'limit':_0x1e458d['options']?_0x1e458d[_0xad89('0x12')]['limit']||null:null})['then'](function(_0x5c0da0){logger[_0xad89('0x8')](_0xad89('0x16'),_0x1e458d);logger[_0xad89('0x15')](_0xad89('0x16'),_0x1e458d,JSON[_0xad89('0xb')](_0x5c0da0));_0x436a0f(_0x5c0da0);})['catch'](function(_0x3f2e1b){logger['error'](_0xad89('0x16'),_0x3f2e1b[_0xad89('0xe')],_0x1e458d);_0x399d58(_0x4f964d[_0xad89('0xc')](0x1f4,_0x3f2e1b[_0xad89('0xe')]));});});};