Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / services / xdr / recordings.controller.js
index 49a6d12..7a6c4af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x92da=['membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','error','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','.wav49','value','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./utils','./transfers.controller','info','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then'];(function(_0x411dc0,_0x43ba92){var _0x5bd617=function(_0x46ddd9){while(--_0x46ddd9){_0x411dc0['push'](_0x411dc0['shift']());}};_0x5bd617(++_0x43ba92);}(_0x92da,0x166));var _0xa92d=function(_0x30cea0,_0x5cf981){_0x30cea0=_0x30cea0-0x0;var _0x177910=_0x92da[_0x30cea0];return _0x177910;};'use strict';var _=require(_0xa92d('0x0'));var util=require(_0xa92d('0x1'));var utils=require(_0xa92d('0x2'));var transfers=require(_0xa92d('0x3'));var recordings={};function writeDB(_0x478fe0){var _0x495119;utils[_0xa92d('0x4')](util['format'](_0xa92d('0x5'),_0x478fe0[_0xa92d('0x6')]));if(transfers[_0xa92d('0x7')][_0x478fe0[_0xa92d('0x6')]]){_0x495119=_0x478fe0[_0xa92d('0x6')];_0x478fe0[_0xa92d('0x6')]=transfers[_0xa92d('0x7')][_0x478fe0['uniqueid']][_0xa92d('0x8')];}if(_0x478fe0[_0xa92d('0x9')]){utils[_0xa92d('0xa')](_0x478fe0[_0xa92d('0x9')])[_0xa92d('0xb')](function(_0x10d1d6){if(_0x10d1d6){_0x478fe0[_0xa92d('0xc')]=_0x10d1d6[_0xa92d('0xd')];_0x478fe0[_0xa92d('0xe')]=_0x10d1d6['id'];}utils['request'](_0xa92d('0xf'),_0x478fe0);});}else{utils[_0xa92d('0x10')](_0xa92d('0xf'),_0x478fe0);}if(_0x495119)delete transfers[_0xa92d('0x7')][_0x495119];}exports[_0xa92d('0x11')]=function(_0x2f0b3b){try{utils[_0xa92d('0x12')](util['format'](_0xa92d('0x13'),_0x2f0b3b[_0xa92d('0x6')]),_0x2f0b3b);if(_0x2f0b3b[_0xa92d('0x6')]==_0x2f0b3b[_0xa92d('0x14')]){utils[_0xa92d('0x4')](util[_0xa92d('0x15')](_0xa92d('0x16'),_0x2f0b3b[_0xa92d('0x6')],_0x2f0b3b[_0xa92d('0x17')],_0x2f0b3b[_0xa92d('0x18')]));recordings[_0x2f0b3b[_0xa92d('0x6')]]={'uniqueid':_0x2f0b3b['uniqueid'],'accountcode':_0x2f0b3b[_0xa92d('0x9')],'exten':_0x2f0b3b[_0xa92d('0x18')],'context':_0x2f0b3b[_0xa92d('0x17')],'channel':_0x2f0b3b[_0xa92d('0x19')],'monitors':[]};}}catch(_0x9c1c2b){utils['error'](util[_0xa92d('0x15')](_0xa92d('0x13'),_0x2f0b3b['uniqueid']),_0x9c1c2b);}};exports[_0xa92d('0x1a')]=function(_0x1912ef){try{utils['debug'](util[_0xa92d('0x15')](_0xa92d('0x1b'),_0x1912ef['uniqueid']),_0x1912ef);if(!_[_0xa92d('0x1c')](recordings[_0x1912ef[_0xa92d('0x6')]])&&_0x1912ef['channelstate']==0x6){utils[_0xa92d('0x4')](util[_0xa92d('0x15')](_0xa92d('0x1d'),_0x1912ef['uniqueid'],_0x1912ef[_0xa92d('0x17')],_0x1912ef[_0xa92d('0x19')]));}else if(!_[_0xa92d('0x1c')](recordings[_0x1912ef[_0xa92d('0x14')]])&&_0x1912ef['channelstate']==0x6&&_0x1912ef['context']!=_0xa92d('0x1e')){utils[_0xa92d('0x4')](util[_0xa92d('0x15')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1912ef[_0xa92d('0x6')],_0x1912ef[_0xa92d('0x14')],_0x1912ef['context'],_0x1912ef[_0xa92d('0x19')]));recordings[_0x1912ef[_0xa92d('0x14')]][_0xa92d('0x9')]=_0x1912ef[_0xa92d('0x9')];}}catch(_0x491108){utils[_0xa92d('0x1f')](util[_0xa92d('0x15')](_0xa92d('0x1b'),_0x1912ef[_0xa92d('0x6')]),_0x491108);}};exports['varset']=function(_0x5cdb0c){try{if(!_[_0xa92d('0x1c')](_0x5cdb0c[_0xa92d('0x20')])&&!_[_0xa92d('0x1c')](_0x5cdb0c[_0xa92d('0x20')][_0xa92d('0x21')])){utils['debug'](util[_0xa92d('0x15')]('[%s][recordings][varset]',_0x5cdb0c[_0xa92d('0x6')]),_0x5cdb0c);utils[_0xa92d('0x4')](util[_0xa92d('0x15')](_0xa92d('0x22'),_0x5cdb0c[_0xa92d('0x6')],_0x5cdb0c['variable'],_0x5cdb0c['value']));if(_[_0xa92d('0x23')](_0x5cdb0c['value'],_0xa92d('0x24'))){_0x5cdb0c[_0xa92d('0x25')]=_0x5cdb0c['value'][_0xa92d('0x26')](_0xa92d('0x24'),'.WAV');}if(recordings[_0x5cdb0c['linkedid']]){var _0x9563e3=_[_0xa92d('0x27')](recordings[_0x5cdb0c[_0xa92d('0x14')]][_0xa92d('0x28')],{'value':_0x5cdb0c['value']});if(_[_0xa92d('0x1c')](_0x9563e3)){recordings[_0x5cdb0c[_0xa92d('0x14')]][_0xa92d('0x28')][_0xa92d('0x29')]({'value':_0x5cdb0c[_0xa92d('0x25')]});}}}}catch(_0x4b87c9){utils['error'](util[_0xa92d('0x15')]('[%s][recordings][varset]',_0x5cdb0c['uniqueid']),_0x4b87c9);}};exports[_0xa92d('0x2a')]=function(_0x2f57d5){try{if(!_[_0xa92d('0x1c')](recordings[_0x2f57d5[_0xa92d('0x6')]])){utils[_0xa92d('0x12')](util[_0xa92d('0x15')](_0xa92d('0x2b'),_0x2f57d5[_0xa92d('0x6')]),_0x2f57d5);utils[_0xa92d('0x4')](util[_0xa92d('0x15')](_0xa92d('0x2c'),_0x2f57d5[_0xa92d('0x6')],_0x2f57d5[_0xa92d('0x2d')],_0x2f57d5[_0xa92d('0x2e')],_0x2f57d5['cause-txt']));recordings[_0x2f57d5[_0xa92d('0x6')]][_0xa92d('0x2d')]=_0x2f57d5[_0xa92d('0x2d')];recordings[_0x2f57d5[_0xa92d('0x6')]][_0xa92d('0x2e')]=_0x2f57d5['calleridname'];recordings[_0x2f57d5[_0xa92d('0x6')]]['connectedlinenum']=_0x2f57d5[_0xa92d('0x2f')];recordings[_0x2f57d5['uniqueid']][_0xa92d('0x30')]=_0x2f57d5[_0xa92d('0x30')];if(recordings[_0x2f57d5[_0xa92d('0x6')]][_0xa92d('0x31')]==_0xa92d('0x32')&&recordings[_0x2f57d5[_0xa92d('0x6')]][_0xa92d('0x9')]){recordings[_0x2f57d5[_0xa92d('0x6')]][_0xa92d('0x2f')]=recordings[_0x2f57d5[_0xa92d('0x6')]][_0xa92d('0x9')];recordings[_0x2f57d5[_0xa92d('0x6')]][_0xa92d('0x30')]='';}recordings[_0x2f57d5[_0xa92d('0x6')]][_0xa92d('0x28')][_0xa92d('0x33')](function(_0x452285){var _0xf76bb8=_['clone'](recordings[_0x2f57d5[_0xa92d('0x6')]]);_0xf76bb8[_0xa92d('0x25')]=_0x452285[_0xa92d('0x25')];writeDB(_0xf76bb8);});delete recordings[_0x2f57d5[_0xa92d('0x6')]];}}catch(_0x43c7f9){utils[_0xa92d('0x1f')](util[_0xa92d('0x15')](_0xa92d('0x2b'),_0x2f57d5[_0xa92d('0x6')]),_0x43c7f9);}};exports[_0xa92d('0x34')]=function(_0x24262a){try{if(!_[_0xa92d('0x1c')](recordings[_0x24262a[_0xa92d('0x6')]])){utils['debug'](util['format'](_0xa92d('0x35'),_0x24262a[_0xa92d('0x6')]),_0x24262a);utils[_0xa92d('0x4')](util[_0xa92d('0x15')](_0xa92d('0x36'),_0x24262a[_0xa92d('0x6')],_0x24262a[_0xa92d('0x37')],_0x24262a[_0xa92d('0x38')]));if(_0x24262a[_0xa92d('0x37')][_0xa92d('0x39')]()==_0xa92d('0x3a')&&_['startsWith'](_0x24262a[_0xa92d('0x38')][_0xa92d('0x39')](),_0xa92d('0x3b'))){var _0x56964a=_0x24262a['appdata'][_0xa92d('0x3c')]('=');var _0x4668c4=_0x56964a[0x0][_0xa92d('0x3d')](_0x56964a[0x0][_0xa92d('0x3e')]('(')+0x1,_0x56964a[0x0][_0xa92d('0x3e')](')'));var _0x52c4d7=_0x56964a[0x1];recordings[_0x24262a[_0xa92d('0x6')]][_0x4668c4]=_0x52c4d7;}}}catch(_0x2ef43f){utils[_0xa92d('0x1f')](util[_0xa92d('0x15')](_0xa92d('0x35'),_0x24262a[_0xa92d('0x6')]),_0x2ef43f);}};exports[_0xa92d('0x3f')]=function(_0x3077c9){try{if(!_['isNil'](recordings[_0x3077c9['uniqueid']])){utils[_0xa92d('0x12')](util['format'](_0xa92d('0x40'),_0x3077c9[_0xa92d('0x6')]),_0x3077c9);utils[_0xa92d('0x4')](util['format'](_0xa92d('0x41'),_0x3077c9[_0xa92d('0x6')],_0x3077c9[_0xa92d('0x42')]));recordings[_0x3077c9[_0xa92d('0x6')]][_0xa92d('0x42')]=_0x3077c9[_0xa92d('0x42')];}}catch(_0x5be5b7){utils['error'](util[_0xa92d('0x15')](_0xa92d('0x40'),_0x3077c9[_0xa92d('0x6')]),_0x5be5b7);}};exports[_0xa92d('0x43')]=function(_0xc093e4){try{utils['debug'](util['format'](_0xa92d('0x44'),_0xc093e4['uniqueid']),_0xc093e4);utils['info'](util[_0xa92d('0x15')](_0xa92d('0x45'),_0xc093e4[_0xa92d('0x6')],_0xc093e4[_0xa92d('0x46')],_0xc093e4['transferercalleridname'],_0xc093e4[_0xa92d('0x47')],_0xc093e4[_0xa92d('0x48')]));if(recordings[_0xc093e4[_0xa92d('0x49')]]&&transfers[_0xa92d('0x7')][_0xc093e4['transfereruniqueid']]){transfers[_0xa92d('0x7')][_0xc093e4['transfereruniqueid']]['recording']=!![];}}catch(_0x4a1f4c){utils[_0xa92d('0x1f')](util[_0xa92d('0x15')](_0xa92d('0x44'),_0xc093e4[_0xa92d('0x6')]),_0x4a1f4c);}};
\ No newline at end of file
+var _0x3797=['transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','then','name','UserId','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate'];(function(_0x6f45dc,_0x379e7e){var _0x6d01d7=function(_0x59597a){while(--_0x59597a){_0x6f45dc['push'](_0x6f45dc['shift']());}};_0x6d01d7(++_0x379e7e);}(_0x3797,0x1df));var _0x7379=function(_0x485584,_0x588a02){_0x485584=_0x485584-0x0;var _0x20c9f5=_0x3797[_0x485584];return _0x20c9f5;};'use strict';var _=require(_0x7379('0x0'));var util=require(_0x7379('0x1'));var utils=require(_0x7379('0x2'));var recordings={};function writeDB(_0x2995ea){utils[_0x7379('0x3')](util[_0x7379('0x4')](_0x7379('0x5'),_0x2995ea['uniqueid']));if(_0x2995ea[_0x7379('0x6')]){utils['getUserByInternal'](_0x2995ea[_0x7379('0x6')])[_0x7379('0x7')](function(_0x3f602f){if(_0x3f602f){_0x2995ea['membername']=_0x3f602f[_0x7379('0x8')];_0x2995ea[_0x7379('0x9')]=_0x3f602f['id'];}utils['request'](_0x7379('0xa'),_0x2995ea);});}else{utils['request']('CreateVoiceRecording',_0x2995ea);}}exports[_0x7379('0xb')]=function(_0x325e43){try{utils[_0x7379('0xc')](util[_0x7379('0x4')](_0x7379('0xd'),_0x325e43[_0x7379('0xe')]),_0x325e43);if(_0x325e43[_0x7379('0xe')]==_0x325e43[_0x7379('0xf')]){utils[_0x7379('0x3')](util[_0x7379('0x4')](_0x7379('0x10'),_0x325e43[_0x7379('0xe')],_0x325e43[_0x7379('0x11')],_0x325e43[_0x7379('0x12')]));recordings[_0x325e43['uniqueid']]={'uniqueid':_0x325e43[_0x7379('0xe')],'accountcode':_0x325e43[_0x7379('0x6')],'exten':_0x325e43[_0x7379('0x12')],'context':_0x325e43['context'],'channel':_0x325e43[_0x7379('0x13')],'monitors':[]};}}catch(_0x39493e){utils[_0x7379('0x14')](util[_0x7379('0x4')](_0x7379('0xd'),_0x325e43['uniqueid']),_0x39493e);}};exports['newstate']=function(_0x364dd8){try{utils[_0x7379('0xc')](util['format'](_0x7379('0x15'),_0x364dd8[_0x7379('0xe')]),_0x364dd8);if(!_[_0x7379('0x16')](recordings[_0x364dd8['uniqueid']])&&_0x364dd8['channelstate']==0x6){utils[_0x7379('0x3')](util['format'](_0x7379('0x17'),_0x364dd8['uniqueid'],_0x364dd8[_0x7379('0x11')],_0x364dd8[_0x7379('0x13')]));}else if(!_[_0x7379('0x16')](recordings[_0x364dd8[_0x7379('0xf')]])&&_0x364dd8[_0x7379('0x18')]==0x6&&_0x364dd8['context']!=_0x7379('0x19')){utils[_0x7379('0x3')](util[_0x7379('0x4')](_0x7379('0x1a'),_0x364dd8[_0x7379('0xe')],_0x364dd8[_0x7379('0xf')],_0x364dd8[_0x7379('0x11')],_0x364dd8[_0x7379('0x13')]));recordings[_0x364dd8[_0x7379('0xf')]][_0x7379('0x6')]=_0x364dd8['accountcode'];}}catch(_0x5b828a){utils[_0x7379('0x14')](util[_0x7379('0x4')](_0x7379('0x15'),_0x364dd8[_0x7379('0xe')]),_0x5b828a);}};exports[_0x7379('0x1b')]=function(_0x23866c){try{if(!_[_0x7379('0x16')](_0x23866c[_0x7379('0x1c')])&&!_['isNil'](_0x23866c[_0x7379('0x1c')][_0x7379('0x1d')])){utils[_0x7379('0xc')](util[_0x7379('0x4')](_0x7379('0x1e'),_0x23866c[_0x7379('0xe')]),_0x23866c);utils[_0x7379('0x3')](util[_0x7379('0x4')](_0x7379('0x1f'),_0x23866c['uniqueid'],_0x23866c[_0x7379('0x1c')],_0x23866c['value']));if(_[_0x7379('0x20')](_0x23866c[_0x7379('0x21')],'.wav49')){_0x23866c[_0x7379('0x21')]=_0x23866c[_0x7379('0x21')][_0x7379('0x22')](_0x7379('0x23'),_0x7379('0x24'));}if(recordings[_0x23866c[_0x7379('0xf')]]){var _0x53c0e6=_[_0x7379('0x25')](recordings[_0x23866c[_0x7379('0xf')]][_0x7379('0x26')],{'value':_0x23866c[_0x7379('0x21')]});if(_[_0x7379('0x16')](_0x53c0e6)){recordings[_0x23866c['linkedid']][_0x7379('0x26')][_0x7379('0x27')]({'value':_0x23866c[_0x7379('0x21')]});}}}}catch(_0x5bb45a){utils[_0x7379('0x14')](util['format'](_0x7379('0x1e'),_0x23866c['uniqueid']),_0x5bb45a);}};exports[_0x7379('0x28')]=function(_0x5085be){try{if(!_[_0x7379('0x16')](recordings[_0x5085be[_0x7379('0xe')]])){utils[_0x7379('0xc')](util[_0x7379('0x4')](_0x7379('0x29'),_0x5085be[_0x7379('0xe')]),_0x5085be);utils[_0x7379('0x3')](util[_0x7379('0x4')](_0x7379('0x2a'),_0x5085be[_0x7379('0xe')],_0x5085be[_0x7379('0x2b')],_0x5085be[_0x7379('0x2c')],_0x5085be['cause-txt']));recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2b')]=_0x5085be[_0x7379('0x2b')];recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2c')]=_0x5085be['calleridname'];recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2d')]=_0x5085be[_0x7379('0x2d')];recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2e')]=_0x5085be[_0x7379('0x2e')];if(recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2f')]=='outbound'&&recordings[_0x5085be[_0x7379('0xe')]]['accountcode']){recordings[_0x5085be['uniqueid']]['connectedlinenum']=recordings[_0x5085be[_0x7379('0xe')]]['accountcode'];recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2e')]='';}recordings[_0x5085be['uniqueid']][_0x7379('0x26')][_0x7379('0x30')](function(_0x4ac468){var _0x25a83d=_[_0x7379('0x31')](recordings[_0x5085be[_0x7379('0xe')]]);_0x25a83d['value']=_0x4ac468[_0x7379('0x21')];writeDB(_0x25a83d);});delete recordings[_0x5085be['uniqueid']];}}catch(_0x555120){utils[_0x7379('0x14')](util[_0x7379('0x4')]('[%s][recordings][hangup]',_0x5085be[_0x7379('0xe')]),_0x555120);}};exports[_0x7379('0x32')]=function(_0x269544){try{if(!_[_0x7379('0x16')](recordings[_0x269544[_0x7379('0xe')]])){utils[_0x7379('0xc')](util[_0x7379('0x4')](_0x7379('0x33'),_0x269544[_0x7379('0xe')]),_0x269544);utils['info'](util[_0x7379('0x4')](_0x7379('0x34'),_0x269544[_0x7379('0xe')],_0x269544['application'],_0x269544['appdata']));if(_0x269544[_0x7379('0x35')][_0x7379('0x36')]()=='set'&&_[_0x7379('0x37')](_0x269544[_0x7379('0x38')][_0x7379('0x36')](),_0x7379('0x39'))){var _0x40f4bc=_0x269544['appdata'][_0x7379('0x3a')]('=');var _0x455eb9=_0x40f4bc[0x0]['substring'](_0x40f4bc[0x0][_0x7379('0x3b')]('(')+0x1,_0x40f4bc[0x0]['lastIndexOf'](')'));var _0x4f1eaf=_0x40f4bc[0x1];recordings[_0x269544['uniqueid']][_0x455eb9]=_0x4f1eaf;}}}catch(_0x405036){utils[_0x7379('0x14')](util['format'](_0x7379('0x33'),_0x269544[_0x7379('0xe')]),_0x405036);}};exports['queuecallerjoin']=function(_0x49058a){try{if(!_[_0x7379('0x16')](recordings[_0x49058a[_0x7379('0xe')]])){utils['debug'](util['format'](_0x7379('0x3c'),_0x49058a['uniqueid']),_0x49058a);utils[_0x7379('0x3')](util['format'](_0x7379('0x3d'),_0x49058a[_0x7379('0xe')],_0x49058a['queue']));recordings[_0x49058a['uniqueid']]['queue']=_0x49058a[_0x7379('0x3e')];}}catch(_0x360fb4){utils['error'](util[_0x7379('0x4')](_0x7379('0x3c'),_0x49058a['uniqueid']),_0x360fb4);}};
\ No newline at end of file