Built motion from commit b5413ace.|2.6.9
[motion2.git] / server / api / voiceRecording / voiceRecording.rpc.js
index b37bdfd..5de942a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1967=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','debug','Setting','findOne','existsSync','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x1967,0x173));var _0x7196=function(_0x5190a1,_0x4b50ee){_0x5190a1=_0x5190a1-0x0;var _0x44070c=_0x1967[_0x5190a1];return _0x44070c;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});}exports[_0x7196('0x18')]=function(_0x32fe2b){var _0x385f2d=this;return new Promise(function(_0x5b716a,_0x4c4f91){return db[_0x7196('0x19')][_0x7196('0x1a')](_0x32fe2b[_0x7196('0x1b')],{'raw':_0x32fe2b['options']?_0x32fe2b[_0x7196('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fe2b['options']?_0x32fe2b[_0x7196('0x1c')][_0x7196('0x1d')]||null:null,'attributes':_0x32fe2b[_0x7196('0x1c')]?_0x32fe2b['options']['attributes']||null:null,'limit':_0x32fe2b[_0x7196('0x1c')]?_0x32fe2b[_0x7196('0x1c')]['limit']||null:null})[_0x7196('0xd')](function(_0x27ff84){logger[_0x7196('0xe')](_0x7196('0x18'),_0x32fe2b);logger[_0x7196('0x1e')]('UpdateVoiceRecording',_0x32fe2b,JSON[_0x7196('0x12')](_0x27ff84));_0x5b716a(_0x27ff84);})['catch'](function(_0x3ce9a0){logger[_0x7196('0x13')](_0x7196('0x18'),_0x3ce9a0[_0x7196('0x15')],_0x32fe2b);_0x4c4f91(_0x385f2d[_0x7196('0x13')](0x1f4,_0x3ce9a0[_0x7196('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x57c404){var _0x1482e5=this;return new Promise(function(_0x2d284f,_0x184c09){var _0x4e878f=require('../../components/encryptor');var _0x41cfd2;return db[_0x7196('0x1f')][_0x7196('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x7196('0xd')](function(_0x4ecea1){_0x41cfd2=_0x4ecea1;return db[_0x7196('0x19')]['create'](_0x57c404[_0x7196('0x1b')]);})[_0x7196('0xd')](function(_0x1257ad){if(_0x41cfd2['callRecordingEncryption']&&fs[_0x7196('0x21')](_0x1257ad[_0x7196('0x22')])){var _0x2f9583=util[_0x7196('0x23')]('%s.cypher',_0x1257ad[_0x7196('0x22')]);return _0x4e878f[_0x7196('0x24')](_0x1257ad[_0x7196('0x22')],_0x2f9583,config[_0x7196('0x25')][_0x7196('0x26')])[_0x7196('0xd')](function(){fs[_0x7196('0x27')](_0x1257ad[_0x7196('0x22')]);logger[_0x7196('0xe')](_0x7196('0x28'));return _0x1257ad;});}return _0x1257ad;})[_0x7196('0xd')](function(_0x54e46b){logger[_0x7196('0xe')]('CreateVoiceRecording',_0x57c404);logger[_0x7196('0x1e')]('CreateVoiceRecording',_0x57c404,JSON[_0x7196('0x12')](_0x54e46b));_0x2d284f(_0x54e46b);})[_0x7196('0x17')](function(_0x5616ed){logger[_0x7196('0x13')](_0x7196('0x29'),_0x5616ed[_0x7196('0x15')],_0x57c404);_0x184c09(_0x1482e5[_0x7196('0x13')](0x1f4,_0x5616ed[_0x7196('0x15')]));});});};
\ No newline at end of file
+var _0x4325=['attributes','CreateVoiceRecording','Setting','findOne','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where'];(function(_0x3c642a,_0x35223b){var _0x9db7d6=function(_0x4d0d8d){while(--_0x4d0d8d){_0x3c642a['push'](_0x3c642a['shift']());}};_0x9db7d6(++_0x35223b);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')](_0x32fe60[_0x5432('0x1a')],{'raw':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fe60['options']?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1d')]||null:null,'attributes':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1e')]||null:null,'limit':_0x32fe60['options']?_0x32fe60['options']['limit']||null:null})[_0x5432('0xb')](function(_0xb900f2){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger['debug']('UpdateVoiceRecording',_0x32fe60,JSON[_0x5432('0x10')](_0xb900f2));_0x5f011f(_0xb900f2);})[_0x5432('0x16')](function(_0x4a40fc){logger[_0x5432('0x12')](_0x5432('0x17'),_0x4a40fc[_0x5432('0x13')],_0x32fe60);_0x3f3873(_0x4221a8['error'](0x1f4,_0x4a40fc[_0x5432('0x13')]));});});};exports[_0x5432('0x1f')]=function(_0xe7eda2){var _0x520da1=this;return new Promise(function(_0x4ab09d,_0x1f2055){var _0x2114b8=require('../../components/encryptor');var _0x1abe73;return db[_0x5432('0x20')][_0x5432('0x21')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5432('0xb')](function(_0x5be867){_0x1abe73=_0x5be867;return db['VoiceRecording'][_0x5432('0x22')](_0xe7eda2['body']);})[_0x5432('0xb')](function(_0x578281){if(_0x1abe73['callRecordingEncryption']&&fs[_0x5432('0x23')](_0x578281[_0x5432('0x24')])){var _0x345b51=util['format'](_0x5432('0x25'),_0x578281[_0x5432('0x24')]);return _0x2114b8[_0x5432('0x26')](_0x578281[_0x5432('0x24')],_0x345b51,config[_0x5432('0x27')][_0x5432('0x28')])[_0x5432('0xb')](function(){fs[_0x5432('0x29')](_0x578281[_0x5432('0x24')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x578281;});}return _0x578281;})[_0x5432('0xb')](function(_0x42ab1e){logger[_0x5432('0x14')](_0x5432('0x1f'),_0xe7eda2);logger[_0x5432('0xd')]('CreateVoiceRecording',_0xe7eda2,JSON[_0x5432('0x10')](_0x42ab1e));_0x4ab09d(_0x42ab1e);})['catch'](function(_0x2955e0){logger[_0x5432('0x12')](_0x5432('0x1f'),_0x2955e0[_0x5432('0x13')],_0xe7eda2);_0x1f2055(_0x520da1[_0x5432('0x12')](0x1f4,_0x2955e0[_0x5432('0x13')]));});});};
\ No newline at end of file