Built motion from commit (unavailable).|2.5.1
[motion2.git] / server / services / xdr / recordings.controller.js
index 60dc5c4..73db2d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbf7f=['replace','.wav49','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','info','format','uniqueid','accountcode','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xbf7f,0x14e));var _0xfbf7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbf7f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x3a3bcb){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')]('[%s][recordings][writeDB]',_0x3a3bcb[_0xfbf7('0x2')]));if(_0x3a3bcb[_0xfbf7('0x3')]){utils['getUserByInternal'](_0x3a3bcb[_0xfbf7('0x3')])[_0xfbf7('0x4')](function(_0x4ae59b){if(_0x4ae59b){_0x3a3bcb['membername']=_0x4ae59b[_0xfbf7('0x5')];_0x3a3bcb[_0xfbf7('0x6')]=_0x4ae59b['id'];}utils['request']('CreateVoiceRecording',_0x3a3bcb);});}else{utils[_0xfbf7('0x7')](_0xfbf7('0x8'),_0x3a3bcb);}}exports[_0xfbf7('0x9')]=function(_0x3ee508){try{utils[_0xfbf7('0xa')](util['format'](_0xfbf7('0xb'),_0x3ee508[_0xfbf7('0x2')]),_0x3ee508);if(_0x3ee508['uniqueid']==_0x3ee508[_0xfbf7('0xc')]){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0xd'),_0x3ee508['uniqueid'],_0x3ee508[_0xfbf7('0xe')],_0x3ee508[_0xfbf7('0xf')]));recordings[_0x3ee508[_0xfbf7('0x2')]]={'uniqueid':_0x3ee508['uniqueid'],'accountcode':_0x3ee508['accountcode'],'exten':_0x3ee508['exten'],'context':_0x3ee508['context'],'channel':_0x3ee508[_0xfbf7('0x10')],'monitors':[]};}}catch(_0x1ec2df){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0xb'),_0x3ee508['uniqueid']),_0x1ec2df);}};exports[_0xfbf7('0x12')]=function(_0x5b5ec7){try{utils[_0xfbf7('0xa')](util[_0xfbf7('0x1')]('[%s][recordings][newstate]',_0x5b5ec7[_0xfbf7('0x2')]),_0x5b5ec7);if(!_[_0xfbf7('0x13')](recordings[_0x5b5ec7[_0xfbf7('0x2')]])&&_0x5b5ec7[_0xfbf7('0x14')]==0x6){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x15'),_0x5b5ec7[_0xfbf7('0x2')],_0x5b5ec7['context'],_0x5b5ec7[_0xfbf7('0x10')]));}else if(!_[_0xfbf7('0x13')](recordings[_0x5b5ec7['linkedid']])&&_0x5b5ec7[_0xfbf7('0x14')]==0x6&&_0x5b5ec7[_0xfbf7('0xe')]!=_0xfbf7('0x16')){utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x17'),_0x5b5ec7[_0xfbf7('0x2')],_0x5b5ec7[_0xfbf7('0xc')],_0x5b5ec7[_0xfbf7('0xe')],_0x5b5ec7['channel']));recordings[_0x5b5ec7[_0xfbf7('0xc')]]['accountcode']=_0x5b5ec7[_0xfbf7('0x3')];}}catch(_0x1d3d67){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0x18'),_0x5b5ec7['uniqueid']),_0x1d3d67);}};exports[_0xfbf7('0x19')]=function(_0x274018){try{if(!_[_0xfbf7('0x13')](_0x274018[_0xfbf7('0x1a')])&&!_[_0xfbf7('0x13')](_0x274018[_0xfbf7('0x1a')][_0xfbf7('0x1b')])){utils[_0xfbf7('0xa')](util[_0xfbf7('0x1')](_0xfbf7('0x1c'),_0x274018[_0xfbf7('0x2')]),_0x274018);utils[_0xfbf7('0x0')](util['format'](_0xfbf7('0x1d'),_0x274018[_0xfbf7('0x2')],_0x274018['variable'],_0x274018[_0xfbf7('0x1e')]));if(_[_0xfbf7('0x1f')](_0x274018['value'],'.wav49')){_0x274018['value']=_0x274018['value'][_0xfbf7('0x20')](_0xfbf7('0x21'),_0xfbf7('0x22'));}if(recordings[_0x274018[_0xfbf7('0xc')]]){var _0x56ef95=_['find'](recordings[_0x274018['linkedid']]['monitors'],{'value':_0x274018[_0xfbf7('0x1e')]});if(_[_0xfbf7('0x13')](_0x56ef95)){recordings[_0x274018[_0xfbf7('0xc')]][_0xfbf7('0x23')][_0xfbf7('0x24')]({'value':_0x274018[_0xfbf7('0x1e')]});}}}}catch(_0x2d6de8){utils[_0xfbf7('0x11')](util[_0xfbf7('0x1')](_0xfbf7('0x1c'),_0x274018[_0xfbf7('0x2')]),_0x2d6de8);}};exports[_0xfbf7('0x25')]=function(_0x2b964b){try{if(!_[_0xfbf7('0x13')](recordings[_0x2b964b[_0xfbf7('0x2')]])){utils['debug'](util[_0xfbf7('0x1')](_0xfbf7('0x26'),_0x2b964b[_0xfbf7('0x2')]),_0x2b964b);utils[_0xfbf7('0x0')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x2b964b['uniqueid'],_0x2b964b['calleridnum'],_0x2b964b[_0xfbf7('0x27')],_0x2b964b[_0xfbf7('0x28')]));recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x29')]=_0x2b964b[_0xfbf7('0x29')];recordings[_0x2b964b['uniqueid']][_0xfbf7('0x27')]=_0x2b964b[_0xfbf7('0x27')];recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x2a')]=_0x2b964b[_0xfbf7('0x2a')];recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x2b')]=_0x2b964b[_0xfbf7('0x2b')];if(recordings[_0x2b964b[_0xfbf7('0x2')]]['type']==_0xfbf7('0x2c')&&recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x3')]){recordings[_0x2b964b[_0xfbf7('0x2')]]['connectedlinenum']=recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x3')];recordings[_0x2b964b['uniqueid']][_0xfbf7('0x2b')]='';}recordings[_0x2b964b[_0xfbf7('0x2')]][_0xfbf7('0x23')][_0xfbf7('0x2d')](function(_0x4c5fa3){var _0xce0c0=_[_0xfbf7('0x2e')](recordings[_0x2b964b[_0xfbf7('0x2')]]);_0xce0c0[_0xfbf7('0x1e')]=_0x4c5fa3['value'];writeDB(_0xce0c0);});delete recordings[_0x2b964b[_0xfbf7('0x2')]];}}catch(_0x4c0034){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0x26'),_0x2b964b[_0xfbf7('0x2')]),_0x4c0034);}};exports[_0xfbf7('0x2f')]=function(_0x4169dd){try{if(!_[_0xfbf7('0x13')](recordings[_0x4169dd[_0xfbf7('0x2')]])){utils[_0xfbf7('0xa')](util[_0xfbf7('0x1')](_0xfbf7('0x30'),_0x4169dd[_0xfbf7('0x2')]),_0x4169dd);utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x31'),_0x4169dd[_0xfbf7('0x2')],_0x4169dd[_0xfbf7('0x32')],_0x4169dd[_0xfbf7('0x33')]));if(_0x4169dd[_0xfbf7('0x32')][_0xfbf7('0x34')]()=='set'&&_['startsWith'](_0x4169dd[_0xfbf7('0x33')][_0xfbf7('0x34')](),_0xfbf7('0x35'))){var _0x4ea111=_0x4169dd[_0xfbf7('0x33')][_0xfbf7('0x36')]('=');var _0x8e35dc=_0x4ea111[0x0][_0xfbf7('0x37')](_0x4ea111[0x0][_0xfbf7('0x38')]('(')+0x1,_0x4ea111[0x0][_0xfbf7('0x38')](')'));var _0x1ce4d6=_0x4ea111[0x1];recordings[_0x4169dd['uniqueid']][_0x8e35dc]=_0x1ce4d6;}}}catch(_0x4e0119){utils[_0xfbf7('0x11')](util['format']('[%s][recordings][newexten]',_0x4169dd[_0xfbf7('0x2')]),_0x4e0119);}};exports[_0xfbf7('0x39')]=function(_0x11ad69){try{if(!_[_0xfbf7('0x13')](recordings[_0x11ad69[_0xfbf7('0x2')]])){utils['debug'](util[_0xfbf7('0x1')](_0xfbf7('0x3a'),_0x11ad69[_0xfbf7('0x2')]),_0x11ad69);utils[_0xfbf7('0x0')](util[_0xfbf7('0x1')](_0xfbf7('0x3b'),_0x11ad69[_0xfbf7('0x2')],_0x11ad69[_0xfbf7('0x3c')]));recordings[_0x11ad69[_0xfbf7('0x2')]][_0xfbf7('0x3c')]=_0x11ad69[_0xfbf7('0x3c')];}}catch(_0x150d92){utils[_0xfbf7('0x11')](util['format'](_0xfbf7('0x3a'),_0x11ad69[_0xfbf7('0x2')]),_0x150d92);}};
\ No newline at end of file
+var _0xafa5=['set','cdr','split','substring','lastIndexOf','error','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','info','format','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','newstate','debug','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xafa5,0x135));var _0x5afa=function(_0x3bb910,_0x550c7d){_0x3bb910=_0x3bb910-0x0;var _0x32b75b=_0xafa5[_0x3bb910];return _0x32b75b;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x511a22){utils[_0x5afa('0x0')](util[_0x5afa('0x1')]('[%s][recordings][writeDB]',_0x511a22['uniqueid']));if(_0x511a22['accountcode']){utils[_0x5afa('0x2')](_0x511a22[_0x5afa('0x3')])[_0x5afa('0x4')](function(_0x4608b0){if(_0x4608b0){_0x511a22[_0x5afa('0x5')]=_0x4608b0[_0x5afa('0x6')];_0x511a22[_0x5afa('0x7')]=_0x4608b0['id'];}utils['request']('CreateVoiceRecording',_0x511a22);});}else{utils[_0x5afa('0x8')](_0x5afa('0x9'),_0x511a22);}}exports[_0x5afa('0xa')]=function(_0x33e2f0){try{utils['debug'](util[_0x5afa('0x1')]('[%s][recordings][newchannel]',_0x33e2f0['uniqueid']),_0x33e2f0);if(_0x33e2f0[_0x5afa('0xb')]==_0x33e2f0[_0x5afa('0xc')]){utils[_0x5afa('0x0')](util[_0x5afa('0x1')](_0x5afa('0xd'),_0x33e2f0[_0x5afa('0xb')],_0x33e2f0[_0x5afa('0xe')],_0x33e2f0[_0x5afa('0xf')]));recordings[_0x33e2f0[_0x5afa('0xb')]]={'uniqueid':_0x33e2f0['uniqueid'],'accountcode':_0x33e2f0[_0x5afa('0x3')],'exten':_0x33e2f0['exten'],'context':_0x33e2f0['context'],'channel':_0x33e2f0[_0x5afa('0x10')],'monitors':[]};}}catch(_0x510c32){utils['error'](util['format'](_0x5afa('0x11'),_0x33e2f0[_0x5afa('0xb')]),_0x510c32);}};exports[_0x5afa('0x12')]=function(_0x1a0794){try{utils[_0x5afa('0x13')](util[_0x5afa('0x1')]('[%s][recordings][newstate]',_0x1a0794[_0x5afa('0xb')]),_0x1a0794);if(!_[_0x5afa('0x14')](recordings[_0x1a0794['uniqueid']])&&_0x1a0794['channelstate']==0x6){utils[_0x5afa('0x0')](util[_0x5afa('0x1')](_0x5afa('0x15'),_0x1a0794['uniqueid'],_0x1a0794[_0x5afa('0xe')],_0x1a0794['channel']));}else if(!_[_0x5afa('0x14')](recordings[_0x1a0794[_0x5afa('0xc')]])&&_0x1a0794[_0x5afa('0x16')]==0x6&&_0x1a0794[_0x5afa('0xe')]!=_0x5afa('0x17')){utils['info'](util[_0x5afa('0x1')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1a0794['uniqueid'],_0x1a0794[_0x5afa('0xc')],_0x1a0794[_0x5afa('0xe')],_0x1a0794[_0x5afa('0x10')]));recordings[_0x1a0794['linkedid']][_0x5afa('0x3')]=_0x1a0794['accountcode'];}}catch(_0xe5edfa){utils['error'](util[_0x5afa('0x1')]('[%s][recordings][newstate]',_0x1a0794[_0x5afa('0xb')]),_0xe5edfa);}};exports[_0x5afa('0x18')]=function(_0x206838){try{if(!_[_0x5afa('0x14')](_0x206838[_0x5afa('0x19')])&&!_[_0x5afa('0x14')](_0x206838['variable']['mixmonitor_filename'])){utils[_0x5afa('0x13')](util['format'](_0x5afa('0x1a'),_0x206838['uniqueid']),_0x206838);utils['info'](util[_0x5afa('0x1')](_0x5afa('0x1b'),_0x206838['uniqueid'],_0x206838[_0x5afa('0x19')],_0x206838[_0x5afa('0x1c')]));if(_[_0x5afa('0x1d')](_0x206838['value'],_0x5afa('0x1e'))){_0x206838['value']=_0x206838[_0x5afa('0x1c')]['replace'](_0x5afa('0x1e'),_0x5afa('0x1f'));}if(recordings[_0x206838[_0x5afa('0xc')]]){var _0x2ea99e=_[_0x5afa('0x20')](recordings[_0x206838[_0x5afa('0xc')]][_0x5afa('0x21')],{'value':_0x206838[_0x5afa('0x1c')]});if(_['isNil'](_0x2ea99e)){recordings[_0x206838[_0x5afa('0xc')]][_0x5afa('0x21')][_0x5afa('0x22')]({'value':_0x206838[_0x5afa('0x1c')]});}}}}catch(_0x2f89d8){utils['error'](util['format'](_0x5afa('0x1a'),_0x206838['uniqueid']),_0x2f89d8);}};exports['hangup']=function(_0x383f4a){try{if(!_[_0x5afa('0x14')](recordings[_0x383f4a[_0x5afa('0xb')]])){utils[_0x5afa('0x13')](util['format'](_0x5afa('0x23'),_0x383f4a[_0x5afa('0xb')]),_0x383f4a);utils[_0x5afa('0x0')](util[_0x5afa('0x1')](_0x5afa('0x24'),_0x383f4a[_0x5afa('0xb')],_0x383f4a[_0x5afa('0x25')],_0x383f4a[_0x5afa('0x26')],_0x383f4a[_0x5afa('0x27')]));recordings[_0x383f4a[_0x5afa('0xb')]]['calleridnum']=_0x383f4a[_0x5afa('0x25')];recordings[_0x383f4a[_0x5afa('0xb')]][_0x5afa('0x26')]=_0x383f4a[_0x5afa('0x26')];recordings[_0x383f4a[_0x5afa('0xb')]]['connectedlinenum']=_0x383f4a[_0x5afa('0x28')];recordings[_0x383f4a[_0x5afa('0xb')]][_0x5afa('0x29')]=_0x383f4a[_0x5afa('0x29')];if(recordings[_0x383f4a[_0x5afa('0xb')]][_0x5afa('0x2a')]==_0x5afa('0x2b')&&recordings[_0x383f4a[_0x5afa('0xb')]]['accountcode']){recordings[_0x383f4a['uniqueid']][_0x5afa('0x28')]=recordings[_0x383f4a[_0x5afa('0xb')]]['accountcode'];recordings[_0x383f4a[_0x5afa('0xb')]][_0x5afa('0x29')]='';}recordings[_0x383f4a[_0x5afa('0xb')]][_0x5afa('0x21')]['forEach'](function(_0x4467d7){var _0x47130e=_[_0x5afa('0x2c')](recordings[_0x383f4a[_0x5afa('0xb')]]);_0x47130e[_0x5afa('0x1c')]=_0x4467d7[_0x5afa('0x1c')];writeDB(_0x47130e);});delete recordings[_0x383f4a['uniqueid']];}}catch(_0x230420){utils['error'](util[_0x5afa('0x1')](_0x5afa('0x23'),_0x383f4a['uniqueid']),_0x230420);}};exports[_0x5afa('0x2d')]=function(_0x5e1fcd){try{if(!_[_0x5afa('0x14')](recordings[_0x5e1fcd['uniqueid']])){utils[_0x5afa('0x13')](util[_0x5afa('0x1')](_0x5afa('0x2e'),_0x5e1fcd[_0x5afa('0xb')]),_0x5e1fcd);utils[_0x5afa('0x0')](util[_0x5afa('0x1')](_0x5afa('0x2f'),_0x5e1fcd['uniqueid'],_0x5e1fcd[_0x5afa('0x30')],_0x5e1fcd[_0x5afa('0x31')]));if(_0x5e1fcd[_0x5afa('0x30')][_0x5afa('0x32')]()==_0x5afa('0x33')&&_['startsWith'](_0x5e1fcd[_0x5afa('0x31')][_0x5afa('0x32')](),_0x5afa('0x34'))){var _0x6d482a=_0x5e1fcd[_0x5afa('0x31')][_0x5afa('0x35')]('=');var _0x10bc31=_0x6d482a[0x0][_0x5afa('0x36')](_0x6d482a[0x0][_0x5afa('0x37')]('(')+0x1,_0x6d482a[0x0][_0x5afa('0x37')](')'));var _0x59b223=_0x6d482a[0x1];recordings[_0x5e1fcd[_0x5afa('0xb')]][_0x10bc31]=_0x59b223;}}}catch(_0x362873){utils[_0x5afa('0x38')](util[_0x5afa('0x1')]('[%s][recordings][newexten]',_0x5e1fcd[_0x5afa('0xb')]),_0x362873);}};exports['queuecallerjoin']=function(_0x5abe11){try{if(!_[_0x5afa('0x14')](recordings[_0x5abe11['uniqueid']])){utils['debug'](util['format'](_0x5afa('0x39'),_0x5abe11[_0x5afa('0xb')]),_0x5abe11);utils['info'](util[_0x5afa('0x1')](_0x5afa('0x3a'),_0x5abe11[_0x5afa('0xb')],_0x5abe11[_0x5afa('0x3b')]));recordings[_0x5abe11[_0x5afa('0xb')]][_0x5afa('0x3b')]=_0x5abe11[_0x5afa('0x3b')];}}catch(_0x4527d9){utils[_0x5afa('0x38')](util[_0x5afa('0x1')](_0x5afa('0x39'),_0x5abe11[_0x5afa('0xb')]),_0x4527d9);}};
\ No newline at end of file