Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / api / voiceRecording / voiceRecording.controller.js
index c55ed21..2dec624 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd45=['TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','data1','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','status','sendStatus','error','stack','name','send','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','filters','length','options','find','create','body','describe','download','../../components/encryptor','uniqueid','%s.cypher','decryptFile','secrets','recording','existsSync','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','value','Sequelize','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','upload'];(function(_0x212b5d,_0x318113){var _0xd29835=function(_0x39dc22){while(--_0x39dc22){_0x212b5d['push'](_0x212b5d['shift']());}};_0xd29835(++_0x318113);}(_0xbd45,0x15d));var _0x5bd4=function(_0x100c1c,_0x3fe733){_0x100c1c=_0x100c1c-0x0;var _0x5c3d11=_0xbd45[_0x100c1c];return _0x5c3d11;};'use strict';var emlformat=require(_0x5bd4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bd4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bd4('0x2'));var moment=require(_0x5bd4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5bd4('0x4'));var util=require(_0x5bd4('0x5'));var path=require(_0x5bd4('0x6'));var sox=require(_0x5bd4('0x7'));var csv=require(_0x5bd4('0x8'));var ejs=require(_0x5bd4('0x9'));var fs=require('fs');var fs_extra=require(_0x5bd4('0xa'));var _=require(_0x5bd4('0xb'));var squel=require(_0x5bd4('0xc'));var crypto=require(_0x5bd4('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5bd4('0xe'));var Papa=require(_0x5bd4('0xf'));var AWS=require(_0x5bd4('0x10'));var uuidv4=require(_0x5bd4('0x11'));var Redis=require('ioredis');var authService=require(_0x5bd4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5bd4('0x13'));var hardwareService=require(_0x5bd4('0x14'));var logger=require(_0x5bd4('0x15'))(_0x5bd4('0x16'));var utils=require('../../config/utils');var config=require(_0x5bd4('0x17'));var licenseUtil=require(_0x5bd4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e9b15,_0x5ea23e){_0x5ea23e=_0x5ea23e||0xcc;return function(_0x54de7e){if(_0x54de7e){return _0x1e9b15['sendStatus'](_0x5ea23e);}return _0x1e9b15['status'](_0x5ea23e)[_0x5bd4('0x19')]();};}function respondWithResult(_0x34896b,_0x583140){_0x583140=_0x583140||0xc8;return function(_0x1a6a83){if(_0x1a6a83){return _0x34896b['status'](_0x583140)[_0x5bd4('0x1a')](_0x1a6a83);}};}function respondWithFilteredResult(_0xd6ff92,_0x55f3ac){return function(_0x23ca24){if(_0x23ca24){var _0x97f11a=typeof _0x55f3ac[_0x5bd4('0x1b')]===_0x5bd4('0x1c')&&typeof _0x55f3ac[_0x5bd4('0x1d')]===_0x5bd4('0x1c');var _0x4009f4=_0x23ca24['count'];var _0x29840c=_0x97f11a?0x0:_0x55f3ac[_0x5bd4('0x1b')];var _0x1641a7=_0x97f11a?_0x23ca24[_0x5bd4('0x1e')]:_0x55f3ac[_0x5bd4('0x1b')]+_0x55f3ac[_0x5bd4('0x1d')];var _0x773590;if(_0x1641a7>=_0x4009f4){_0x1641a7=_0x4009f4;_0x773590=0xc8;}else{_0x773590=0xce;}_0xd6ff92['status'](_0x773590);return _0xd6ff92[_0x5bd4('0x1f')]('Content-Range',_0x29840c+'-'+_0x1641a7+'/'+_0x4009f4)[_0x5bd4('0x1a')](_0x23ca24);}return null;};}function patchUpdates(_0x422a98){return function(_0xea7416){try{jsonpatch[_0x5bd4('0x20')](_0xea7416,_0x422a98,!![]);}catch(_0x2037b3){return BPromise['reject'](_0x2037b3);}return _0xea7416[_0x5bd4('0x21')]();};}function saveUpdates(_0x9652e7,_0x36dbc2){return function(_0x420cca){if(_0x420cca){return _0x420cca[_0x5bd4('0x22')](_0x9652e7)['then'](function(_0x1b5739){return _0x1b5739;});}return null;};}function removeEntity(_0x1502e0,_0x55b08a){return function(_0x2c7f42){if(_0x2c7f42){return _0x2c7f42[_0x5bd4('0x23')]()[_0x5bd4('0x24')](function(){_0x1502e0[_0x5bd4('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x243fa6,_0x228f59){return function(_0x402912){if(!_0x402912){_0x243fa6[_0x5bd4('0x26')](0x194);}return _0x402912;};}function handleError(_0x5357c4,_0x5656e7){_0x5656e7=_0x5656e7||0x1f4;return function(_0x2ac428){logger[_0x5bd4('0x27')](_0x2ac428[_0x5bd4('0x28')]);if(_0x2ac428[_0x5bd4('0x29')]){delete _0x2ac428['name'];}_0x5357c4['status'](_0x5656e7)[_0x5bd4('0x2a')](_0x2ac428);};}exports['index']=function(_0x5df026,_0x217745){var _0x48289a={},_0x36979e={},_0x3586b1={'count':0x0,'rows':[]};var _0x238fd4=_['map'](db[_0x5bd4('0x2b')][_0x5bd4('0x2c')],function(_0x5adc14){return{'name':_0x5adc14[_0x5bd4('0x2d')],'type':_0x5adc14[_0x5bd4('0x2e')][_0x5bd4('0x2f')]};});_0x36979e[_0x5bd4('0x30')]=_[_0x5bd4('0x31')](_[_0x5bd4('0x32')](_0x238fd4,_0x5bd4('0x29')),[_0x5bd4('0x33')]);_0x36979e[_0x5bd4('0x34')]=_[_0x5bd4('0x35')](_0x5df026[_0x5bd4('0x34')]);_0x36979e['filters']=_[_0x5bd4('0x36')](_0x36979e[_0x5bd4('0x30')],_0x36979e[_0x5bd4('0x34')]);_0x48289a[_0x5bd4('0x37')]=_[_0x5bd4('0x36')](_0x36979e[_0x5bd4('0x30')],qs['fields'](_0x5df026['query'][_0x5bd4('0x38')]));_0x48289a['attributes']=_0x48289a[_0x5bd4('0x37')]['length']?_0x48289a[_0x5bd4('0x37')]:_0x36979e[_0x5bd4('0x30')];if(!_0x5df026[_0x5bd4('0x34')][_0x5bd4('0x39')](_0x5bd4('0x3a'))){_0x48289a[_0x5bd4('0x1d')]=qs[_0x5bd4('0x1d')](_0x5df026[_0x5bd4('0x34')][_0x5bd4('0x1d')]);_0x48289a[_0x5bd4('0x1b')]=qs[_0x5bd4('0x1b')](_0x5df026[_0x5bd4('0x34')]['offset']);}_0x48289a[_0x5bd4('0x3b')]=qs['sort'](_0x5df026['query'][_0x5bd4('0x3c')]);_0x48289a[_0x5bd4('0x3d')]=qs['filters'](_[_0x5bd4('0x3e')](_0x5df026[_0x5bd4('0x34')],_0x36979e['filters']),_0x238fd4);if(_0x5df026[_0x5bd4('0x34')]['filter']){_0x48289a[_0x5bd4('0x3d')]=_[_0x5bd4('0x3f')](_0x48289a['where'],{'$or':_[_0x5bd4('0x32')](_0x238fd4,function(_0x723b84){if(_0x723b84['type']!==_0x5bd4('0x40')){var _0x44cfb7={};_0x44cfb7[_0x723b84[_0x5bd4('0x29')]]={'$like':'%'+_0x5df026[_0x5bd4('0x34')]['filter']+'%'};return _0x44cfb7;}})});}_0x48289a=_[_0x5bd4('0x3f')]({},_0x48289a,_0x5df026['options']);var _0x24e82c={'where':_0x48289a[_0x5bd4('0x3d')]};return db[_0x5bd4('0x2b')]['count'](_0x24e82c)[_0x5bd4('0x24')](function(_0xfc2a6f){_0x3586b1['count']=_0xfc2a6f;if(_0x5df026[_0x5bd4('0x34')][_0x5bd4('0x41')]){_0x48289a[_0x5bd4('0x42')]=[{'all':!![]}];}return db[_0x5bd4('0x2b')][_0x5bd4('0x43')](_0x48289a);})['then'](function(_0x321ca8){_0x3586b1[_0x5bd4('0x44')]=_0x321ca8;return _0x3586b1;})[_0x5bd4('0x24')](respondWithFilteredResult(_0x217745,_0x48289a))[_0x5bd4('0x45')](handleError(_0x217745,null));};exports[_0x5bd4('0x46')]=function(_0x1ec296,_0xb560ee){var _0x1440e6={'raw':![],'where':{'id':_0x1ec296[_0x5bd4('0x47')]['id']}},_0x328971={};_0x328971[_0x5bd4('0x30')]=_[_0x5bd4('0x35')](db[_0x5bd4('0x2b')][_0x5bd4('0x2c')]);_0x328971[_0x5bd4('0x34')]=_[_0x5bd4('0x35')](_0x1ec296['query']);_0x328971[_0x5bd4('0x48')]=_[_0x5bd4('0x36')](_0x328971[_0x5bd4('0x30')],_0x328971['query']);_0x1440e6[_0x5bd4('0x37')]=_[_0x5bd4('0x36')](_0x328971[_0x5bd4('0x30')],qs[_0x5bd4('0x38')](_0x1ec296[_0x5bd4('0x34')][_0x5bd4('0x38')]));_0x1440e6[_0x5bd4('0x37')]=_0x1440e6[_0x5bd4('0x37')][_0x5bd4('0x49')]?_0x1440e6[_0x5bd4('0x37')]:_0x328971[_0x5bd4('0x30')];if(_0x1ec296[_0x5bd4('0x34')]['includeAll']){_0x1440e6[_0x5bd4('0x42')]=[{'all':!![]}];}_0x1440e6=_['merge']({},_0x1440e6,_0x1ec296[_0x5bd4('0x4a')]);return db['VoiceRecording'][_0x5bd4('0x4b')](_0x1440e6)[_0x5bd4('0x24')](handleEntityNotFound(_0xb560ee,null))['then'](respondWithResult(_0xb560ee,null))['catch'](handleError(_0xb560ee,null));};exports[_0x5bd4('0x4c')]=function(_0x32b8f3,_0x5ec736){return db[_0x5bd4('0x2b')][_0x5bd4('0x4c')](_0x32b8f3['body'],{})[_0x5bd4('0x24')](respondWithResult(_0x5ec736,0xc9))[_0x5bd4('0x45')](handleError(_0x5ec736,null));};exports['update']=function(_0x4914ba,_0xfc030c){if(_0x4914ba['body']['id']){delete _0x4914ba[_0x5bd4('0x4d')]['id'];}return db[_0x5bd4('0x2b')]['find']({'where':{'id':_0x4914ba[_0x5bd4('0x47')]['id']}})[_0x5bd4('0x24')](handleEntityNotFound(_0xfc030c,null))[_0x5bd4('0x24')](saveUpdates(_0x4914ba['body'],null))[_0x5bd4('0x24')](respondWithResult(_0xfc030c,null))[_0x5bd4('0x45')](handleError(_0xfc030c,null));};exports[_0x5bd4('0x4e')]=function(_0x36331e,_0x28baab){return db[_0x5bd4('0x2b')]['describe']()[_0x5bd4('0x24')](respondWithResult(_0x28baab,null))[_0x5bd4('0x45')](handleError(_0x28baab,null));};exports[_0x5bd4('0x4f')]=function(_0x1187c5,_0x36b611,_0x54893b){var _0x3b8582=require(_0x5bd4('0x50'));var _0x3541c0=![];var _0x4df8c0={};if(_0x1187c5[_0x5bd4('0x34')][_0x5bd4('0x2e')]&&_0x1187c5[_0x5bd4('0x34')][_0x5bd4('0x2e')]==='uniqueid'){_0x4df8c0[_0x5bd4('0x51')]=_0x1187c5['params']['id'];}else{_0x4df8c0['id']=_0x1187c5[_0x5bd4('0x47')]['id'];}return db[_0x5bd4('0x2b')]['find']({'where':_0x4df8c0,'attributes':['id','value'],'raw':!![]})[_0x5bd4('0x24')](handleEntityNotFound(_0x36b611,null))[_0x5bd4('0x24')](function(_0x31f912){if(_0x31f912){var _0xd665df=_0x31f912['value'];var _0x457e19=util[_0x5bd4('0x33')](_0x5bd4('0x52'),_0xd665df);if(fs['existsSync'](_0x457e19)){_0x3541c0=!![];return _0x3b8582[_0x5bd4('0x53')](_0x457e19,_0xd665df,config[_0x5bd4('0x54')][_0x5bd4('0x55')])[_0x5bd4('0x24')](function(){return _0x31f912;});}return _0x31f912;}})[_0x5bd4('0x24')](function(_0x3054c2){if(_0x3054c2){var _0x253527=_0x3054c2['value'];if(!fs[_0x5bd4('0x56')](_0x253527)){throw new db['Sequelize'][(_0x5bd4('0x57'))](_0x5bd4('0x58'));}if(_0x3054c2[_0x5bd4('0x59')]){return _0x36b611[_0x5bd4('0x4f')](_0x253527,_0x3054c2[_0x5bd4('0x59')]+path['extname'](_0x253527),function(){if(_0x3541c0){fs[_0x5bd4('0x5a')](_0x253527);}});}else{return _0x36b611['download'](_0x253527,function(_0x18106e){if(_0x3541c0){fs[_0x5bd4('0x5a')](_0x253527);}});}}})[_0x5bd4('0x45')](function(_0x2beffa){if(_0x2beffa['message']===_0x5bd4('0x58')){_0x36b611['status'](0x194)[_0x5bd4('0x2a')](_0x5bd4('0x5b'));}else{return handleError(_0x36b611,null);}});};exports[_0x5bd4('0x5c')]=function(_0x17d756,_0x4c469a,_0x5d582c){var _0x34232d=require('../../components/encryptor');var _0x346c0e=![];var _0x116f85={'$and':[db['sequelize'][_0x5bd4('0x3d')](db[_0x5bd4('0x5d')]['fn'](_0x5bd4('0x5e'),db[_0x5bd4('0x5d')][_0x5bd4('0x5f')](_0x5bd4('0x51'))),_0x17d756[_0x5bd4('0x34')][_0x5bd4('0x60')])]};if(_0x17d756[_0x5bd4('0x34')]['type']&&_0x17d756[_0x5bd4('0x34')][_0x5bd4('0x2e')]===_0x5bd4('0x51')){_0x116f85[_0x5bd4('0x61')]['push']({'uniqueid':_0x17d756[_0x5bd4('0x47')]['id']});}else{_0x116f85[_0x5bd4('0x61')][_0x5bd4('0x62')]({'id':_0x17d756[_0x5bd4('0x47')]['id']});}return db[_0x5bd4('0x2b')][_0x5bd4('0x4b')]({'where':_0x116f85,'attributes':['id',_0x5bd4('0x63')],'raw':!![]})[_0x5bd4('0x24')](handleEntityNotFound(_0x4c469a,null))[_0x5bd4('0x24')](function(_0x213be0){if(_0x213be0){var _0x479caa=util[_0x5bd4('0x33')](_0x5bd4('0x52'),_0x213be0[_0x5bd4('0x63')]);if(fs[_0x5bd4('0x56')](_0x479caa)){_0x346c0e=!![];return _0x34232d[_0x5bd4('0x53')](_0x479caa,_0x213be0[_0x5bd4('0x63')],config[_0x5bd4('0x54')][_0x5bd4('0x55')])[_0x5bd4('0x24')](function(){return _0x213be0;});}return _0x213be0;}})[_0x5bd4('0x24')](function(_0x5c9813){if(_0x5c9813){if(!fs['existsSync'](_0x5c9813[_0x5bd4('0x63')])){throw new db[(_0x5bd4('0x64'))]['ValidationError'](_0x5bd4('0x58'));}if(_0x5c9813[_0x5bd4('0x59')]){return _0x4c469a['download'](_0x5c9813[_0x5bd4('0x63')],_0x5c9813[_0x5bd4('0x59')]+path[_0x5bd4('0x65')](_0x5c9813[_0x5bd4('0x63')]),function(){if(_0x346c0e){fs[_0x5bd4('0x5a')](_0x5c9813['value']);}});}else{return _0x4c469a[_0x5bd4('0x4f')](_0x5c9813[_0x5bd4('0x63')],function(_0x120306){if(_0x346c0e){fs[_0x5bd4('0x5a')](_0x5c9813[_0x5bd4('0x63')]);}});}}})['catch'](handleError(_0x4c469a,null));};exports[_0x5bd4('0x23')]=function(_0x3d9bd0,_0x3dbfd2){return db[_0x5bd4('0x2b')][_0x5bd4('0x4b')]({'where':{'id':_0x3d9bd0[_0x5bd4('0x47')]['id']}})[_0x5bd4('0x24')](function(_0x3995f3){if(_[_0x5bd4('0x66')](_0x3995f3)){throw new ReferenceError(_0x5bd4('0x67'));}return _0x3995f3;})[_0x5bd4('0x24')](function(_0xda062f){var _0x24caba=_0xda062f['value'];logger[_0x5bd4('0x68')](_0x5bd4('0x69'),_0x24caba);if(!_['isNil'](_0xda062f[_0x5bd4('0x63')])&&fs['existsSync'](_0x24caba)){logger[_0x5bd4('0x68')]('File:\x20\x22'+_0x24caba+_0x5bd4('0x6a'));fs[_0x5bd4('0x6b')](_0x24caba);}_0x24caba=_0x24caba+'.cypher';if(!_[_0x5bd4('0x66')](_0xda062f[_0x5bd4('0x63')])&&fs['existsSync'](_0x24caba)){logger['info']('File:\x20\x22'+_0x24caba+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5bd4('0x6b')](_0x24caba);}return _0xda062f;})[_0x5bd4('0x24')](function(_0x2e88b1){if(!_0x2e88b1)throw new InternalError();return _0x2e88b1[_0x5bd4('0x23')]();})[_0x5bd4('0x24')](function(){_0x3dbfd2[_0x5bd4('0x25')](0xcc)[_0x5bd4('0x19')]();})['catch'](handleError(_0x3dbfd2,null));};function getBucketslist(_0x1dab08,_0x414748,_0x2028c7){return new Promise(function(_0x3842c2,_0x1e4522){var _0x30a314=new AWS['S3']({'accessKeyId':_0x414748,'secretAccessKey':_0x1dab08,'region':_0x2028c7});_0x30a314[_0x5bd4('0x6c')]({},function(_0x1279cf,_0x4e54a2){if(_0x1279cf){return _0x1e4522(_0x1279cf);}else{return _0x3842c2(_0x4e54a2);}});});}function createBucket(_0x4eaf08,_0x4e2a40,_0x52c58a,_0x215a5f){return new Promise(function(_0x308f4d,_0x526f94){var _0x5f5194=new AWS['S3']({'accessKeyId':_0x4e2a40,'secretAccessKey':_0x4eaf08,'region':_0x52c58a});_0x5f5194['createBucket']({'Bucket':_0x215a5f},function(_0x4c8707,_0x51e003){if(_0x4c8707){return _0x526f94(_0x4c8707);}else{return _0x308f4d(_0x51e003);}});});}function uploadFile(_0x540ef0,_0x57aa78,_0x5e252c,_0x3a9630,_0x2652a0,_0x8d6177){return new Promise(function(_0x30d5a5,_0x541dbe){var _0x4e27f5=new AWS['S3']({'accessKeyId':_0x57aa78,'secretAccessKey':_0x540ef0,'region':_0x5e252c});_0x4e27f5[_0x5bd4('0x6d')]({'Bucket':_0x3a9630,'Key':_0x2652a0,'Body':_0x8d6177},function(_0x368491,_0x5ea606){if(_0x368491){return _0x541dbe(_0x368491);}else{return _0x30d5a5(_0x5ea606);}});});}function startTranscribe(_0x2a34a1,_0x1916c9,_0x4a9b4c,_0x513663,_0x45901d,_0x5c696b){return new Promise(function(_0x162b06,_0x260a34){var _0x11d048=new AWS[(_0x5bd4('0x6e'))]({'accessKeyId':_0x1916c9,'secretAccessKey':_0x2a34a1,'region':_0x4a9b4c});_0x11d048[_0x5bd4('0x6f')]({'TranscriptionJobName':_0x513663,'LanguageCode':_0x45901d,'Media':{'MediaFileUri':_0x5c696b}},function(_0x2918e2,_0x144155){if(_0x2918e2){return _0x260a34(_0x2918e2);}else{return _0x162b06(_0x144155);}});});}function transcribe(_0x3c019c,_0x4aa4bc,_0x58b965,_0x51e3ed,_0x17bf9a,_0x65528a,_0x13e5a9){return new Promise(function(_0x5403b2,_0x44ed08){var _0x203db2={};logger[_0x5bd4('0x68')](util[_0x5bd4('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x3c019c,_0x17bf9a));return uploadFile(_0x4aa4bc,_0x58b965,_0x51e3ed,_0x17bf9a,path['basename'](_0x65528a),fs[_0x5bd4('0x70')](_0x65528a))[_0x5bd4('0x24')](function(_0x486e94){logger[_0x5bd4('0x68')](util['format'](_0x5bd4('0x71'),_0x3c019c,_0x17bf9a,_0x486e94[_0x5bd4('0x72')]));_0x203db2[_0x5bd4('0x73')]=_0x486e94[_0x5bd4('0x74')];_0x203db2[_0x5bd4('0x75')]=_0x486e94['Location'];logger[_0x5bd4('0x68')](util[_0x5bd4('0x33')](_0x5bd4('0x76'),_0x3c019c));return startTranscribe(_0x4aa4bc,_0x58b965,_0x51e3ed,uuidv4(),_0x13e5a9,_0x486e94['Location']);})[_0x5bd4('0x24')](function(_0x541a47){logger[_0x5bd4('0x68')](util['format'](_0x5bd4('0x77'),_0x3c019c,_0x541a47[_0x5bd4('0x78')][_0x5bd4('0x79')]));_0x203db2[_0x5bd4('0x7a')]=_0x541a47[_0x5bd4('0x78')][_0x5bd4('0x79')];_0x203db2[_0x5bd4('0x7b')]=_0x541a47['TranscriptionJob'][_0x5bd4('0x7c')];return _0x5403b2(_0x203db2);})['catch'](function(_0x5b6240){return _0x44ed08(_0x5b6240);});});}exports[_0x5bd4('0x7d')]=function(_0x152666,_0x29730a,_0x3b09f4){var _0x21b4c9;var _0x393586;var _0x1308e5;var _0x1930de=require(_0x5bd4('0x50'));return db['VoiceRecording'][_0x5bd4('0x7e')]({'where':{'id':_0x152666[_0x5bd4('0x47')]['id']}})[_0x5bd4('0x24')](function(_0x54e78c){if(_0x54e78c){var _0x4ddfff=util[_0x5bd4('0x33')](_0x5bd4('0x52'),_0x54e78c[_0x5bd4('0x63')]);if(fs['existsSync'](_0x4ddfff)){cypher=!![];return _0x1930de['decryptFile'](_0x4ddfff,_0x54e78c[_0x5bd4('0x63')],config[_0x5bd4('0x54')]['recording'])[_0x5bd4('0x24')](function(){return _0x54e78c;});}return _0x54e78c;}})[_0x5bd4('0x24')](function(_0x26d837){if(!_0x26d837){throw new db[(_0x5bd4('0x64'))][(_0x5bd4('0x57'))](_0x5bd4('0x7f'));}_0x393586=_0x26d837;return db[_0x5bd4('0x80')][_0x5bd4('0x7e')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x29730a,null))['then'](function(_0x115a72){if(_0x115a72){_0x21b4c9=_0x115a72;if(!_0x21b4c9[_0x5bd4('0x81')]||!_0x21b4c9[_0x5bd4('0x82')]||!_0x21b4c9['transcribeRegion']||!_0x21b4c9[_0x5bd4('0x83')]||!_0x21b4c9[_0x5bd4('0x73')]){throw new db['Sequelize'][(_0x5bd4('0x57'))](_0x5bd4('0x84'));}if(_0x152666[_0x5bd4('0x4d')][_0x5bd4('0x85')]&&(!_0x21b4c9[_0x5bd4('0x86')]||!_0x21b4c9['sentimentAccountId']||!_0x21b4c9[_0x5bd4('0x87')]||!_0x21b4c9['language']||!_0x21b4c9['bucket'])){throw new db['Sequelize'][(_0x5bd4('0x57'))](_0x5bd4('0x88'));}return db['CloudProvider'][_0x5bd4('0x7e')]({'where':{'id':_0x21b4c9[_0x5bd4('0x82')]}});}})['then'](function(_0x2bb82a){if(!_0x2bb82a){throw new db[(_0x5bd4('0x64'))][(_0x5bd4('0x57'))](_0x5bd4('0x89'));}if(!_0x2bb82a['data1']||!_0x2bb82a[_0x5bd4('0x8a')]){throw new db[(_0x5bd4('0x64'))][(_0x5bd4('0x57'))]('Cloud\x20Provider\x20not\x20configured');}_0x1308e5=_0x2bb82a;return getBucketslist(_0x1308e5[_0x5bd4('0x8b')],_0x1308e5[_0x5bd4('0x8a')],_0x21b4c9[_0x5bd4('0x8c')]);})[_0x5bd4('0x24')](function(_0xbdd213){if(_0xbdd213&&_0xbdd213[_0x5bd4('0x8d')]){var _0x43db44=_['find'](_0xbdd213[_0x5bd4('0x8d')],function(_0x39b1d7){return _0x39b1d7[_0x5bd4('0x8e')]===_0x21b4c9[_0x5bd4('0x73')];});if(!_0x43db44){logger[_0x5bd4('0x68')](util[_0x5bd4('0x33')](_0x5bd4('0x8f'),_0x152666['params']['id'],_0x21b4c9[_0x5bd4('0x73')]));return createBucket(_0x1308e5[_0x5bd4('0x8b')],_0x1308e5[_0x5bd4('0x8a')],_0x21b4c9[_0x5bd4('0x8c')],_0x21b4c9[_0x5bd4('0x73')]);}logger[_0x5bd4('0x68')](util[_0x5bd4('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x152666[_0x5bd4('0x47')]['id'],_0x21b4c9[_0x5bd4('0x73')]));return;}})[_0x5bd4('0x24')](function(_0x4c09f3){if(_0x393586[_0x5bd4('0x7b')]===_0x5bd4('0x90')){return transcribe(_0x152666[_0x5bd4('0x47')]['id'],_0x1308e5[_0x5bd4('0x8b')],_0x1308e5[_0x5bd4('0x8a')],_0x21b4c9[_0x5bd4('0x8c')],_0x21b4c9[_0x5bd4('0x73')],_0x393586[_0x5bd4('0x63')],_0x21b4c9['language']);}else{logger[_0x5bd4('0x68')](util['format'](_0x5bd4('0x91'),_0x152666[_0x5bd4('0x47')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x11d27c){if(_0x11d27c){_0x11d27c[_0x5bd4('0x92')]=_0x152666['body'][_0x5bd4('0x85')];return _0x393586[_0x5bd4('0x93')](_0x11d27c);}})[_0x5bd4('0x24')](respondWithResult(_0x29730a,null))[_0x5bd4('0x45')](handleError(_0x29730a,null));};function writeFile(_0x1b305d,_0x40233b){return new Promise(function(_0x5183df,_0x22b802){fs['writeFile'](_0x40233b,_0x1b305d,function(_0x289ef8,_0x172999){if(_0x289ef8){return _0x22b802(_0x289ef8);}else{return _0x5183df(_0x172999);}});});}exports[_0x5bd4('0x94')]=function(_0x1e6104,_0x1fd2cf,_0x2cb9e8){return db[_0x5bd4('0x2b')][_0x5bd4('0x7e')]({'where':{'id':_0x1e6104['params']['id']}})[_0x5bd4('0x24')](handleEntityNotFound(_0x1fd2cf))['then'](function(_0x4ae29b){if(_0x4ae29b&&_0x4ae29b[_0x5bd4('0x95')]){var _0x32817d=_0x4ae29b[_0x5bd4('0x95')];var _0x1fd555=config['root']+_0x5bd4('0x96')+_0x4ae29b['id']+_0x5bd4('0x97');if(fs['existsSync'](_0x1fd555)){return _0x1fd555;}return writeFile(_0x32817d,_0x1fd555)[_0x5bd4('0x24')](function(){return _0x1fd555;});}else{throw new db[(_0x5bd4('0x64'))][(_0x5bd4('0x57'))](_0x5bd4('0x98'));}})[_0x5bd4('0x24')](function(_0x125115){return _0x1fd2cf[_0x5bd4('0x4f')](_0x125115);})[_0x5bd4('0x45')](handleError(_0x1fd2cf));};
\ No newline at end of file
+var _0x391e=['TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','Setting','transcribe','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','CloudProvider','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','map','VoiceRecording','fieldName','type','key','format','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','describe','../../components/encryptor','value','existsSync','decryptFile','recording','Sequelize','ValidationError','filename','download','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','sequelize','col','token','$and','push','secrets','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus'];(function(_0x343af8,_0x34185e){var _0x38c094=function(_0x4fa8c0){while(--_0x4fa8c0){_0x343af8['push'](_0x343af8['shift']());}};_0x38c094(++_0x34185e);}(_0x391e,0xb8));var _0xe391=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x391e[_0x11005e];return _0x29338f;};'use strict';var emlformat=require(_0xe391('0x0'));var rimraf=require(_0xe391('0x1'));var zipdir=require(_0xe391('0x2'));var jsonpatch=require(_0xe391('0x3'));var rp=require(_0xe391('0x4'));var moment=require(_0xe391('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe391('0x6'));var util=require(_0xe391('0x7'));var path=require(_0xe391('0x8'));var sox=require(_0xe391('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe391('0xa'));var _=require('lodash');var squel=require(_0xe391('0xb'));var crypto=require(_0xe391('0xc'));var jsforce=require(_0xe391('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe391('0xe'));var querystring=require(_0xe391('0xf'));var Papa=require('papaparse');var AWS=require(_0xe391('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0xe391('0x11'));var authService=require(_0xe391('0x12'));var qs=require(_0xe391('0x13'));var as=require(_0xe391('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe391('0x15'))(_0xe391('0x16'));var utils=require(_0xe391('0x17'));var config=require(_0xe391('0x18'));var licenseUtil=require(_0xe391('0x19'));var db=require(_0xe391('0x1a'))['db'];function respondWithStatusCode(_0x4152cd,_0x44428c){_0x44428c=_0x44428c||0xcc;return function(_0x207533){if(_0x207533){return _0x4152cd['sendStatus'](_0x44428c);}return _0x4152cd[_0xe391('0x1b')](_0x44428c)[_0xe391('0x1c')]();};}function respondWithResult(_0x29e25d,_0x20de8f){_0x20de8f=_0x20de8f||0xc8;return function(_0x86df1e){if(_0x86df1e){return _0x29e25d[_0xe391('0x1b')](_0x20de8f)[_0xe391('0x1d')](_0x86df1e);}};}function respondWithFilteredResult(_0x3c4a51,_0x5f9068){return function(_0xe82076){if(_0xe82076){var _0x5cde3a=typeof _0x5f9068['offset']===_0xe391('0x1e')&&typeof _0x5f9068[_0xe391('0x1f')]===_0xe391('0x1e');var _0x185460=_0xe82076[_0xe391('0x20')];var _0x5239f3=_0x5cde3a?0x0:_0x5f9068['offset'];var _0x20276a=_0x5cde3a?_0xe82076[_0xe391('0x20')]:_0x5f9068[_0xe391('0x21')]+_0x5f9068[_0xe391('0x1f')];var _0x5318e7;if(_0x20276a>=_0x185460){_0x20276a=_0x185460;_0x5318e7=0xc8;}else{_0x5318e7=0xce;}_0x3c4a51['status'](_0x5318e7);return _0x3c4a51[_0xe391('0x22')](_0xe391('0x23'),_0x5239f3+'-'+_0x20276a+'/'+_0x185460)['json'](_0xe82076);}return null;};}function patchUpdates(_0xd44cd1){return function(_0xa27a80){try{jsonpatch[_0xe391('0x24')](_0xa27a80,_0xd44cd1,!![]);}catch(_0x1d2d0f){return BPromise[_0xe391('0x25')](_0x1d2d0f);}return _0xa27a80['save']();};}function saveUpdates(_0x2aba26,_0x4b458d){return function(_0x200152){if(_0x200152){return _0x200152[_0xe391('0x26')](_0x2aba26)[_0xe391('0x27')](function(_0xdfbd6){return _0xdfbd6;});}return null;};}function removeEntity(_0x554076,_0x4f9ecc){return function(_0x2967ea){if(_0x2967ea){return _0x2967ea[_0xe391('0x28')]()['then'](function(){_0x554076[_0xe391('0x1b')](0xcc)[_0xe391('0x1c')]();});}};}function handleEntityNotFound(_0x91d39f,_0x35cb6c){return function(_0x57894b){if(!_0x57894b){_0x91d39f[_0xe391('0x29')](0x194);}return _0x57894b;};}function handleError(_0x45f38b,_0x4fe468){_0x4fe468=_0x4fe468||0x1f4;return function(_0x24f1c6){logger[_0xe391('0x2a')](_0x24f1c6[_0xe391('0x2b')]);if(_0x24f1c6[_0xe391('0x2c')]){delete _0x24f1c6['name'];}_0x45f38b[_0xe391('0x1b')](_0x4fe468)['send'](_0x24f1c6);};}exports['index']=function(_0x597632,_0x53cc4c){var _0x5455db={},_0x3c2015={},_0x1b1b1c={'count':0x0,'rows':[]};var _0x1d198e=_[_0xe391('0x2d')](db[_0xe391('0x2e')]['rawAttributes'],function(_0x5ae499){return{'name':_0x5ae499[_0xe391('0x2f')],'type':_0x5ae499[_0xe391('0x30')][_0xe391('0x31')]};});_0x3c2015['model']=_['differenceBy'](_[_0xe391('0x2d')](_0x1d198e,_0xe391('0x2c')),[_0xe391('0x32')]);_0x3c2015['query']=_['keys'](_0x597632[_0xe391('0x33')]);_0x3c2015['filters']=_[_0xe391('0x34')](_0x3c2015[_0xe391('0x35')],_0x3c2015['query']);_0x5455db['attributes']=_[_0xe391('0x34')](_0x3c2015[_0xe391('0x35')],qs[_0xe391('0x36')](_0x597632[_0xe391('0x33')][_0xe391('0x36')]));_0x5455db[_0xe391('0x37')]=_0x5455db[_0xe391('0x37')][_0xe391('0x38')]?_0x5455db[_0xe391('0x37')]:_0x3c2015[_0xe391('0x35')];if(!_0x597632[_0xe391('0x33')][_0xe391('0x39')](_0xe391('0x3a'))){_0x5455db[_0xe391('0x1f')]=qs['limit'](_0x597632[_0xe391('0x33')]['limit']);_0x5455db[_0xe391('0x21')]=qs[_0xe391('0x21')](_0x597632[_0xe391('0x33')]['offset']);}_0x5455db[_0xe391('0x3b')]=qs[_0xe391('0x3c')](_0x597632[_0xe391('0x33')][_0xe391('0x3c')]);_0x5455db['where']=qs[_0xe391('0x3d')](_[_0xe391('0x3e')](_0x597632[_0xe391('0x33')],_0x3c2015[_0xe391('0x3d')]),_0x1d198e);if(_0x597632[_0xe391('0x33')][_0xe391('0x3f')]){_0x5455db['where']=_[_0xe391('0x40')](_0x5455db[_0xe391('0x41')],{'$or':_[_0xe391('0x2d')](_0x1d198e,function(_0x26ef95){if(_0x26ef95[_0xe391('0x30')]!==_0xe391('0x42')){var _0x26c5e2={};_0x26c5e2[_0x26ef95[_0xe391('0x2c')]]={'$like':'%'+_0x597632[_0xe391('0x33')][_0xe391('0x3f')]+'%'};return _0x26c5e2;}})});}_0x5455db=_['merge']({},_0x5455db,_0x597632[_0xe391('0x43')]);var _0xf2d5c1={'where':_0x5455db[_0xe391('0x41')]};return db[_0xe391('0x2e')][_0xe391('0x20')](_0xf2d5c1)[_0xe391('0x27')](function(_0x51d4e3){_0x1b1b1c[_0xe391('0x20')]=_0x51d4e3;if(_0x597632[_0xe391('0x33')]['includeAll']){_0x5455db[_0xe391('0x44')]=[{'all':!![]}];}return db[_0xe391('0x2e')][_0xe391('0x45')](_0x5455db);})[_0xe391('0x27')](function(_0x16677f){_0x1b1b1c[_0xe391('0x46')]=_0x16677f;return _0x1b1b1c;})[_0xe391('0x27')](respondWithFilteredResult(_0x53cc4c,_0x5455db))[_0xe391('0x47')](handleError(_0x53cc4c,null));};exports['show']=function(_0x3fc612,_0x434be4){var _0x42d4d6={'raw':![],'where':{'id':_0x3fc612[_0xe391('0x48')]['id']}},_0x3911b7={};_0x3911b7[_0xe391('0x35')]=_[_0xe391('0x49')](db[_0xe391('0x2e')]['rawAttributes']);_0x3911b7[_0xe391('0x33')]=_[_0xe391('0x49')](_0x3fc612[_0xe391('0x33')]);_0x3911b7['filters']=_[_0xe391('0x34')](_0x3911b7['model'],_0x3911b7[_0xe391('0x33')]);_0x42d4d6[_0xe391('0x37')]=_[_0xe391('0x34')](_0x3911b7[_0xe391('0x35')],qs[_0xe391('0x36')](_0x3fc612[_0xe391('0x33')][_0xe391('0x36')]));_0x42d4d6[_0xe391('0x37')]=_0x42d4d6['attributes'][_0xe391('0x38')]?_0x42d4d6[_0xe391('0x37')]:_0x3911b7[_0xe391('0x35')];if(_0x3fc612[_0xe391('0x33')][_0xe391('0x4a')]){_0x42d4d6[_0xe391('0x44')]=[{'all':!![]}];}_0x42d4d6=_['merge']({},_0x42d4d6,_0x3fc612['options']);return db['VoiceRecording'][_0xe391('0x4b')](_0x42d4d6)[_0xe391('0x27')](handleEntityNotFound(_0x434be4,null))[_0xe391('0x27')](respondWithResult(_0x434be4,null))[_0xe391('0x47')](handleError(_0x434be4,null));};exports['create']=function(_0x4d0f58,_0x28dbdf){return db[_0xe391('0x2e')][_0xe391('0x4c')](_0x4d0f58['body'],{})[_0xe391('0x27')](respondWithResult(_0x28dbdf,0xc9))['catch'](handleError(_0x28dbdf,null));};exports['update']=function(_0x56f093,_0x189ea9){if(_0x56f093['body']['id']){delete _0x56f093[_0xe391('0x4d')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x56f093[_0xe391('0x48')]['id']}})['then'](handleEntityNotFound(_0x189ea9,null))['then'](saveUpdates(_0x56f093[_0xe391('0x4d')],null))['then'](respondWithResult(_0x189ea9,null))[_0xe391('0x47')](handleError(_0x189ea9,null));};exports[_0xe391('0x4e')]=function(_0x4b4297,_0x466c0a){return db[_0xe391('0x2e')][_0xe391('0x4e')]()[_0xe391('0x27')](respondWithResult(_0x466c0a,null))[_0xe391('0x47')](handleError(_0x466c0a,null));};exports['download']=function(_0x2a7b79,_0x2252f3,_0x390910){var _0xebdbe0=require(_0xe391('0x4f'));var _0x17d57d=![];var _0x737aed={};if(_0x2a7b79[_0xe391('0x33')][_0xe391('0x30')]&&_0x2a7b79[_0xe391('0x33')]['type']==='uniqueid'){_0x737aed['uniqueid']=_0x2a7b79[_0xe391('0x48')]['id'];}else{_0x737aed['id']=_0x2a7b79[_0xe391('0x48')]['id'];}return db['VoiceRecording'][_0xe391('0x4b')]({'where':_0x737aed,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x2252f3,null))[_0xe391('0x27')](function(_0x245103){if(_0x245103){var _0x5669de=_0x245103[_0xe391('0x50')];var _0x30574b=util[_0xe391('0x32')]('%s.cypher',_0x5669de);if(fs[_0xe391('0x51')](_0x30574b)){_0x17d57d=!![];return _0xebdbe0[_0xe391('0x52')](_0x30574b,_0x5669de,config['secrets'][_0xe391('0x53')])[_0xe391('0x27')](function(){return _0x245103;});}return _0x245103;}})[_0xe391('0x27')](function(_0x4e0cbc){if(_0x4e0cbc){var _0x4b17d5=_0x4e0cbc[_0xe391('0x50')];if(!fs[_0xe391('0x51')](_0x4b17d5)){throw new db[(_0xe391('0x54'))][(_0xe391('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x4e0cbc[_0xe391('0x56')]){return _0x2252f3[_0xe391('0x57')](_0x4b17d5,_0x4e0cbc[_0xe391('0x56')]+path[_0xe391('0x58')](_0x4b17d5),function(){if(_0x17d57d){fs[_0xe391('0x59')](_0x4b17d5);}});}else{return _0x2252f3[_0xe391('0x57')](_0x4b17d5,function(_0x74c10){if(_0x17d57d){fs[_0xe391('0x59')](_0x4b17d5);}});}}})['catch'](function(_0x36e819){if(_0x36e819[_0xe391('0x5a')]===_0xe391('0x5b')){_0x2252f3['status'](0x194)[_0xe391('0x5c')](_0xe391('0x5d'));}else{return handleError(_0x2252f3,null);}});};exports['downloads']=function(_0x4e75a9,_0x1f68e5,_0x458bfb){var _0x5346c8=require(_0xe391('0x4f'));var _0xc5dc26=![];var _0xedd192={'$and':[db[_0xe391('0x5e')][_0xe391('0x41')](db[_0xe391('0x5e')]['fn']('MD5',db[_0xe391('0x5e')][_0xe391('0x5f')]('uniqueid')),_0x4e75a9[_0xe391('0x33')][_0xe391('0x60')])]};if(_0x4e75a9[_0xe391('0x33')][_0xe391('0x30')]&&_0x4e75a9[_0xe391('0x33')][_0xe391('0x30')]==='uniqueid'){_0xedd192[_0xe391('0x61')][_0xe391('0x62')]({'uniqueid':_0x4e75a9[_0xe391('0x48')]['id']});}else{_0xedd192[_0xe391('0x61')][_0xe391('0x62')]({'id':_0x4e75a9['params']['id']});}return db['VoiceRecording']['find']({'where':_0xedd192,'attributes':['id','value'],'raw':!![]})[_0xe391('0x27')](handleEntityNotFound(_0x1f68e5,null))['then'](function(_0x2f5197){if(_0x2f5197){var _0xa34f85=util[_0xe391('0x32')]('%s.cypher',_0x2f5197['value']);if(fs[_0xe391('0x51')](_0xa34f85)){_0xc5dc26=!![];return _0x5346c8[_0xe391('0x52')](_0xa34f85,_0x2f5197['value'],config[_0xe391('0x63')]['recording'])['then'](function(){return _0x2f5197;});}return _0x2f5197;}})[_0xe391('0x27')](function(_0x1ee2bd){if(_0x1ee2bd){if(!fs[_0xe391('0x51')](_0x1ee2bd[_0xe391('0x50')])){throw new db[(_0xe391('0x54'))]['ValidationError'](_0xe391('0x5b'));}if(_0x1ee2bd[_0xe391('0x56')]){return _0x1f68e5[_0xe391('0x57')](_0x1ee2bd['value'],_0x1ee2bd[_0xe391('0x56')]+path['extname'](_0x1ee2bd['value']),function(){if(_0xc5dc26){fs[_0xe391('0x59')](_0x1ee2bd[_0xe391('0x50')]);}});}else{return _0x1f68e5[_0xe391('0x57')](_0x1ee2bd[_0xe391('0x50')],function(_0x284aed){if(_0xc5dc26){fs[_0xe391('0x59')](_0x1ee2bd[_0xe391('0x50')]);}});}}})[_0xe391('0x47')](handleError(_0x1f68e5,null));};exports[_0xe391('0x28')]=function(_0x5a7f54,_0x558316){return db[_0xe391('0x2e')][_0xe391('0x4b')]({'where':{'id':_0x5a7f54[_0xe391('0x48')]['id']}})[_0xe391('0x27')](function(_0x2ce3ab){if(_[_0xe391('0x64')](_0x2ce3ab)){throw new ReferenceError(_0xe391('0x65'));}return _0x2ce3ab;})[_0xe391('0x27')](function(_0x12a593){var _0xb428d9=_0x12a593[_0xe391('0x50')];logger[_0xe391('0x66')](_0xe391('0x67'),_0xb428d9);if(!_[_0xe391('0x64')](_0x12a593['value'])&&fs[_0xe391('0x51')](_0xb428d9)){logger[_0xe391('0x66')]('File:\x20\x22'+_0xb428d9+_0xe391('0x68'));fs[_0xe391('0x69')](_0xb428d9);}_0xb428d9=_0xb428d9+_0xe391('0x6a');if(!_['isNil'](_0x12a593[_0xe391('0x50')])&&fs[_0xe391('0x51')](_0xb428d9)){logger[_0xe391('0x66')](_0xe391('0x6b')+_0xb428d9+_0xe391('0x68'));fs['unlinkSync'](_0xb428d9);}return _0x12a593;})['then'](function(_0x10237e){if(!_0x10237e)throw new InternalError();return _0x10237e['destroy']();})[_0xe391('0x27')](function(){_0x558316[_0xe391('0x1b')](0xcc)[_0xe391('0x1c')]();})[_0xe391('0x47')](handleError(_0x558316,null));};function getBucketslist(_0xed65c0,_0x341a67,_0x3e9b8e){return new Promise(function(_0x49ec11,_0xbbe532){var _0xfaceba=new AWS['S3']({'accessKeyId':_0x341a67,'secretAccessKey':_0xed65c0,'region':_0x3e9b8e});_0xfaceba[_0xe391('0x6c')]({},function(_0x415f1a,_0x4e30b3){if(_0x415f1a){return _0xbbe532(_0x415f1a);}else{return _0x49ec11(_0x4e30b3);}});});}function createBucket(_0x4cefc4,_0x421511,_0x5a824b,_0x78aa6d){return new Promise(function(_0x170f03,_0x73d338){var _0x46bc33=new AWS['S3']({'accessKeyId':_0x421511,'secretAccessKey':_0x4cefc4,'region':_0x5a824b});_0x46bc33[_0xe391('0x6d')]({'Bucket':_0x78aa6d},function(_0x27e01f,_0x27a20f){if(_0x27e01f){return _0x73d338(_0x27e01f);}else{return _0x170f03(_0x27a20f);}});});}function uploadFile(_0x2252f0,_0x2fe904,_0x31f7e7,_0x8309c8,_0x5b088c,_0x19e1a7){return new Promise(function(_0x56360d,_0x19ef35){var _0x1be7c3=new AWS['S3']({'accessKeyId':_0x2fe904,'secretAccessKey':_0x2252f0,'region':_0x31f7e7});_0x1be7c3[_0xe391('0x6e')]({'Bucket':_0x8309c8,'Key':_0x5b088c,'Body':_0x19e1a7},function(_0x692fea,_0x37dd25){if(_0x692fea){return _0x19ef35(_0x692fea);}else{return _0x56360d(_0x37dd25);}});});}function startTranscribe(_0x14d725,_0x22b20e,_0xb0beee,_0x4c004f,_0x104b78,_0x844c22){return new Promise(function(_0xcde64f,_0x2d1152){var _0x46f9a2=new AWS[(_0xe391('0x6f'))]({'accessKeyId':_0x22b20e,'secretAccessKey':_0x14d725,'region':_0xb0beee});_0x46f9a2[_0xe391('0x70')]({'TranscriptionJobName':_0x4c004f,'LanguageCode':_0x104b78,'Media':{'MediaFileUri':_0x844c22}},function(_0x16cf99,_0x4217f8){if(_0x16cf99){return _0x2d1152(_0x16cf99);}else{return _0xcde64f(_0x4217f8);}});});}function transcribe(_0x1f004f,_0x44ee3c,_0x4cb724,_0x2f7cc4,_0x500c44,_0x48b81d,_0x4f0d15){return new Promise(function(_0x3bddb0,_0x1fff2c){var _0xcb2947={};logger[_0xe391('0x66')](util['format'](_0xe391('0x71'),_0x1f004f,_0x500c44));return uploadFile(_0x44ee3c,_0x4cb724,_0x2f7cc4,_0x500c44,path[_0xe391('0x72')](_0x48b81d),fs[_0xe391('0x73')](_0x48b81d))[_0xe391('0x27')](function(_0x3a1232){logger[_0xe391('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x1f004f,_0x500c44,_0x3a1232[_0xe391('0x74')]));_0xcb2947[_0xe391('0x75')]=_0x3a1232['Bucket'];_0xcb2947[_0xe391('0x76')]=_0x3a1232[_0xe391('0x74')];logger[_0xe391('0x66')](util['format'](_0xe391('0x77'),_0x1f004f));return startTranscribe(_0x44ee3c,_0x4cb724,_0x2f7cc4,uuidv4(),_0x4f0d15,_0x3a1232[_0xe391('0x74')]);})[_0xe391('0x27')](function(_0x17e893){logger[_0xe391('0x66')](util[_0xe391('0x32')](_0xe391('0x78'),_0x1f004f,_0x17e893[_0xe391('0x79')][_0xe391('0x7a')]));_0xcb2947['transcribeName']=_0x17e893[_0xe391('0x79')][_0xe391('0x7a')];_0xcb2947[_0xe391('0x7b')]=_0x17e893['TranscriptionJob'][_0xe391('0x7c')];return _0x3bddb0(_0xcb2947);})['catch'](function(_0x249392){return _0x1fff2c(_0x249392);});});}exports[_0xe391('0x7d')]=function(_0x4846f9,_0x58f759,_0x327c91){var _0x296dfc;var _0x288ae0;var _0x44e701;var _0x302a95=require('../../components/encryptor');return db[_0xe391('0x2e')][_0xe391('0x7e')]({'where':{'id':_0x4846f9[_0xe391('0x48')]['id']}})[_0xe391('0x27')](function(_0x4bc039){if(_0x4bc039){var _0x5cde86=util[_0xe391('0x32')](_0xe391('0x7f'),_0x4bc039['value']);if(fs[_0xe391('0x51')](_0x5cde86)){cypher=!![];return _0x302a95[_0xe391('0x52')](_0x5cde86,_0x4bc039[_0xe391('0x50')],config['secrets']['recording'])[_0xe391('0x27')](function(){return _0x4bc039;});}return _0x4bc039;}})[_0xe391('0x27')](function(_0x49d0c5){if(!_0x49d0c5){throw new db[(_0xe391('0x54'))][(_0xe391('0x55'))](_0xe391('0x80'));}_0x288ae0=_0x49d0c5;return db[_0xe391('0x81')][_0xe391('0x7e')]({'where':{'id':0x1}});})[_0xe391('0x27')](handleEntityNotFound(_0x58f759,null))['then'](function(_0x21eadf){if(_0x21eadf){_0x296dfc=_0x21eadf;if(!_0x296dfc[_0xe391('0x82')]||!_0x296dfc['transcribeAccountId']||!_0x296dfc['transcribeRegion']||!_0x296dfc[_0xe391('0x83')]||!_0x296dfc[_0xe391('0x75')]){throw new db[(_0xe391('0x54'))][(_0xe391('0x55'))](_0xe391('0x84'));}if(_0x4846f9[_0xe391('0x4d')][_0xe391('0x85')]&&(!_0x296dfc['sentiment']||!_0x296dfc[_0xe391('0x86')]||!_0x296dfc[_0xe391('0x87')]||!_0x296dfc[_0xe391('0x83')]||!_0x296dfc['bucket'])){throw new db[(_0xe391('0x54'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xe391('0x88')][_0xe391('0x7e')]({'where':{'id':_0x296dfc[_0xe391('0x89')]}});}})[_0xe391('0x27')](function(_0x20e3fc){if(!_0x20e3fc){throw new db[(_0xe391('0x54'))][(_0xe391('0x55'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x20e3fc[_0xe391('0x8a')]||!_0x20e3fc[_0xe391('0x8b')]){throw new db['Sequelize'][(_0xe391('0x55'))](_0xe391('0x8c'));}_0x44e701=_0x20e3fc;return getBucketslist(_0x44e701[_0xe391('0x8a')],_0x44e701[_0xe391('0x8b')],_0x296dfc[_0xe391('0x8d')]);})['then'](function(_0x57ff7c){if(_0x57ff7c&&_0x57ff7c[_0xe391('0x8e')]){var _0x5cd070=_[_0xe391('0x4b')](_0x57ff7c[_0xe391('0x8e')],function(_0x32729c){return _0x32729c[_0xe391('0x8f')]===_0x296dfc[_0xe391('0x75')];});if(!_0x5cd070){logger['info'](util[_0xe391('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4846f9[_0xe391('0x48')]['id'],_0x296dfc[_0xe391('0x75')]));return createBucket(_0x44e701['data1'],_0x44e701[_0xe391('0x8b')],_0x296dfc[_0xe391('0x8d')],_0x296dfc[_0xe391('0x75')]);}logger[_0xe391('0x66')](util[_0xe391('0x32')](_0xe391('0x90'),_0x4846f9[_0xe391('0x48')]['id'],_0x296dfc[_0xe391('0x75')]));return;}})['then'](function(_0x3997f2){if(_0x288ae0[_0xe391('0x7b')]===_0xe391('0x91')){return transcribe(_0x4846f9[_0xe391('0x48')]['id'],_0x44e701['data1'],_0x44e701['data2'],_0x296dfc['transcribeRegion'],_0x296dfc[_0xe391('0x75')],_0x288ae0['value'],_0x296dfc['language']);}else{logger[_0xe391('0x66')](util[_0xe391('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4846f9['params']['id']));return{'transcribeStatus':_0xe391('0x92')};}})[_0xe391('0x27')](function(_0xf33e6e){if(_0xf33e6e){_0xf33e6e[_0xe391('0x93')]=_0x4846f9['body'][_0xe391('0x85')];return _0x288ae0['updateAttributes'](_0xf33e6e);}})['then'](respondWithResult(_0x58f759,null))[_0xe391('0x47')](handleError(_0x58f759,null));};function writeFile(_0x21245d,_0x505393){return new Promise(function(_0x2960c9,_0x529a24){fs[_0xe391('0x94')](_0x505393,_0x21245d,function(_0x40db62,_0x529c85){if(_0x40db62){return _0x529a24(_0x40db62);}else{return _0x2960c9(_0x529c85);}});});}exports[_0xe391('0x95')]=function(_0x553601,_0x218afd,_0x5c8f2c){return db['VoiceRecording'][_0xe391('0x7e')]({'where':{'id':_0x553601[_0xe391('0x48')]['id']}})[_0xe391('0x27')](handleEntityNotFound(_0x218afd))['then'](function(_0x32e942){if(_0x32e942&&_0x32e942[_0xe391('0x96')]){var _0x17e25b=_0x32e942[_0xe391('0x96')];var _0x239e3b=config[_0xe391('0x97')]+_0xe391('0x98')+_0x32e942['id']+_0xe391('0x99');if(fs[_0xe391('0x51')](_0x239e3b)){return _0x239e3b;}return writeFile(_0x17e25b,_0x239e3b)[_0xe391('0x27')](function(){return _0x239e3b;});}else{throw new db['Sequelize'][(_0xe391('0x55'))]('Transcript\x20not\x20available');}})[_0xe391('0x27')](function(_0x507f50){return _0x218afd[_0xe391('0x57')](_0x507f50);})[_0xe391('0x47')](handleError(_0x218afd));};
\ No newline at end of file