Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / services / xdr / recordings.controller.js
index 1f1d487..a0dcfc7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x461d=['monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','.wav49','.WAV'];(function(_0x336ba7,_0x3fb69b){var _0x43a5bb=function(_0x2ae5f7){while(--_0x2ae5f7){_0x336ba7['push'](_0x336ba7['shift']());}};_0x43a5bb(++_0x3fb69b);}(_0x461d,0xb3));var _0xd461=function(_0x4b249d,_0x3bad86){_0x4b249d=_0x4b249d-0x0;var _0x48cacc=_0x461d[_0x4b249d];return _0x48cacc;};'use strict';var _=require(_0xd461('0x0'));var util=require(_0xd461('0x1'));var utils=require(_0xd461('0x2'));var transfers=require(_0xd461('0x3'));var recordings={};function writeDB(_0x37efae){var _0x41ea92;utils['info'](util['format'](_0xd461('0x4'),_0x37efae[_0xd461('0x5')]));if(transfers[_0xd461('0x6')][_0x37efae[_0xd461('0x5')]]){_0x41ea92=_0x37efae[_0xd461('0x5')];_0x37efae[_0xd461('0x5')]=transfers[_0xd461('0x6')][_0x37efae['uniqueid']][_0xd461('0x7')];}if(_0x37efae['accountcode']){utils[_0xd461('0x8')](_0x37efae['accountcode'])[_0xd461('0x9')](function(_0x53eda2){if(_0x53eda2){_0x37efae[_0xd461('0xa')]=_0x53eda2[_0xd461('0xb')];_0x37efae[_0xd461('0xc')]=_0x53eda2['id'];}utils[_0xd461('0xd')]('CreateVoiceRecording',_0x37efae);});}else{utils[_0xd461('0xd')](_0xd461('0xe'),_0x37efae);}if(_0x41ea92)delete transfers[_0xd461('0x6')][_0x41ea92];}exports[_0xd461('0xf')]=function(_0x3be6ce){try{utils[_0xd461('0x10')](util[_0xd461('0x11')]('[%s][recordings][newchannel]',_0x3be6ce[_0xd461('0x5')]),_0x3be6ce);if(_0x3be6ce[_0xd461('0x5')]==_0x3be6ce[_0xd461('0x12')]){utils[_0xd461('0x13')](util['format'](_0xd461('0x14'),_0x3be6ce[_0xd461('0x5')],_0x3be6ce[_0xd461('0x15')],_0x3be6ce[_0xd461('0x16')]));recordings[_0x3be6ce[_0xd461('0x5')]]={'uniqueid':_0x3be6ce[_0xd461('0x5')],'accountcode':_0x3be6ce[_0xd461('0x17')],'exten':_0x3be6ce['exten'],'context':_0x3be6ce[_0xd461('0x15')],'channel':_0x3be6ce[_0xd461('0x18')],'monitors':[]};}}catch(_0xa64196){utils[_0xd461('0x19')](util[_0xd461('0x11')](_0xd461('0x1a'),_0x3be6ce[_0xd461('0x5')]),_0xa64196);}};exports[_0xd461('0x1b')]=function(_0x18178f){try{utils['debug'](util[_0xd461('0x11')](_0xd461('0x1c'),_0x18178f['uniqueid']),_0x18178f);if(!_[_0xd461('0x1d')](recordings[_0x18178f[_0xd461('0x5')]])&&_0x18178f[_0xd461('0x1e')]==0x6){utils[_0xd461('0x13')](util[_0xd461('0x11')](_0xd461('0x1f'),_0x18178f['uniqueid'],_0x18178f[_0xd461('0x15')],_0x18178f[_0xd461('0x18')]));}else if(!_[_0xd461('0x1d')](recordings[_0x18178f['linkedid']])&&_0x18178f[_0xd461('0x1e')]==0x6&&_0x18178f[_0xd461('0x15')]!='transfer'){utils[_0xd461('0x13')](util[_0xd461('0x11')](_0xd461('0x20'),_0x18178f[_0xd461('0x5')],_0x18178f[_0xd461('0x12')],_0x18178f[_0xd461('0x15')],_0x18178f[_0xd461('0x18')]));recordings[_0x18178f[_0xd461('0x12')]][_0xd461('0x17')]=_0x18178f[_0xd461('0x17')];}}catch(_0x5c02ec){utils[_0xd461('0x19')](util[_0xd461('0x11')](_0xd461('0x1c'),_0x18178f[_0xd461('0x5')]),_0x5c02ec);}};exports[_0xd461('0x21')]=function(_0x48b7dc){try{if(!_[_0xd461('0x1d')](_0x48b7dc[_0xd461('0x22')])&&!_[_0xd461('0x1d')](_0x48b7dc['variable'][_0xd461('0x23')])){utils[_0xd461('0x10')](util[_0xd461('0x11')](_0xd461('0x24'),_0x48b7dc[_0xd461('0x5')]),_0x48b7dc);utils[_0xd461('0x13')](util[_0xd461('0x11')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x48b7dc[_0xd461('0x5')],_0x48b7dc[_0xd461('0x22')],_0x48b7dc[_0xd461('0x25')]));if(_['endsWith'](_0x48b7dc[_0xd461('0x25')],_0xd461('0x26'))){_0x48b7dc[_0xd461('0x25')]=_0x48b7dc[_0xd461('0x25')]['replace']('.wav49',_0xd461('0x27'));}if(recordings[_0x48b7dc[_0xd461('0x12')]]){var _0x123375=_['find'](recordings[_0x48b7dc[_0xd461('0x12')]][_0xd461('0x28')],{'value':_0x48b7dc[_0xd461('0x25')]});if(_[_0xd461('0x1d')](_0x123375)){recordings[_0x48b7dc[_0xd461('0x12')]][_0xd461('0x28')][_0xd461('0x29')]({'value':_0x48b7dc[_0xd461('0x25')]});}}}}catch(_0x54d19b){utils[_0xd461('0x19')](util[_0xd461('0x11')](_0xd461('0x24'),_0x48b7dc[_0xd461('0x5')]),_0x54d19b);}};exports[_0xd461('0x2a')]=function(_0x41d4ba){try{if(!_[_0xd461('0x1d')](recordings[_0x41d4ba[_0xd461('0x5')]])){utils[_0xd461('0x10')](util[_0xd461('0x11')](_0xd461('0x2b'),_0x41d4ba[_0xd461('0x5')]),_0x41d4ba);utils[_0xd461('0x13')](util[_0xd461('0x11')](_0xd461('0x2c'),_0x41d4ba[_0xd461('0x5')],_0x41d4ba[_0xd461('0x2d')],_0x41d4ba[_0xd461('0x2e')],_0x41d4ba[_0xd461('0x2f')]));recordings[_0x41d4ba[_0xd461('0x5')]][_0xd461('0x2d')]=_0x41d4ba['calleridnum'];recordings[_0x41d4ba[_0xd461('0x5')]]['calleridname']=_0x41d4ba[_0xd461('0x2e')];recordings[_0x41d4ba[_0xd461('0x5')]][_0xd461('0x30')]=_0x41d4ba['connectedlinenum'];recordings[_0x41d4ba[_0xd461('0x5')]]['connectedlinename']=_0x41d4ba[_0xd461('0x31')];if(recordings[_0x41d4ba[_0xd461('0x5')]]['type']==_0xd461('0x32')&&recordings[_0x41d4ba[_0xd461('0x5')]]['accountcode']){recordings[_0x41d4ba['uniqueid']]['connectedlinenum']=recordings[_0x41d4ba[_0xd461('0x5')]][_0xd461('0x17')];recordings[_0x41d4ba[_0xd461('0x5')]][_0xd461('0x31')]='';}recordings[_0x41d4ba[_0xd461('0x5')]][_0xd461('0x28')][_0xd461('0x33')](function(_0xa5a3bd){var _0x2aa3cf=_['clone'](recordings[_0x41d4ba['uniqueid']]);_0x2aa3cf[_0xd461('0x25')]=_0xa5a3bd[_0xd461('0x25')];writeDB(_0x2aa3cf);});delete recordings[_0x41d4ba[_0xd461('0x5')]];}}catch(_0x10b9c2){utils['error'](util[_0xd461('0x11')](_0xd461('0x2b'),_0x41d4ba['uniqueid']),_0x10b9c2);}};exports[_0xd461('0x34')]=function(_0x26730e){try{if(!_[_0xd461('0x1d')](recordings[_0x26730e[_0xd461('0x5')]])){utils[_0xd461('0x10')](util[_0xd461('0x11')](_0xd461('0x35'),_0x26730e[_0xd461('0x5')]),_0x26730e);utils[_0xd461('0x13')](util[_0xd461('0x11')](_0xd461('0x36'),_0x26730e[_0xd461('0x5')],_0x26730e['application'],_0x26730e[_0xd461('0x37')]));if(_0x26730e[_0xd461('0x38')][_0xd461('0x39')]()==_0xd461('0x3a')&&_[_0xd461('0x3b')](_0x26730e[_0xd461('0x37')][_0xd461('0x39')](),_0xd461('0x3c'))){var _0x5593f1=_0x26730e[_0xd461('0x37')][_0xd461('0x3d')]('=');var _0x370337=_0x5593f1[0x0][_0xd461('0x3e')](_0x5593f1[0x0]['lastIndexOf']('(')+0x1,_0x5593f1[0x0][_0xd461('0x3f')](')'));var _0x12d4cf=_0x5593f1[0x1];recordings[_0x26730e[_0xd461('0x5')]][_0x370337]=_0x12d4cf;}}}catch(_0x1483c7){utils[_0xd461('0x19')](util[_0xd461('0x11')]('[%s][recordings][newexten]',_0x26730e[_0xd461('0x5')]),_0x1483c7);}};exports['queuecallerjoin']=function(_0xbbec47){try{if(!_[_0xd461('0x1d')](recordings[_0xbbec47[_0xd461('0x5')]])){utils[_0xd461('0x10')](util[_0xd461('0x11')]('[%s][recordings][queuecallerjoin]',_0xbbec47[_0xd461('0x5')]),_0xbbec47);utils[_0xd461('0x13')](util[_0xd461('0x11')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0xbbec47[_0xd461('0x5')],_0xbbec47[_0xd461('0x40')]));recordings[_0xbbec47[_0xd461('0x5')]][_0xd461('0x40')]=_0xbbec47[_0xd461('0x40')];}}catch(_0x2dc7d1){utils[_0xd461('0x19')](util[_0xd461('0x11')](_0xd461('0x41'),_0xbbec47[_0xd461('0x5')]),_0x2dc7d1);}};exports[_0xd461('0x42')]=function(_0x3788d2){try{utils[_0xd461('0x10')](util[_0xd461('0x11')]('[%s][recordings][blindtransfer]',_0x3788d2[_0xd461('0x5')]),_0x3788d2);utils[_0xd461('0x13')](util['format'](_0xd461('0x43'),_0x3788d2[_0xd461('0x5')],_0x3788d2[_0xd461('0x44')],_0x3788d2[_0xd461('0x45')],_0x3788d2[_0xd461('0x46')],_0x3788d2['transfereecalleridname']));if(recordings[_0x3788d2[_0xd461('0x47')]]&&transfers['blinds'][_0x3788d2['transfereruniqueid']]){transfers['blinds'][_0x3788d2[_0xd461('0x47')]][_0xd461('0x48')]=!![];}}catch(_0xa68b5d){utils[_0xd461('0x19')](util[_0xd461('0x11')]('[%s][recordings][blindtransfer]',_0x3788d2[_0xd461('0x5')]),_0xa68b5d);}};
\ No newline at end of file
+var _0xaeae=['[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','channel','varset','variable','[%s][recordings][varset]','value','endsWith','.wav49','.WAV','find','monitors','[%s][recordings][hangup]','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaeae,0x1eb));var _0xeaea=function(_0x2ff279,_0x493782){_0x2ff279=_0x2ff279-0x0;var _0x3d9842=_0xaeae[_0x2ff279];return _0x3d9842;};'use strict';var _=require(_0xeaea('0x0'));var util=require(_0xeaea('0x1'));var utils=require(_0xeaea('0x2'));var recordings={};function writeDB(_0x21b7bf){utils['info'](util[_0xeaea('0x3')](_0xeaea('0x4'),_0x21b7bf['uniqueid']));if(_0x21b7bf[_0xeaea('0x5')]){utils[_0xeaea('0x6')](_0x21b7bf[_0xeaea('0x5')])[_0xeaea('0x7')](function(_0x211e64){if(_0x211e64){_0x21b7bf['membername']=_0x211e64[_0xeaea('0x8')];_0x21b7bf[_0xeaea('0x9')]=_0x211e64['id'];}utils[_0xeaea('0xa')]('CreateVoiceRecording',_0x21b7bf);});}else{utils[_0xeaea('0xa')](_0xeaea('0xb'),_0x21b7bf);}}exports[_0xeaea('0xc')]=function(_0x5ed865){try{utils[_0xeaea('0xd')](util[_0xeaea('0x3')](_0xeaea('0xe'),_0x5ed865['uniqueid']),_0x5ed865);if(_0x5ed865[_0xeaea('0xf')]==_0x5ed865[_0xeaea('0x10')]){utils[_0xeaea('0x11')](util[_0xeaea('0x3')](_0xeaea('0x12'),_0x5ed865[_0xeaea('0xf')],_0x5ed865[_0xeaea('0x13')],_0x5ed865[_0xeaea('0x14')]));recordings[_0x5ed865[_0xeaea('0xf')]]={'uniqueid':_0x5ed865['uniqueid'],'accountcode':_0x5ed865[_0xeaea('0x5')],'exten':_0x5ed865[_0xeaea('0x14')],'context':_0x5ed865['context'],'channel':_0x5ed865['channel'],'monitors':[]};}}catch(_0x4a7ed0){utils[_0xeaea('0x15')](util[_0xeaea('0x3')]('[%s][recordings][newchannel]',_0x5ed865[_0xeaea('0xf')]),_0x4a7ed0);}};exports[_0xeaea('0x16')]=function(_0x1dd972){try{utils[_0xeaea('0xd')](util[_0xeaea('0x3')](_0xeaea('0x17'),_0x1dd972[_0xeaea('0xf')]),_0x1dd972);if(!_[_0xeaea('0x18')](recordings[_0x1dd972[_0xeaea('0xf')]])&&_0x1dd972['channelstate']==0x6){utils['info'](util[_0xeaea('0x3')](_0xeaea('0x19'),_0x1dd972[_0xeaea('0xf')],_0x1dd972['context'],_0x1dd972['channel']));}else if(!_['isNil'](recordings[_0x1dd972['linkedid']])&&_0x1dd972[_0xeaea('0x1a')]==0x6&&_0x1dd972[_0xeaea('0x13')]!=_0xeaea('0x1b')){utils[_0xeaea('0x11')](util['format'](_0xeaea('0x1c'),_0x1dd972[_0xeaea('0xf')],_0x1dd972[_0xeaea('0x10')],_0x1dd972[_0xeaea('0x13')],_0x1dd972[_0xeaea('0x1d')]));recordings[_0x1dd972[_0xeaea('0x10')]][_0xeaea('0x5')]=_0x1dd972[_0xeaea('0x5')];}}catch(_0x3558d3){utils[_0xeaea('0x15')](util[_0xeaea('0x3')](_0xeaea('0x17'),_0x1dd972[_0xeaea('0xf')]),_0x3558d3);}};exports[_0xeaea('0x1e')]=function(_0x4908b0){try{if(!_[_0xeaea('0x18')](_0x4908b0[_0xeaea('0x1f')])&&!_[_0xeaea('0x18')](_0x4908b0[_0xeaea('0x1f')]['mixmonitor_filename'])){utils['debug'](util[_0xeaea('0x3')](_0xeaea('0x20'),_0x4908b0[_0xeaea('0xf')]),_0x4908b0);utils['info'](util[_0xeaea('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x4908b0['uniqueid'],_0x4908b0['variable'],_0x4908b0[_0xeaea('0x21')]));if(_[_0xeaea('0x22')](_0x4908b0[_0xeaea('0x21')],'.wav49')){_0x4908b0[_0xeaea('0x21')]=_0x4908b0[_0xeaea('0x21')]['replace'](_0xeaea('0x23'),_0xeaea('0x24'));}if(recordings[_0x4908b0[_0xeaea('0x10')]]){var _0x168df0=_[_0xeaea('0x25')](recordings[_0x4908b0[_0xeaea('0x10')]][_0xeaea('0x26')],{'value':_0x4908b0[_0xeaea('0x21')]});if(_[_0xeaea('0x18')](_0x168df0)){recordings[_0x4908b0[_0xeaea('0x10')]][_0xeaea('0x26')]['push']({'value':_0x4908b0[_0xeaea('0x21')]});}}}}catch(_0x4cc5eb){utils['error'](util[_0xeaea('0x3')](_0xeaea('0x20'),_0x4908b0['uniqueid']),_0x4cc5eb);}};exports['hangup']=function(_0x4ba67c){try{if(!_[_0xeaea('0x18')](recordings[_0x4ba67c['uniqueid']])){utils[_0xeaea('0xd')](util['format'](_0xeaea('0x27'),_0x4ba67c['uniqueid']),_0x4ba67c);utils[_0xeaea('0x11')](util[_0xeaea('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4ba67c[_0xeaea('0xf')],_0x4ba67c['calleridnum'],_0x4ba67c[_0xeaea('0x28')],_0x4ba67c[_0xeaea('0x29')]));recordings[_0x4ba67c[_0xeaea('0xf')]]['calleridnum']=_0x4ba67c['calleridnum'];recordings[_0x4ba67c['uniqueid']][_0xeaea('0x28')]=_0x4ba67c[_0xeaea('0x28')];recordings[_0x4ba67c[_0xeaea('0xf')]][_0xeaea('0x2a')]=_0x4ba67c[_0xeaea('0x2a')];recordings[_0x4ba67c[_0xeaea('0xf')]]['connectedlinename']=_0x4ba67c[_0xeaea('0x2b')];if(recordings[_0x4ba67c['uniqueid']][_0xeaea('0x2c')]==_0xeaea('0x2d')&&recordings[_0x4ba67c[_0xeaea('0xf')]][_0xeaea('0x5')]){recordings[_0x4ba67c[_0xeaea('0xf')]][_0xeaea('0x2a')]=recordings[_0x4ba67c[_0xeaea('0xf')]][_0xeaea('0x5')];recordings[_0x4ba67c[_0xeaea('0xf')]][_0xeaea('0x2b')]='';}recordings[_0x4ba67c['uniqueid']][_0xeaea('0x26')][_0xeaea('0x2e')](function(_0x44f2d5){var _0x45a5eb=_['clone'](recordings[_0x4ba67c[_0xeaea('0xf')]]);_0x45a5eb[_0xeaea('0x21')]=_0x44f2d5[_0xeaea('0x21')];writeDB(_0x45a5eb);});delete recordings[_0x4ba67c['uniqueid']];}}catch(_0xecb27a){utils[_0xeaea('0x15')](util[_0xeaea('0x3')](_0xeaea('0x27'),_0x4ba67c['uniqueid']),_0xecb27a);}};exports['newexten']=function(_0x335afa){try{if(!_['isNil'](recordings[_0x335afa['uniqueid']])){utils[_0xeaea('0xd')](util[_0xeaea('0x3')](_0xeaea('0x2f'),_0x335afa['uniqueid']),_0x335afa);utils[_0xeaea('0x11')](util[_0xeaea('0x3')](_0xeaea('0x30'),_0x335afa['uniqueid'],_0x335afa[_0xeaea('0x31')],_0x335afa[_0xeaea('0x32')]));if(_0x335afa[_0xeaea('0x31')][_0xeaea('0x33')]()==_0xeaea('0x34')&&_[_0xeaea('0x35')](_0x335afa[_0xeaea('0x32')][_0xeaea('0x33')](),_0xeaea('0x36'))){var _0x2c7081=_0x335afa[_0xeaea('0x32')][_0xeaea('0x37')]('=');var _0x997f6d=_0x2c7081[0x0][_0xeaea('0x38')](_0x2c7081[0x0][_0xeaea('0x39')]('(')+0x1,_0x2c7081[0x0][_0xeaea('0x39')](')'));var _0x5e45c9=_0x2c7081[0x1];recordings[_0x335afa[_0xeaea('0xf')]][_0x997f6d]=_0x5e45c9;}}}catch(_0x46d947){utils[_0xeaea('0x15')](util[_0xeaea('0x3')](_0xeaea('0x2f'),_0x335afa[_0xeaea('0xf')]),_0x46d947);}};exports['queuecallerjoin']=function(_0x10bc05){try{if(!_[_0xeaea('0x18')](recordings[_0x10bc05[_0xeaea('0xf')]])){utils[_0xeaea('0xd')](util[_0xeaea('0x3')](_0xeaea('0x3a'),_0x10bc05['uniqueid']),_0x10bc05);utils[_0xeaea('0x11')](util['format'](_0xeaea('0x3b'),_0x10bc05[_0xeaea('0xf')],_0x10bc05[_0xeaea('0x3c')]));recordings[_0x10bc05[_0xeaea('0xf')]]['queue']=_0x10bc05[_0xeaea('0x3c')];}}catch(_0x4fb1b9){utils[_0xeaea('0x15')](util['format'](_0xeaea('0x3a'),_0x10bc05[_0xeaea('0xf')]),_0x4fb1b9);}};
\ No newline at end of file