Built motion from commit (unavailable).|2.5.27
[motion2.git] / server / services / xdr / recordings.controller.js
index e8671b0..38a75d6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x38ac=['channel','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','endsWith','.wav49','replace','.WAV','push','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','monitors','forEach','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','debug','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s'];(function(_0x4d0e30,_0x2bc876){var _0x463b46=function(_0x16074c){while(--_0x16074c){_0x4d0e30['push'](_0x4d0e30['shift']());}};_0x463b46(++_0x2bc876);}(_0x38ac,0x161));var _0xc38a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x38ac[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xc38a('0x0'));var util=require(_0xc38a('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x47c99c){utils['info'](util[_0xc38a('0x2')]('[%s][recordings][writeDB]',_0x47c99c[_0xc38a('0x3')]));if(_0x47c99c[_0xc38a('0x4')]){utils[_0xc38a('0x5')](_0x47c99c[_0xc38a('0x4')])[_0xc38a('0x6')](function(_0x4463d7){if(_0x4463d7){_0x47c99c[_0xc38a('0x7')]=_0x4463d7[_0xc38a('0x8')];_0x47c99c[_0xc38a('0x9')]=_0x4463d7['id'];}utils['request'](_0xc38a('0xa'),_0x47c99c);});}else{utils[_0xc38a('0xb')]('CreateVoiceRecording',_0x47c99c);}}exports['newchannel']=function(_0x3b2d1d){try{utils[_0xc38a('0xc')](util['format'](_0xc38a('0xd'),_0x3b2d1d[_0xc38a('0x3')]),_0x3b2d1d);if(_0x3b2d1d[_0xc38a('0x3')]==_0x3b2d1d[_0xc38a('0xe')]){utils[_0xc38a('0xf')](util[_0xc38a('0x2')](_0xc38a('0x10'),_0x3b2d1d[_0xc38a('0x3')],_0x3b2d1d[_0xc38a('0x11')],_0x3b2d1d[_0xc38a('0x12')]));recordings[_0x3b2d1d['uniqueid']]={'uniqueid':_0x3b2d1d[_0xc38a('0x3')],'accountcode':_0x3b2d1d[_0xc38a('0x4')],'exten':_0x3b2d1d[_0xc38a('0x12')],'context':_0x3b2d1d[_0xc38a('0x11')],'channel':_0x3b2d1d['channel'],'monitors':[]};}}catch(_0x517f5c){utils[_0xc38a('0x13')](util[_0xc38a('0x2')]('[%s][recordings][newchannel]',_0x3b2d1d[_0xc38a('0x3')]),_0x517f5c);}};exports[_0xc38a('0x14')]=function(_0x1e842a){try{utils[_0xc38a('0xc')](util['format'](_0xc38a('0x15'),_0x1e842a['uniqueid']),_0x1e842a);if(!_[_0xc38a('0x16')](recordings[_0x1e842a[_0xc38a('0x3')]])&&_0x1e842a[_0xc38a('0x17')]==0x6){utils[_0xc38a('0xf')](util[_0xc38a('0x2')](_0xc38a('0x18'),_0x1e842a[_0xc38a('0x3')],_0x1e842a[_0xc38a('0x11')],_0x1e842a[_0xc38a('0x19')]));}else if(!_[_0xc38a('0x16')](recordings[_0x1e842a[_0xc38a('0xe')]])&&_0x1e842a['channelstate']==0x6&&_0x1e842a['context']!=_0xc38a('0x1a')){utils['info'](util[_0xc38a('0x2')](_0xc38a('0x1b'),_0x1e842a[_0xc38a('0x3')],_0x1e842a[_0xc38a('0xe')],_0x1e842a[_0xc38a('0x11')],_0x1e842a[_0xc38a('0x19')]));recordings[_0x1e842a[_0xc38a('0xe')]][_0xc38a('0x4')]=_0x1e842a['accountcode'];}}catch(_0x2dbdd4){utils[_0xc38a('0x13')](util[_0xc38a('0x2')](_0xc38a('0x15'),_0x1e842a['uniqueid']),_0x2dbdd4);}};exports[_0xc38a('0x1c')]=function(_0x51a4c5){try{if(!_['isNil'](_0x51a4c5[_0xc38a('0x1d')])&&!_[_0xc38a('0x16')](_0x51a4c5[_0xc38a('0x1d')][_0xc38a('0x1e')])){utils[_0xc38a('0xc')](util[_0xc38a('0x2')](_0xc38a('0x1f'),_0x51a4c5[_0xc38a('0x3')]),_0x51a4c5);utils[_0xc38a('0xf')](util[_0xc38a('0x2')](_0xc38a('0x20'),_0x51a4c5[_0xc38a('0x3')],_0x51a4c5[_0xc38a('0x1d')],_0x51a4c5[_0xc38a('0x21')]));if(_[_0xc38a('0x22')](_0x51a4c5[_0xc38a('0x21')],_0xc38a('0x23'))){_0x51a4c5[_0xc38a('0x21')]=_0x51a4c5[_0xc38a('0x21')][_0xc38a('0x24')](_0xc38a('0x23'),_0xc38a('0x25'));}if(recordings[_0x51a4c5[_0xc38a('0xe')]]){var _0x4b0ab0=_['find'](recordings[_0x51a4c5[_0xc38a('0xe')]]['monitors'],{'value':_0x51a4c5[_0xc38a('0x21')]});if(_[_0xc38a('0x16')](_0x4b0ab0)){recordings[_0x51a4c5[_0xc38a('0xe')]]['monitors'][_0xc38a('0x26')]({'value':_0x51a4c5[_0xc38a('0x21')]});}}}}catch(_0x5a3939){utils[_0xc38a('0x13')](util['format'](_0xc38a('0x1f'),_0x51a4c5[_0xc38a('0x3')]),_0x5a3939);}};exports[_0xc38a('0x27')]=function(_0x161c7b){try{if(!_[_0xc38a('0x16')](recordings[_0x161c7b[_0xc38a('0x3')]])){utils[_0xc38a('0xc')](util[_0xc38a('0x2')](_0xc38a('0x28'),_0x161c7b[_0xc38a('0x3')]),_0x161c7b);utils[_0xc38a('0xf')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x161c7b[_0xc38a('0x3')],_0x161c7b['calleridnum'],_0x161c7b[_0xc38a('0x29')],_0x161c7b[_0xc38a('0x2a')]));recordings[_0x161c7b[_0xc38a('0x3')]][_0xc38a('0x2b')]=_0x161c7b['calleridnum'];recordings[_0x161c7b[_0xc38a('0x3')]]['calleridname']=_0x161c7b[_0xc38a('0x29')];recordings[_0x161c7b[_0xc38a('0x3')]]['connectedlinenum']=_0x161c7b[_0xc38a('0x2c')];recordings[_0x161c7b[_0xc38a('0x3')]][_0xc38a('0x2d')]=_0x161c7b[_0xc38a('0x2d')];if(recordings[_0x161c7b[_0xc38a('0x3')]][_0xc38a('0x2e')]==_0xc38a('0x2f')&&recordings[_0x161c7b['uniqueid']][_0xc38a('0x4')]){recordings[_0x161c7b[_0xc38a('0x3')]][_0xc38a('0x2c')]=recordings[_0x161c7b[_0xc38a('0x3')]]['accountcode'];recordings[_0x161c7b[_0xc38a('0x3')]][_0xc38a('0x2d')]='';}recordings[_0x161c7b[_0xc38a('0x3')]][_0xc38a('0x30')][_0xc38a('0x31')](function(_0x3d65f3){var _0x12da28=_['clone'](recordings[_0x161c7b['uniqueid']]);_0x12da28[_0xc38a('0x21')]=_0x3d65f3['value'];writeDB(_0x12da28);});delete recordings[_0x161c7b['uniqueid']];}}catch(_0x3ca05f){utils[_0xc38a('0x13')](util['format'](_0xc38a('0x28'),_0x161c7b[_0xc38a('0x3')]),_0x3ca05f);}};exports['newexten']=function(_0xa15baa){try{if(!_['isNil'](recordings[_0xa15baa['uniqueid']])){utils['debug'](util[_0xc38a('0x2')](_0xc38a('0x32'),_0xa15baa[_0xc38a('0x3')]),_0xa15baa);utils['info'](util[_0xc38a('0x2')](_0xc38a('0x33'),_0xa15baa['uniqueid'],_0xa15baa[_0xc38a('0x34')],_0xa15baa['appdata']));if(_0xa15baa[_0xc38a('0x34')][_0xc38a('0x35')]()==_0xc38a('0x36')&&_[_0xc38a('0x37')](_0xa15baa[_0xc38a('0x38')][_0xc38a('0x35')](),'cdr')){var _0x53e06a=_0xa15baa[_0xc38a('0x38')]['split']('=');var _0x301fbb=_0x53e06a[0x0][_0xc38a('0x39')](_0x53e06a[0x0][_0xc38a('0x3a')]('(')+0x1,_0x53e06a[0x0]['lastIndexOf'](')'));var _0x1be71e=_0x53e06a[0x1];recordings[_0xa15baa[_0xc38a('0x3')]][_0x301fbb]=_0x1be71e;}}}catch(_0xe59207){utils['error'](util[_0xc38a('0x2')]('[%s][recordings][newexten]',_0xa15baa[_0xc38a('0x3')]),_0xe59207);}};exports[_0xc38a('0x3b')]=function(_0x523dd0){try{if(!_[_0xc38a('0x16')](recordings[_0x523dd0[_0xc38a('0x3')]])){utils[_0xc38a('0xc')](util['format'](_0xc38a('0x3c'),_0x523dd0[_0xc38a('0x3')]),_0x523dd0);utils[_0xc38a('0xf')](util[_0xc38a('0x2')](_0xc38a('0x3d'),_0x523dd0['uniqueid'],_0x523dd0['queue']));recordings[_0x523dd0['uniqueid']]['queue']=_0x523dd0[_0xc38a('0x3e')];}}catch(_0x42c559){utils['error'](util['format'](_0xc38a('0x3c'),_0x523dd0['uniqueid']),_0x42c559);}};
\ No newline at end of file
+var _0x6f88=['[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','queue','util','info','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename'];(function(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0x6f88,0x96));var _0x86f8=function(_0x3a4a0e,_0x5dcf22){_0x3a4a0e=_0x3a4a0e-0x0;var _0x4c0220=_0x6f88[_0x3a4a0e];return _0x4c0220;};'use strict';var _=require('lodash');var util=require(_0x86f8('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x381b06){utils[_0x86f8('0x1')](util[_0x86f8('0x2')]('[%s][recordings][writeDB]',_0x381b06[_0x86f8('0x3')]));if(_0x381b06[_0x86f8('0x4')]){utils[_0x86f8('0x5')](_0x381b06['accountcode'])[_0x86f8('0x6')](function(_0x37fcc0){if(_0x37fcc0){_0x381b06[_0x86f8('0x7')]=_0x37fcc0[_0x86f8('0x8')];_0x381b06[_0x86f8('0x9')]=_0x37fcc0['id'];}utils['request'](_0x86f8('0xa'),_0x381b06);});}else{utils[_0x86f8('0xb')](_0x86f8('0xa'),_0x381b06);}}exports[_0x86f8('0xc')]=function(_0x177a9b){try{utils[_0x86f8('0xd')](util[_0x86f8('0x2')](_0x86f8('0xe'),_0x177a9b[_0x86f8('0x3')]),_0x177a9b);if(_0x177a9b[_0x86f8('0x3')]==_0x177a9b['linkedid']){utils['info'](util[_0x86f8('0x2')](_0x86f8('0xf'),_0x177a9b[_0x86f8('0x3')],_0x177a9b[_0x86f8('0x10')],_0x177a9b['exten']));recordings[_0x177a9b[_0x86f8('0x3')]]={'uniqueid':_0x177a9b[_0x86f8('0x3')],'accountcode':_0x177a9b[_0x86f8('0x4')],'exten':_0x177a9b[_0x86f8('0x11')],'context':_0x177a9b['context'],'channel':_0x177a9b[_0x86f8('0x12')],'monitors':[]};}}catch(_0x59e7ea){utils[_0x86f8('0x13')](util[_0x86f8('0x2')](_0x86f8('0xe'),_0x177a9b[_0x86f8('0x3')]),_0x59e7ea);}};exports[_0x86f8('0x14')]=function(_0x22318a){try{utils[_0x86f8('0xd')](util[_0x86f8('0x2')](_0x86f8('0x15'),_0x22318a[_0x86f8('0x3')]),_0x22318a);if(!_[_0x86f8('0x16')](recordings[_0x22318a[_0x86f8('0x3')]])&&_0x22318a['channelstate']==0x6){utils['info'](util[_0x86f8('0x2')](_0x86f8('0x17'),_0x22318a['uniqueid'],_0x22318a['context'],_0x22318a[_0x86f8('0x12')]));}else if(!_[_0x86f8('0x16')](recordings[_0x22318a[_0x86f8('0x18')]])&&_0x22318a[_0x86f8('0x19')]==0x6&&_0x22318a[_0x86f8('0x10')]!=_0x86f8('0x1a')){utils[_0x86f8('0x1')](util['format'](_0x86f8('0x1b'),_0x22318a['uniqueid'],_0x22318a[_0x86f8('0x18')],_0x22318a[_0x86f8('0x10')],_0x22318a['channel']));recordings[_0x22318a[_0x86f8('0x18')]][_0x86f8('0x4')]=_0x22318a[_0x86f8('0x4')];}}catch(_0x3ac8ac){utils['error'](util[_0x86f8('0x2')](_0x86f8('0x15'),_0x22318a[_0x86f8('0x3')]),_0x3ac8ac);}};exports['varset']=function(_0x3daf4f){try{if(!_[_0x86f8('0x16')](_0x3daf4f[_0x86f8('0x1c')])&&!_[_0x86f8('0x16')](_0x3daf4f['variable'][_0x86f8('0x1d')])){utils[_0x86f8('0xd')](util['format']('[%s][recordings][varset]',_0x3daf4f[_0x86f8('0x3')]),_0x3daf4f);utils[_0x86f8('0x1')](util[_0x86f8('0x2')](_0x86f8('0x1e'),_0x3daf4f[_0x86f8('0x3')],_0x3daf4f[_0x86f8('0x1c')],_0x3daf4f['value']));if(_[_0x86f8('0x1f')](_0x3daf4f[_0x86f8('0x20')],'.wav49')){_0x3daf4f['value']=_0x3daf4f[_0x86f8('0x20')][_0x86f8('0x21')]('.wav49',_0x86f8('0x22'));}if(recordings[_0x3daf4f[_0x86f8('0x18')]]){var _0x2b7404=_[_0x86f8('0x23')](recordings[_0x3daf4f[_0x86f8('0x18')]][_0x86f8('0x24')],{'value':_0x3daf4f[_0x86f8('0x20')]});if(_[_0x86f8('0x16')](_0x2b7404)){recordings[_0x3daf4f[_0x86f8('0x18')]][_0x86f8('0x24')][_0x86f8('0x25')]({'value':_0x3daf4f[_0x86f8('0x20')]});}}}}catch(_0x104373){utils[_0x86f8('0x13')](util['format']('[%s][recordings][varset]',_0x3daf4f['uniqueid']),_0x104373);}};exports[_0x86f8('0x26')]=function(_0x24264d){try{if(!_[_0x86f8('0x16')](recordings[_0x24264d[_0x86f8('0x3')]])){utils[_0x86f8('0xd')](util[_0x86f8('0x2')](_0x86f8('0x27'),_0x24264d[_0x86f8('0x3')]),_0x24264d);utils[_0x86f8('0x1')](util['format'](_0x86f8('0x28'),_0x24264d[_0x86f8('0x3')],_0x24264d[_0x86f8('0x29')],_0x24264d[_0x86f8('0x2a')],_0x24264d[_0x86f8('0x2b')]));recordings[_0x24264d[_0x86f8('0x3')]]['calleridnum']=_0x24264d[_0x86f8('0x29')];recordings[_0x24264d['uniqueid']][_0x86f8('0x2a')]=_0x24264d[_0x86f8('0x2a')];recordings[_0x24264d[_0x86f8('0x3')]]['connectedlinenum']=_0x24264d[_0x86f8('0x2c')];recordings[_0x24264d[_0x86f8('0x3')]][_0x86f8('0x2d')]=_0x24264d['connectedlinename'];if(recordings[_0x24264d['uniqueid']]['type']==_0x86f8('0x2e')&&recordings[_0x24264d[_0x86f8('0x3')]]['accountcode']){recordings[_0x24264d[_0x86f8('0x3')]]['connectedlinenum']=recordings[_0x24264d[_0x86f8('0x3')]][_0x86f8('0x4')];recordings[_0x24264d['uniqueid']][_0x86f8('0x2d')]='';}recordings[_0x24264d[_0x86f8('0x3')]][_0x86f8('0x24')]['forEach'](function(_0x875fd3){var _0x38d4c=_[_0x86f8('0x2f')](recordings[_0x24264d[_0x86f8('0x3')]]);_0x38d4c[_0x86f8('0x20')]=_0x875fd3[_0x86f8('0x20')];writeDB(_0x38d4c);});delete recordings[_0x24264d[_0x86f8('0x3')]];}}catch(_0xdc5a0a){utils[_0x86f8('0x13')](util[_0x86f8('0x2')](_0x86f8('0x27'),_0x24264d[_0x86f8('0x3')]),_0xdc5a0a);}};exports[_0x86f8('0x30')]=function(_0x1dcd3a){try{if(!_[_0x86f8('0x16')](recordings[_0x1dcd3a[_0x86f8('0x3')]])){utils['debug'](util['format'](_0x86f8('0x31'),_0x1dcd3a['uniqueid']),_0x1dcd3a);utils[_0x86f8('0x1')](util['format'](_0x86f8('0x32'),_0x1dcd3a[_0x86f8('0x3')],_0x1dcd3a[_0x86f8('0x33')],_0x1dcd3a[_0x86f8('0x34')]));if(_0x1dcd3a['application'][_0x86f8('0x35')]()==_0x86f8('0x36')&&_['startsWith'](_0x1dcd3a[_0x86f8('0x34')][_0x86f8('0x35')](),_0x86f8('0x37'))){var _0x35e94c=_0x1dcd3a[_0x86f8('0x34')][_0x86f8('0x38')]('=');var _0x4aabaf=_0x35e94c[0x0]['substring'](_0x35e94c[0x0][_0x86f8('0x39')]('(')+0x1,_0x35e94c[0x0][_0x86f8('0x39')](')'));var _0x1d0a3e=_0x35e94c[0x1];recordings[_0x1dcd3a[_0x86f8('0x3')]][_0x4aabaf]=_0x1d0a3e;}}}catch(_0xc217fc){utils['error'](util[_0x86f8('0x2')](_0x86f8('0x31'),_0x1dcd3a[_0x86f8('0x3')]),_0xc217fc);}};exports['queuecallerjoin']=function(_0x287006){try{if(!_[_0x86f8('0x16')](recordings[_0x287006['uniqueid']])){utils[_0x86f8('0xd')](util[_0x86f8('0x2')](_0x86f8('0x3a'),_0x287006[_0x86f8('0x3')]),_0x287006);utils[_0x86f8('0x1')](util[_0x86f8('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x287006[_0x86f8('0x3')],_0x287006[_0x86f8('0x3b')]));recordings[_0x287006[_0x86f8('0x3')]][_0x86f8('0x3b')]=_0x287006[_0x86f8('0x3b')];}}catch(_0x30e7dc){utils[_0x86f8('0x13')](util[_0x86f8('0x2')](_0x86f8('0x3a'),_0x287006[_0x86f8('0x3')]),_0x30e7dc);}};
\ No newline at end of file