Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / services / xdr / recordings.controller.js
index ddb52bf..82a24c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc3fa=['.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0xc3fa,0x9f));var _0xac3f=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0xc3fa[_0x4f2c3a];return _0x17d91c;};'use strict';var _=require(_0xac3f('0x0'));var util=require(_0xac3f('0x1'));var utils=require(_0xac3f('0x2'));var recordings={};function writeDB(_0x28876c){utils['info'](util[_0xac3f('0x3')](_0xac3f('0x4'),_0x28876c[_0xac3f('0x5')]));if(_0x28876c[_0xac3f('0x6')]){utils['getUserByInternal'](_0x28876c[_0xac3f('0x6')])[_0xac3f('0x7')](function(_0x5b9d32){if(_0x5b9d32){_0x28876c[_0xac3f('0x8')]=_0x5b9d32[_0xac3f('0x9')];_0x28876c['UserId']=_0x5b9d32['id'];}utils[_0xac3f('0xa')](_0xac3f('0xb'),_0x28876c);});}else{utils[_0xac3f('0xa')](_0xac3f('0xb'),_0x28876c);}}exports['newchannel']=function(_0x445c9f){try{utils[_0xac3f('0xc')](util['format'](_0xac3f('0xd'),_0x445c9f[_0xac3f('0x5')]),_0x445c9f);if(_0x445c9f[_0xac3f('0x5')]==_0x445c9f['linkedid']){utils[_0xac3f('0xe')](util[_0xac3f('0x3')](_0xac3f('0xf'),_0x445c9f[_0xac3f('0x5')],_0x445c9f['context'],_0x445c9f[_0xac3f('0x10')]));recordings[_0x445c9f[_0xac3f('0x5')]]={'uniqueid':_0x445c9f[_0xac3f('0x5')],'accountcode':_0x445c9f[_0xac3f('0x6')],'exten':_0x445c9f['exten'],'context':_0x445c9f['context'],'channel':_0x445c9f[_0xac3f('0x11')],'monitors':[]};}}catch(_0x29733e){utils[_0xac3f('0x12')](util[_0xac3f('0x3')](_0xac3f('0xd'),_0x445c9f[_0xac3f('0x5')]),_0x29733e);}};exports[_0xac3f('0x13')]=function(_0x571e4c){try{utils[_0xac3f('0xc')](util[_0xac3f('0x3')](_0xac3f('0x14'),_0x571e4c[_0xac3f('0x5')]),_0x571e4c);if(!_[_0xac3f('0x15')](recordings[_0x571e4c['uniqueid']])&&_0x571e4c[_0xac3f('0x16')]==0x6){utils[_0xac3f('0xe')](util['format'](_0xac3f('0x17'),_0x571e4c[_0xac3f('0x5')],_0x571e4c[_0xac3f('0x18')],_0x571e4c[_0xac3f('0x11')]));}else if(!_[_0xac3f('0x15')](recordings[_0x571e4c[_0xac3f('0x19')]])&&_0x571e4c['channelstate']==0x6&&_0x571e4c[_0xac3f('0x18')]!=_0xac3f('0x1a')){utils[_0xac3f('0xe')](util[_0xac3f('0x3')](_0xac3f('0x1b'),_0x571e4c[_0xac3f('0x5')],_0x571e4c[_0xac3f('0x19')],_0x571e4c[_0xac3f('0x18')],_0x571e4c['channel']));recordings[_0x571e4c[_0xac3f('0x19')]]['accountcode']=_0x571e4c[_0xac3f('0x6')];}}catch(_0x5012a0){utils['error'](util[_0xac3f('0x3')](_0xac3f('0x14'),_0x571e4c[_0xac3f('0x5')]),_0x5012a0);}};exports[_0xac3f('0x1c')]=function(_0x144c36){try{if(!_[_0xac3f('0x15')](_0x144c36[_0xac3f('0x1d')])&&!_['isNil'](_0x144c36['variable'][_0xac3f('0x1e')])){utils[_0xac3f('0xc')](util[_0xac3f('0x3')](_0xac3f('0x1f'),_0x144c36['uniqueid']),_0x144c36);utils[_0xac3f('0xe')](util[_0xac3f('0x3')](_0xac3f('0x20'),_0x144c36['uniqueid'],_0x144c36[_0xac3f('0x1d')],_0x144c36['value']));if(_['endsWith'](_0x144c36[_0xac3f('0x21')],_0xac3f('0x22'))){_0x144c36[_0xac3f('0x21')]=_0x144c36[_0xac3f('0x21')][_0xac3f('0x23')](_0xac3f('0x22'),_0xac3f('0x24'));}if(recordings[_0x144c36[_0xac3f('0x19')]]){var _0x5a18e0=_[_0xac3f('0x25')](recordings[_0x144c36[_0xac3f('0x19')]]['monitors'],{'value':_0x144c36['value']});if(_[_0xac3f('0x15')](_0x5a18e0)){recordings[_0x144c36[_0xac3f('0x19')]][_0xac3f('0x26')][_0xac3f('0x27')]({'value':_0x144c36[_0xac3f('0x21')]});}}}}catch(_0x3eedc9){utils['error'](util[_0xac3f('0x3')](_0xac3f('0x1f'),_0x144c36[_0xac3f('0x5')]),_0x3eedc9);}};exports['hangup']=function(_0x1977f2){try{if(!_[_0xac3f('0x15')](recordings[_0x1977f2[_0xac3f('0x5')]])){utils['debug'](util[_0xac3f('0x3')](_0xac3f('0x28'),_0x1977f2['uniqueid']),_0x1977f2);utils[_0xac3f('0xe')](util['format'](_0xac3f('0x29'),_0x1977f2[_0xac3f('0x5')],_0x1977f2[_0xac3f('0x2a')],_0x1977f2['calleridname'],_0x1977f2[_0xac3f('0x2b')]));recordings[_0x1977f2[_0xac3f('0x5')]][_0xac3f('0x2a')]=_0x1977f2[_0xac3f('0x2a')];recordings[_0x1977f2[_0xac3f('0x5')]][_0xac3f('0x2c')]=_0x1977f2[_0xac3f('0x2c')];recordings[_0x1977f2['uniqueid']]['connectedlinenum']=_0x1977f2[_0xac3f('0x2d')];recordings[_0x1977f2[_0xac3f('0x5')]]['connectedlinename']=_0x1977f2[_0xac3f('0x2e')];if(recordings[_0x1977f2[_0xac3f('0x5')]][_0xac3f('0x2f')]==_0xac3f('0x30')&&recordings[_0x1977f2['uniqueid']][_0xac3f('0x6')]){recordings[_0x1977f2[_0xac3f('0x5')]][_0xac3f('0x2d')]=recordings[_0x1977f2[_0xac3f('0x5')]][_0xac3f('0x6')];recordings[_0x1977f2['uniqueid']]['connectedlinename']='';}recordings[_0x1977f2[_0xac3f('0x5')]]['monitors'][_0xac3f('0x31')](function(_0x3281ae){var _0x1fecd0=_[_0xac3f('0x32')](recordings[_0x1977f2[_0xac3f('0x5')]]);_0x1fecd0[_0xac3f('0x21')]=_0x3281ae['value'];writeDB(_0x1fecd0);});delete recordings[_0x1977f2['uniqueid']];}}catch(_0x33bb8d){utils[_0xac3f('0x12')](util[_0xac3f('0x3')](_0xac3f('0x28'),_0x1977f2[_0xac3f('0x5')]),_0x33bb8d);}};exports['newexten']=function(_0x398b29){try{if(!_[_0xac3f('0x15')](recordings[_0x398b29[_0xac3f('0x5')]])){utils[_0xac3f('0xc')](util[_0xac3f('0x3')](_0xac3f('0x33'),_0x398b29[_0xac3f('0x5')]),_0x398b29);utils[_0xac3f('0xe')](util[_0xac3f('0x3')](_0xac3f('0x34'),_0x398b29[_0xac3f('0x5')],_0x398b29[_0xac3f('0x35')],_0x398b29['appdata']));if(_0x398b29[_0xac3f('0x35')][_0xac3f('0x36')]()==_0xac3f('0x37')&&_[_0xac3f('0x38')](_0x398b29['appdata'][_0xac3f('0x36')](),_0xac3f('0x39'))){var _0x1eea47=_0x398b29[_0xac3f('0x3a')]['split']('=');var _0x28ed90=_0x1eea47[0x0][_0xac3f('0x3b')](_0x1eea47[0x0][_0xac3f('0x3c')]('(')+0x1,_0x1eea47[0x0]['lastIndexOf'](')'));var _0x18b9f6=_0x1eea47[0x1];recordings[_0x398b29[_0xac3f('0x5')]][_0x28ed90]=_0x18b9f6;}}}catch(_0x2c5109){utils[_0xac3f('0x12')](util[_0xac3f('0x3')](_0xac3f('0x33'),_0x398b29[_0xac3f('0x5')]),_0x2c5109);}};exports[_0xac3f('0x3d')]=function(_0x1e4c3a){try{if(!_['isNil'](recordings[_0x1e4c3a[_0xac3f('0x5')]])){utils[_0xac3f('0xc')](util[_0xac3f('0x3')](_0xac3f('0x3e'),_0x1e4c3a[_0xac3f('0x5')]),_0x1e4c3a);utils['info'](util['format'](_0xac3f('0x3f'),_0x1e4c3a[_0xac3f('0x5')],_0x1e4c3a[_0xac3f('0x40')]));recordings[_0x1e4c3a[_0xac3f('0x5')]]['queue']=_0x1e4c3a[_0xac3f('0x40')];}}catch(_0x1231a5){utils[_0xac3f('0x12')](util['format'](_0xac3f('0x3e'),_0x1e4c3a[_0xac3f('0x5')]),_0x1231a5);}};
\ No newline at end of file
+var _0xfd89=['accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','monitors','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','format','uniqueid'];(function(_0x431ff8,_0x4085dd){var _0x84ccd4=function(_0x1fd1b5){while(--_0x1fd1b5){_0x431ff8['push'](_0x431ff8['shift']());}};_0x84ccd4(++_0x4085dd);}(_0xfd89,0x1c3));var _0x9fd8=function(_0x1a0244,_0x409722){_0x1a0244=_0x1a0244-0x0;var _0x1c28f3=_0xfd89[_0x1a0244];return _0x1c28f3;};'use strict';var _=require(_0x9fd8('0x0'));var util=require(_0x9fd8('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x4fc9ce){utils[_0x9fd8('0x2')](util[_0x9fd8('0x3')]('[%s][recordings][writeDB]',_0x4fc9ce[_0x9fd8('0x4')]));if(_0x4fc9ce[_0x9fd8('0x5')]){utils[_0x9fd8('0x6')](_0x4fc9ce[_0x9fd8('0x5')])[_0x9fd8('0x7')](function(_0x40d56d){if(_0x40d56d){_0x4fc9ce[_0x9fd8('0x8')]=_0x40d56d[_0x9fd8('0x9')];_0x4fc9ce['UserId']=_0x40d56d['id'];}utils[_0x9fd8('0xa')](_0x9fd8('0xb'),_0x4fc9ce);});}else{utils[_0x9fd8('0xa')](_0x9fd8('0xb'),_0x4fc9ce);}}exports[_0x9fd8('0xc')]=function(_0x90d3ae){try{utils[_0x9fd8('0xd')](util[_0x9fd8('0x3')](_0x9fd8('0xe'),_0x90d3ae[_0x9fd8('0x4')]),_0x90d3ae);if(_0x90d3ae[_0x9fd8('0x4')]==_0x90d3ae[_0x9fd8('0xf')]){utils[_0x9fd8('0x2')](util[_0x9fd8('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x90d3ae[_0x9fd8('0x4')],_0x90d3ae['context'],_0x90d3ae[_0x9fd8('0x10')]));recordings[_0x90d3ae[_0x9fd8('0x4')]]={'uniqueid':_0x90d3ae['uniqueid'],'accountcode':_0x90d3ae[_0x9fd8('0x5')],'exten':_0x90d3ae[_0x9fd8('0x10')],'context':_0x90d3ae['context'],'channel':_0x90d3ae[_0x9fd8('0x11')],'monitors':[]};}}catch(_0x52ecca){utils['error'](util['format'](_0x9fd8('0xe'),_0x90d3ae[_0x9fd8('0x4')]),_0x52ecca);}};exports[_0x9fd8('0x12')]=function(_0x346a5e){try{utils[_0x9fd8('0xd')](util[_0x9fd8('0x3')](_0x9fd8('0x13'),_0x346a5e[_0x9fd8('0x4')]),_0x346a5e);if(!_[_0x9fd8('0x14')](recordings[_0x346a5e['uniqueid']])&&_0x346a5e[_0x9fd8('0x15')]==0x6){utils[_0x9fd8('0x2')](util[_0x9fd8('0x3')](_0x9fd8('0x16'),_0x346a5e[_0x9fd8('0x4')],_0x346a5e[_0x9fd8('0x17')],_0x346a5e['channel']));}else if(!_[_0x9fd8('0x14')](recordings[_0x346a5e['linkedid']])&&_0x346a5e[_0x9fd8('0x15')]==0x6&&_0x346a5e['context']!=_0x9fd8('0x18')){utils['info'](util[_0x9fd8('0x3')](_0x9fd8('0x19'),_0x346a5e[_0x9fd8('0x4')],_0x346a5e[_0x9fd8('0xf')],_0x346a5e[_0x9fd8('0x17')],_0x346a5e[_0x9fd8('0x11')]));recordings[_0x346a5e[_0x9fd8('0xf')]]['accountcode']=_0x346a5e[_0x9fd8('0x5')];}}catch(_0x43f187){utils[_0x9fd8('0x1a')](util[_0x9fd8('0x3')]('[%s][recordings][newstate]',_0x346a5e[_0x9fd8('0x4')]),_0x43f187);}};exports['varset']=function(_0x230717){try{if(!_[_0x9fd8('0x14')](_0x230717['variable'])&&!_[_0x9fd8('0x14')](_0x230717[_0x9fd8('0x1b')][_0x9fd8('0x1c')])){utils['debug'](util[_0x9fd8('0x3')](_0x9fd8('0x1d'),_0x230717[_0x9fd8('0x4')]),_0x230717);utils['info'](util[_0x9fd8('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x230717[_0x9fd8('0x4')],_0x230717[_0x9fd8('0x1b')],_0x230717[_0x9fd8('0x1e')]));if(_[_0x9fd8('0x1f')](_0x230717['value'],_0x9fd8('0x20'))){_0x230717[_0x9fd8('0x1e')]=_0x230717[_0x9fd8('0x1e')][_0x9fd8('0x21')](_0x9fd8('0x20'),_0x9fd8('0x22'));}if(recordings[_0x230717[_0x9fd8('0xf')]]){var _0x274a55=_[_0x9fd8('0x23')](recordings[_0x230717[_0x9fd8('0xf')]]['monitors'],{'value':_0x230717['value']});if(_['isNil'](_0x274a55)){recordings[_0x230717[_0x9fd8('0xf')]]['monitors']['push']({'value':_0x230717[_0x9fd8('0x1e')]});}}}}catch(_0x298b39){utils[_0x9fd8('0x1a')](util[_0x9fd8('0x3')](_0x9fd8('0x1d'),_0x230717['uniqueid']),_0x298b39);}};exports['hangup']=function(_0xb9dd8f){try{if(!_['isNil'](recordings[_0xb9dd8f['uniqueid']])){utils[_0x9fd8('0xd')](util[_0x9fd8('0x3')](_0x9fd8('0x24'),_0xb9dd8f[_0x9fd8('0x4')]),_0xb9dd8f);utils[_0x9fd8('0x2')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0xb9dd8f[_0x9fd8('0x4')],_0xb9dd8f[_0x9fd8('0x25')],_0xb9dd8f[_0x9fd8('0x26')],_0xb9dd8f[_0x9fd8('0x27')]));recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x25')]=_0xb9dd8f[_0x9fd8('0x25')];recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x26')]=_0xb9dd8f[_0x9fd8('0x26')];recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x28')]=_0xb9dd8f[_0x9fd8('0x28')];recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x29')]=_0xb9dd8f[_0x9fd8('0x29')];if(recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x2a')]=='outbound'&&recordings[_0xb9dd8f['uniqueid']][_0x9fd8('0x5')]){recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x28')]=recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x5')];recordings[_0xb9dd8f['uniqueid']][_0x9fd8('0x29')]='';}recordings[_0xb9dd8f[_0x9fd8('0x4')]][_0x9fd8('0x2b')]['forEach'](function(_0x291516){var _0x1cf317=_[_0x9fd8('0x2c')](recordings[_0xb9dd8f[_0x9fd8('0x4')]]);_0x1cf317[_0x9fd8('0x1e')]=_0x291516[_0x9fd8('0x1e')];writeDB(_0x1cf317);});delete recordings[_0xb9dd8f[_0x9fd8('0x4')]];}}catch(_0x37153d){utils[_0x9fd8('0x1a')](util[_0x9fd8('0x3')](_0x9fd8('0x24'),_0xb9dd8f[_0x9fd8('0x4')]),_0x37153d);}};exports[_0x9fd8('0x2d')]=function(_0x51f175){try{if(!_[_0x9fd8('0x14')](recordings[_0x51f175[_0x9fd8('0x4')]])){utils['debug'](util[_0x9fd8('0x3')]('[%s][recordings][newexten]',_0x51f175[_0x9fd8('0x4')]),_0x51f175);utils[_0x9fd8('0x2')](util[_0x9fd8('0x3')](_0x9fd8('0x2e'),_0x51f175['uniqueid'],_0x51f175[_0x9fd8('0x2f')],_0x51f175['appdata']));if(_0x51f175['application'][_0x9fd8('0x30')]()==_0x9fd8('0x31')&&_['startsWith'](_0x51f175['appdata'][_0x9fd8('0x30')](),'cdr')){var _0x35cb81=_0x51f175[_0x9fd8('0x32')][_0x9fd8('0x33')]('=');var _0x21a088=_0x35cb81[0x0]['substring'](_0x35cb81[0x0][_0x9fd8('0x34')]('(')+0x1,_0x35cb81[0x0][_0x9fd8('0x34')](')'));var _0x2983bf=_0x35cb81[0x1];recordings[_0x51f175[_0x9fd8('0x4')]][_0x21a088]=_0x2983bf;}}}catch(_0x22efd8){utils[_0x9fd8('0x1a')](util[_0x9fd8('0x3')](_0x9fd8('0x35'),_0x51f175[_0x9fd8('0x4')]),_0x22efd8);}};exports[_0x9fd8('0x36')]=function(_0x50dee6){try{if(!_[_0x9fd8('0x14')](recordings[_0x50dee6[_0x9fd8('0x4')]])){utils[_0x9fd8('0xd')](util[_0x9fd8('0x3')]('[%s][recordings][queuecallerjoin]',_0x50dee6['uniqueid']),_0x50dee6);utils[_0x9fd8('0x2')](util[_0x9fd8('0x3')](_0x9fd8('0x37'),_0x50dee6[_0x9fd8('0x4')],_0x50dee6[_0x9fd8('0x38')]));recordings[_0x50dee6[_0x9fd8('0x4')]][_0x9fd8('0x38')]=_0x50dee6[_0x9fd8('0x38')];}}catch(_0x13293d){utils[_0x9fd8('0x1a')](util['format']('[%s][recordings][queuecallerjoin]',_0x50dee6[_0x9fd8('0x4')]),_0x13293d);}};
\ No newline at end of file