Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / services / xdr / recordings.controller.js
index e6f32b0..53f6bed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['.WAV','find','monitors','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','set','appdata','toLowerCase','split','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','accountcode','then','name','request','newchannel','uniqueid','linkedid','channel','error','stack','newstate','isNil','channelstate','transfer','variable','endsWith','value','.wav49'];(function(_0xc9ee72,_0x3fa61e){var _0x5eab12=function(_0x31c390){while(--_0x31c390){_0xc9ee72['push'](_0xc9ee72['shift']());}};_0x5eab12(++_0x3fa61e);}(_0x70e0,0x17b));var _0x070e=function(_0x5cf849,_0x3b1cc6){_0x5cf849=_0x5cf849-0x0;var _0x894a82=_0x70e0[_0x5cf849];return _0x894a82;};'use strict';var _=require(_0x070e('0x0'));var utils=require(_0x070e('0x1'));var recordings={};function writeDB(_0x198c2e){utils['debug'](_0x198c2e);if(_0x198c2e['accountcode']){utils[_0x070e('0x2')](_0x198c2e[_0x070e('0x3')])[_0x070e('0x4')](function(_0x2593e5){if(_0x2593e5){_0x198c2e['membername']=_0x2593e5[_0x070e('0x5')];_0x198c2e['UserId']=_0x2593e5['id'];}utils[_0x070e('0x6')]('CreateVoiceRecording',_0x198c2e);});}else{utils['request']('CreateVoiceRecording',_0x198c2e);}}exports[_0x070e('0x7')]=function(_0x1e11f0){try{if(_0x1e11f0[_0x070e('0x8')]==_0x1e11f0[_0x070e('0x9')]){recordings[_0x1e11f0[_0x070e('0x8')]]={'uniqueid':_0x1e11f0[_0x070e('0x8')],'accountcode':_0x1e11f0[_0x070e('0x3')],'exten':_0x1e11f0['exten'],'context':_0x1e11f0['context'],'channel':_0x1e11f0[_0x070e('0xa')],'monitors':[]};}}catch(_0x2e3e5e){utils[_0x070e('0xb')](_0x2e3e5e[_0x070e('0xc')]);}};exports[_0x070e('0xd')]=function(_0xffcdd6){try{if(!_[_0x070e('0xe')](recordings[_0xffcdd6[_0x070e('0x8')]])&&_0xffcdd6[_0x070e('0xf')]==0x6){}else if(!_[_0x070e('0xe')](recordings[_0xffcdd6[_0x070e('0x9')]])&&_0xffcdd6['channelstate']==0x6&&_0xffcdd6['context']!=_0x070e('0x10')){recordings[_0xffcdd6['linkedid']]['accountcode']=_0xffcdd6['accountcode'];}}catch(_0x11d2ce){utils[_0x070e('0xb')](_0x11d2ce['stack']);}};exports['varset']=function(_0x373d86){try{if(!_[_0x070e('0xe')](_0x373d86[_0x070e('0x11')])&&!_[_0x070e('0xe')](_0x373d86['variable']['mixmonitor_filename'])){if(_[_0x070e('0x12')](_0x373d86[_0x070e('0x13')],_0x070e('0x14'))){_0x373d86[_0x070e('0x13')]=_0x373d86[_0x070e('0x13')]['replace'](_0x070e('0x14'),_0x070e('0x15'));}if(recordings[_0x373d86[_0x070e('0x9')]]){var _0x3ea105=_[_0x070e('0x16')](recordings[_0x373d86['linkedid']]['monitors'],{'value':_0x373d86['value']});if(_[_0x070e('0xe')](_0x3ea105)){recordings[_0x373d86[_0x070e('0x9')]][_0x070e('0x17')]['push']({'value':_0x373d86[_0x070e('0x13')]});}}}}catch(_0x5dc5d2){utils[_0x070e('0xb')](_0x5dc5d2[_0x070e('0xc')]);}};exports[_0x070e('0x18')]=function(_0x33e8c6){try{if(!_[_0x070e('0xe')](recordings[_0x33e8c6[_0x070e('0x8')]])){recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x19')]=_0x33e8c6['calleridnum'];recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1a')]=_0x33e8c6[_0x070e('0x1a')];recordings[_0x33e8c6['uniqueid']][_0x070e('0x1b')]=_0x33e8c6['connectedlinenum'];recordings[_0x33e8c6['uniqueid']][_0x070e('0x1c')]=_0x33e8c6[_0x070e('0x1c')];if(recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1d')]==_0x070e('0x1e')&&recordings[_0x33e8c6['uniqueid']][_0x070e('0x3')]){recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1b')]=recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x3')];recordings[_0x33e8c6[_0x070e('0x8')]][_0x070e('0x1c')]='';}recordings[_0x33e8c6[_0x070e('0x8')]]['monitors'][_0x070e('0x1f')](_0x351641=>{var _0x3a16d0=_['clone'](recordings[_0x33e8c6['uniqueid']]);_0x3a16d0[_0x070e('0x13')]=_0x351641[_0x070e('0x13')];writeDB(_0x3a16d0);});delete recordings[_0x33e8c6[_0x070e('0x8')]];}}catch(_0x51402c){utils[_0x070e('0xb')](_0x51402c[_0x070e('0xc')]);}};exports[_0x070e('0x20')]=function(_0x5f2bee){try{if(!_['isNil'](recordings[_0x5f2bee['uniqueid']])){if(_0x5f2bee['application']['toLowerCase']()==_0x070e('0x21')&&_['startsWith'](_0x5f2bee[_0x070e('0x22')][_0x070e('0x23')](),'cdr')){var _0x47a739=_0x5f2bee[_0x070e('0x22')][_0x070e('0x24')]('=');var _0x55288a=_0x47a739[0x0]['substring'](_0x47a739[0x0][_0x070e('0x25')]('(')+0x1,_0x47a739[0x0][_0x070e('0x25')](')'));var _0x444d02=_0x47a739[0x1];recordings[_0x5f2bee[_0x070e('0x8')]][_0x55288a]=_0x444d02;}}}catch(_0x18f0ad){utils['error'](_0x18f0ad['stack']);}};exports[_0x070e('0x26')]=function(_0x3011c4){try{if(!_[_0x070e('0xe')](recordings[_0x3011c4[_0x070e('0x8')]])){recordings[_0x3011c4[_0x070e('0x8')]]['queue']=_0x3011c4[_0x070e('0x27')];}}catch(_0x1927f4){utils['error'](_0x1927f4[_0x070e('0xc')]);}};
\ No newline at end of file
+var _0xfcb3=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename'];(function(_0x30bdff,_0x308063){var _0x1e7ca9=function(_0x1a6e16){while(--_0x1a6e16){_0x30bdff['push'](_0x30bdff['shift']());}};_0x1e7ca9(++_0x308063);}(_0xfcb3,0x167));var _0x3fcb=function(_0x2d2f02,_0x1580f4){_0x2d2f02=_0x2d2f02-0x0;var _0x14b591=_0xfcb3[_0x2d2f02];return _0x14b591;};'use strict';var _=require(_0x3fcb('0x0'));var util=require(_0x3fcb('0x1'));var utils=require(_0x3fcb('0x2'));var recordings={};function writeDB(_0x224638){utils[_0x3fcb('0x3')](util[_0x3fcb('0x4')](_0x3fcb('0x5'),_0x224638[_0x3fcb('0x6')]));if(_0x224638[_0x3fcb('0x7')]){utils[_0x3fcb('0x8')](_0x224638[_0x3fcb('0x7')])[_0x3fcb('0x9')](function(_0x5d9d82){if(_0x5d9d82){_0x224638['membername']=_0x5d9d82[_0x3fcb('0xa')];_0x224638['UserId']=_0x5d9d82['id'];}utils[_0x3fcb('0xb')](_0x3fcb('0xc'),_0x224638);});}else{utils[_0x3fcb('0xb')](_0x3fcb('0xc'),_0x224638);}}exports[_0x3fcb('0xd')]=function(_0x22b2ed){try{utils[_0x3fcb('0xe')](util['format'](_0x3fcb('0xf'),_0x22b2ed['uniqueid']),_0x22b2ed);if(_0x22b2ed['uniqueid']==_0x22b2ed[_0x3fcb('0x10')]){utils[_0x3fcb('0x3')](util['format'](_0x3fcb('0x11'),_0x22b2ed[_0x3fcb('0x6')],_0x22b2ed[_0x3fcb('0x12')],_0x22b2ed[_0x3fcb('0x13')]));recordings[_0x22b2ed[_0x3fcb('0x6')]]={'uniqueid':_0x22b2ed[_0x3fcb('0x6')],'accountcode':_0x22b2ed[_0x3fcb('0x7')],'exten':_0x22b2ed[_0x3fcb('0x13')],'context':_0x22b2ed[_0x3fcb('0x12')],'channel':_0x22b2ed[_0x3fcb('0x14')],'monitors':[]};}}catch(_0x4515cf){utils[_0x3fcb('0x15')](util['format'](_0x3fcb('0xf'),_0x22b2ed[_0x3fcb('0x6')]),_0x4515cf);}};exports[_0x3fcb('0x16')]=function(_0x2eb336){try{utils[_0x3fcb('0xe')](util[_0x3fcb('0x4')](_0x3fcb('0x17'),_0x2eb336[_0x3fcb('0x6')]),_0x2eb336);if(!_['isNil'](recordings[_0x2eb336['uniqueid']])&&_0x2eb336[_0x3fcb('0x18')]==0x6){utils[_0x3fcb('0x3')](util[_0x3fcb('0x4')](_0x3fcb('0x19'),_0x2eb336[_0x3fcb('0x6')],_0x2eb336[_0x3fcb('0x12')],_0x2eb336[_0x3fcb('0x14')]));}else if(!_[_0x3fcb('0x1a')](recordings[_0x2eb336[_0x3fcb('0x10')]])&&_0x2eb336[_0x3fcb('0x18')]==0x6&&_0x2eb336[_0x3fcb('0x12')]!=_0x3fcb('0x1b')){utils[_0x3fcb('0x3')](util[_0x3fcb('0x4')](_0x3fcb('0x1c'),_0x2eb336['uniqueid'],_0x2eb336[_0x3fcb('0x10')],_0x2eb336[_0x3fcb('0x12')],_0x2eb336['channel']));recordings[_0x2eb336[_0x3fcb('0x10')]][_0x3fcb('0x7')]=_0x2eb336[_0x3fcb('0x7')];}}catch(_0x5b076a){utils[_0x3fcb('0x15')](util['format']('[%s][recordings][newstate]',_0x2eb336['uniqueid']),_0x5b076a);}};exports['varset']=function(_0x5cbe4c){try{if(!_[_0x3fcb('0x1a')](_0x5cbe4c[_0x3fcb('0x1d')])&&!_[_0x3fcb('0x1a')](_0x5cbe4c[_0x3fcb('0x1d')][_0x3fcb('0x1e')])){utils['debug'](util[_0x3fcb('0x4')](_0x3fcb('0x1f'),_0x5cbe4c[_0x3fcb('0x6')]),_0x5cbe4c);utils[_0x3fcb('0x3')](util[_0x3fcb('0x4')](_0x3fcb('0x20'),_0x5cbe4c[_0x3fcb('0x6')],_0x5cbe4c[_0x3fcb('0x1d')],_0x5cbe4c[_0x3fcb('0x21')]));if(_[_0x3fcb('0x22')](_0x5cbe4c[_0x3fcb('0x21')],_0x3fcb('0x23'))){_0x5cbe4c[_0x3fcb('0x21')]=_0x5cbe4c['value'][_0x3fcb('0x24')]('.wav49',_0x3fcb('0x25'));}if(recordings[_0x5cbe4c[_0x3fcb('0x10')]]){var _0xa290a1=_[_0x3fcb('0x26')](recordings[_0x5cbe4c[_0x3fcb('0x10')]][_0x3fcb('0x27')],{'value':_0x5cbe4c['value']});if(_['isNil'](_0xa290a1)){recordings[_0x5cbe4c[_0x3fcb('0x10')]][_0x3fcb('0x27')]['push']({'value':_0x5cbe4c[_0x3fcb('0x21')]});}}}}catch(_0x56b1e3){utils[_0x3fcb('0x15')](util['format'](_0x3fcb('0x1f'),_0x5cbe4c[_0x3fcb('0x6')]),_0x56b1e3);}};exports[_0x3fcb('0x28')]=function(_0x265080){try{if(!_[_0x3fcb('0x1a')](recordings[_0x265080[_0x3fcb('0x6')]])){utils[_0x3fcb('0xe')](util[_0x3fcb('0x4')](_0x3fcb('0x29'),_0x265080[_0x3fcb('0x6')]),_0x265080);utils[_0x3fcb('0x3')](util[_0x3fcb('0x4')](_0x3fcb('0x2a'),_0x265080['uniqueid'],_0x265080[_0x3fcb('0x2b')],_0x265080[_0x3fcb('0x2c')],_0x265080[_0x3fcb('0x2d')]));recordings[_0x265080[_0x3fcb('0x6')]][_0x3fcb('0x2b')]=_0x265080[_0x3fcb('0x2b')];recordings[_0x265080[_0x3fcb('0x6')]][_0x3fcb('0x2c')]=_0x265080[_0x3fcb('0x2c')];recordings[_0x265080['uniqueid']][_0x3fcb('0x2e')]=_0x265080[_0x3fcb('0x2e')];recordings[_0x265080[_0x3fcb('0x6')]][_0x3fcb('0x2f')]=_0x265080[_0x3fcb('0x2f')];if(recordings[_0x265080[_0x3fcb('0x6')]][_0x3fcb('0x30')]==_0x3fcb('0x31')&&recordings[_0x265080[_0x3fcb('0x6')]][_0x3fcb('0x7')]){recordings[_0x265080[_0x3fcb('0x6')]][_0x3fcb('0x2e')]=recordings[_0x265080['uniqueid']][_0x3fcb('0x7')];recordings[_0x265080[_0x3fcb('0x6')]][_0x3fcb('0x2f')]='';}recordings[_0x265080[_0x3fcb('0x6')]][_0x3fcb('0x27')]['forEach'](function(_0x4e2e47){var _0x20d4a8=_[_0x3fcb('0x32')](recordings[_0x265080['uniqueid']]);_0x20d4a8[_0x3fcb('0x21')]=_0x4e2e47[_0x3fcb('0x21')];writeDB(_0x20d4a8);});delete recordings[_0x265080[_0x3fcb('0x6')]];}}catch(_0x4a5080){utils['error'](util[_0x3fcb('0x4')](_0x3fcb('0x29'),_0x265080['uniqueid']),_0x4a5080);}};exports['newexten']=function(_0x104b25){try{if(!_['isNil'](recordings[_0x104b25[_0x3fcb('0x6')]])){utils[_0x3fcb('0xe')](util[_0x3fcb('0x4')](_0x3fcb('0x33'),_0x104b25[_0x3fcb('0x6')]),_0x104b25);utils[_0x3fcb('0x3')](util[_0x3fcb('0x4')](_0x3fcb('0x34'),_0x104b25[_0x3fcb('0x6')],_0x104b25[_0x3fcb('0x35')],_0x104b25[_0x3fcb('0x36')]));if(_0x104b25[_0x3fcb('0x35')][_0x3fcb('0x37')]()==_0x3fcb('0x38')&&_[_0x3fcb('0x39')](_0x104b25[_0x3fcb('0x36')][_0x3fcb('0x37')](),'cdr')){var _0x1ac054=_0x104b25[_0x3fcb('0x36')][_0x3fcb('0x3a')]('=');var _0x97432f=_0x1ac054[0x0][_0x3fcb('0x3b')](_0x1ac054[0x0][_0x3fcb('0x3c')]('(')+0x1,_0x1ac054[0x0][_0x3fcb('0x3c')](')'));var _0x58b48e=_0x1ac054[0x1];recordings[_0x104b25[_0x3fcb('0x6')]][_0x97432f]=_0x58b48e;}}}catch(_0x1cce31){utils['error'](util[_0x3fcb('0x4')]('[%s][recordings][newexten]',_0x104b25[_0x3fcb('0x6')]),_0x1cce31);}};exports[_0x3fcb('0x3d')]=function(_0xc21084){try{if(!_['isNil'](recordings[_0xc21084['uniqueid']])){utils[_0x3fcb('0xe')](util[_0x3fcb('0x4')](_0x3fcb('0x3e'),_0xc21084[_0x3fcb('0x6')]),_0xc21084);utils[_0x3fcb('0x3')](util[_0x3fcb('0x4')](_0x3fcb('0x3f'),_0xc21084[_0x3fcb('0x6')],_0xc21084[_0x3fcb('0x40')]));recordings[_0xc21084[_0x3fcb('0x6')]][_0x3fcb('0x40')]=_0xc21084[_0x3fcb('0x40')];}}catch(_0x5ed586){utils[_0x3fcb('0x15')](util[_0x3fcb('0x4')](_0x3fcb('0x3e'),_0xc21084['uniqueid']),_0x5ed586);}};
\ No newline at end of file