Built motion from commit 97153652.|2.6.26
[motion2.git] / server / services / xdr / recordings.controller.js
index 892d4c8..8eac415 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['UserId','request','CreateVoiceRecording','uniqueid','linkedid','context','channel','error','stack','isNil','channelstate','varset','variable','endsWith','value','.wav49','.WAV','find','monitors','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','./utils','debug','accountcode','getUserByInternal','then','name'];(function(_0x564b25,_0x4dc0b4){var _0xc3646c=function(_0x102ea5){while(--_0x102ea5){_0x564b25['push'](_0x564b25['shift']());}};_0xc3646c(++_0x4dc0b4);}(_0xedd9,0xfc));var _0x9edd=function(_0x24536d,_0x328e89){_0x24536d=_0x24536d-0x0;var _0x46b6ed=_0xedd9[_0x24536d];return _0x46b6ed;};'use strict';var _=require('lodash');var utils=require(_0x9edd('0x0'));var recordings={};function writeDB(_0x2d7989){utils[_0x9edd('0x1')](_0x2d7989);if(_0x2d7989[_0x9edd('0x2')]){utils[_0x9edd('0x3')](_0x2d7989[_0x9edd('0x2')])[_0x9edd('0x4')](function(_0x36b53f){if(_0x36b53f){_0x2d7989['membername']=_0x36b53f[_0x9edd('0x5')];_0x2d7989[_0x9edd('0x6')]=_0x36b53f['id'];}utils[_0x9edd('0x7')](_0x9edd('0x8'),_0x2d7989);});}else{utils['request'](_0x9edd('0x8'),_0x2d7989);}}exports['newchannel']=function(_0x172522){try{if(_0x172522[_0x9edd('0x9')]==_0x172522[_0x9edd('0xa')]){recordings[_0x172522[_0x9edd('0x9')]]={'uniqueid':_0x172522['uniqueid'],'accountcode':_0x172522[_0x9edd('0x2')],'exten':_0x172522['exten'],'context':_0x172522[_0x9edd('0xb')],'channel':_0x172522[_0x9edd('0xc')],'monitors':[]};}}catch(_0x523026){utils[_0x9edd('0xd')](_0x523026[_0x9edd('0xe')]);}};exports['newstate']=function(_0x30c0d7){try{if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0x9')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6){}else if(!_[_0x9edd('0xf')](recordings[_0x30c0d7[_0x9edd('0xa')]])&&_0x30c0d7[_0x9edd('0x10')]==0x6&&_0x30c0d7[_0x9edd('0xb')]!='transfer'){recordings[_0x30c0d7[_0x9edd('0xa')]][_0x9edd('0x2')]=_0x30c0d7[_0x9edd('0x2')];}}catch(_0x4d9a7){utils[_0x9edd('0xd')](_0x4d9a7[_0x9edd('0xe')]);}};exports[_0x9edd('0x11')]=function(_0x75a4ab){try{if(!_['isNil'](_0x75a4ab[_0x9edd('0x12')])&&!_[_0x9edd('0xf')](_0x75a4ab[_0x9edd('0x12')]['mixmonitor_filename'])){if(_[_0x9edd('0x13')](_0x75a4ab[_0x9edd('0x14')],_0x9edd('0x15'))){_0x75a4ab['value']=_0x75a4ab[_0x9edd('0x14')]['replace'](_0x9edd('0x15'),_0x9edd('0x16'));}if(recordings[_0x75a4ab['linkedid']]){var _0x498977=_[_0x9edd('0x17')](recordings[_0x75a4ab['linkedid']][_0x9edd('0x18')],{'value':_0x75a4ab['value']});if(_['isNil'](_0x498977)){recordings[_0x75a4ab[_0x9edd('0xa')]][_0x9edd('0x18')]['push']({'value':_0x75a4ab['value']});}}}}catch(_0x341d67){utils[_0x9edd('0xd')](_0x341d67[_0x9edd('0xe')]);}};exports['hangup']=function(_0x3741c8){try{if(!_[_0x9edd('0xf')](recordings[_0x3741c8[_0x9edd('0x9')]])){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x19')]=_0x3741c8['calleridnum'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1a')]=_0x3741c8[_0x9edd('0x1a')];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=_0x3741c8['connectedlinenum'];recordings[_0x3741c8['uniqueid']][_0x9edd('0x1c')]=_0x3741c8[_0x9edd('0x1c')];if(recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1d')]==_0x9edd('0x1e')&&recordings[_0x3741c8['uniqueid']]['accountcode']){recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1b')]=recordings[_0x3741c8[_0x9edd('0x9')]]['accountcode'];recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x1c')]='';}recordings[_0x3741c8[_0x9edd('0x9')]][_0x9edd('0x18')]['forEach'](_0x2155a1=>{var _0x3fb556=_[_0x9edd('0x1f')](recordings[_0x3741c8[_0x9edd('0x9')]]);_0x3fb556[_0x9edd('0x14')]=_0x2155a1[_0x9edd('0x14')];writeDB(_0x3fb556);});delete recordings[_0x3741c8[_0x9edd('0x9')]];}}catch(_0x1fba7b){utils[_0x9edd('0xd')](_0x1fba7b[_0x9edd('0xe')]);}};exports[_0x9edd('0x20')]=function(_0x138002){try{if(!_[_0x9edd('0xf')](recordings[_0x138002[_0x9edd('0x9')]])){if(_0x138002[_0x9edd('0x21')]['toLowerCase']()==_0x9edd('0x22')&&_[_0x9edd('0x23')](_0x138002[_0x9edd('0x24')]['toLowerCase'](),_0x9edd('0x25'))){var _0x3990fb=_0x138002[_0x9edd('0x24')][_0x9edd('0x26')]('=');var _0x21bc30=_0x3990fb[0x0][_0x9edd('0x27')](_0x3990fb[0x0][_0x9edd('0x28')]('(')+0x1,_0x3990fb[0x0][_0x9edd('0x28')](')'));var _0xd0fd74=_0x3990fb[0x1];recordings[_0x138002[_0x9edd('0x9')]][_0x21bc30]=_0xd0fd74;}}}catch(_0x29e789){utils[_0x9edd('0xd')](_0x29e789[_0x9edd('0xe')]);}};exports[_0x9edd('0x29')]=function(_0x5757fc){try{if(!_[_0x9edd('0xf')](recordings[_0x5757fc['uniqueid']])){recordings[_0x5757fc[_0x9edd('0x9')]][_0x9edd('0x2a')]=_0x5757fc[_0x9edd('0x2a')];}}catch(_0x434d26){utils[_0x9edd('0xd')](_0x434d26['stack']);}};
\ No newline at end of file
+var _0x3d45=['queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','getUserByInternal','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','channel','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.wav49','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf'];(function(_0x2ed31f,_0x505a7a){var _0x10f7b8=function(_0x2d6d82){while(--_0x2d6d82){_0x2ed31f['push'](_0x2ed31f['shift']());}};_0x10f7b8(++_0x505a7a);}(_0x3d45,0x1d2));var _0x53d4=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3d45[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x53d4('0x0'));var util=require(_0x53d4('0x1'));var utils=require(_0x53d4('0x2'));var recordings={};function writeDB(_0x49a2a0){utils[_0x53d4('0x3')](util['format'](_0x53d4('0x4'),_0x49a2a0[_0x53d4('0x5')]));if(_0x49a2a0['accountcode']){utils[_0x53d4('0x6')](_0x49a2a0['accountcode'])['then'](function(_0x4cfea8){if(_0x4cfea8){_0x49a2a0['membername']=_0x4cfea8[_0x53d4('0x7')];_0x49a2a0[_0x53d4('0x8')]=_0x4cfea8['id'];}utils[_0x53d4('0x9')](_0x53d4('0xa'),_0x49a2a0);});}else{utils[_0x53d4('0x9')]('CreateVoiceRecording',_0x49a2a0);}}exports[_0x53d4('0xb')]=function(_0x20b209){try{utils[_0x53d4('0xc')](util['format'](_0x53d4('0xd'),_0x20b209['uniqueid']),_0x20b209);if(_0x20b209[_0x53d4('0x5')]==_0x20b209[_0x53d4('0xe')]){utils[_0x53d4('0x3')](util[_0x53d4('0xf')](_0x53d4('0x10'),_0x20b209['uniqueid'],_0x20b209[_0x53d4('0x11')],_0x20b209[_0x53d4('0x12')]));recordings[_0x20b209[_0x53d4('0x5')]]={'uniqueid':_0x20b209['uniqueid'],'accountcode':_0x20b209[_0x53d4('0x13')],'exten':_0x20b209[_0x53d4('0x12')],'context':_0x20b209['context'],'channel':_0x20b209[_0x53d4('0x14')],'monitors':[]};}}catch(_0x4999ac){utils[_0x53d4('0x15')](util[_0x53d4('0xf')](_0x53d4('0xd'),_0x20b209['uniqueid']),_0x4999ac);}};exports[_0x53d4('0x16')]=function(_0x121bcb){try{utils[_0x53d4('0xc')](util[_0x53d4('0xf')](_0x53d4('0x17'),_0x121bcb['uniqueid']),_0x121bcb);if(!_[_0x53d4('0x18')](recordings[_0x121bcb[_0x53d4('0x5')]])&&_0x121bcb['channelstate']==0x6){utils['info'](util[_0x53d4('0xf')](_0x53d4('0x19'),_0x121bcb[_0x53d4('0x5')],_0x121bcb['context'],_0x121bcb[_0x53d4('0x14')]));}else if(!_[_0x53d4('0x18')](recordings[_0x121bcb[_0x53d4('0xe')]])&&_0x121bcb[_0x53d4('0x1a')]==0x6&&_0x121bcb[_0x53d4('0x11')]!=_0x53d4('0x1b')){utils[_0x53d4('0x3')](util[_0x53d4('0xf')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x121bcb['uniqueid'],_0x121bcb['linkedid'],_0x121bcb[_0x53d4('0x11')],_0x121bcb['channel']));recordings[_0x121bcb[_0x53d4('0xe')]][_0x53d4('0x13')]=_0x121bcb[_0x53d4('0x13')];}}catch(_0x17917a){utils[_0x53d4('0x15')](util[_0x53d4('0xf')](_0x53d4('0x17'),_0x121bcb[_0x53d4('0x5')]),_0x17917a);}};exports[_0x53d4('0x1c')]=function(_0x62219c){try{if(!_[_0x53d4('0x18')](_0x62219c[_0x53d4('0x1d')])&&!_[_0x53d4('0x18')](_0x62219c[_0x53d4('0x1d')][_0x53d4('0x1e')])){utils[_0x53d4('0xc')](util[_0x53d4('0xf')](_0x53d4('0x1f'),_0x62219c[_0x53d4('0x5')]),_0x62219c);utils['info'](util[_0x53d4('0xf')](_0x53d4('0x20'),_0x62219c[_0x53d4('0x5')],_0x62219c[_0x53d4('0x1d')],_0x62219c['value']));if(_[_0x53d4('0x21')](_0x62219c[_0x53d4('0x22')],'.wav49')){_0x62219c['value']=_0x62219c['value'][_0x53d4('0x23')](_0x53d4('0x24'),_0x53d4('0x25'));}if(recordings[_0x62219c[_0x53d4('0xe')]]){var _0x26e9f9=_['find'](recordings[_0x62219c[_0x53d4('0xe')]]['monitors'],{'value':_0x62219c[_0x53d4('0x22')]});if(_[_0x53d4('0x18')](_0x26e9f9)){recordings[_0x62219c[_0x53d4('0xe')]][_0x53d4('0x26')][_0x53d4('0x27')]({'value':_0x62219c[_0x53d4('0x22')]});}}}}catch(_0x5b3c3d){utils['error'](util[_0x53d4('0xf')]('[%s][recordings][varset]',_0x62219c['uniqueid']),_0x5b3c3d);}};exports[_0x53d4('0x28')]=function(_0x382b22){try{if(!_[_0x53d4('0x18')](recordings[_0x382b22[_0x53d4('0x5')]])){utils['debug'](util['format'](_0x53d4('0x29'),_0x382b22[_0x53d4('0x5')]),_0x382b22);utils[_0x53d4('0x3')](util[_0x53d4('0xf')](_0x53d4('0x2a'),_0x382b22[_0x53d4('0x5')],_0x382b22[_0x53d4('0x2b')],_0x382b22[_0x53d4('0x2c')],_0x382b22[_0x53d4('0x2d')]));recordings[_0x382b22[_0x53d4('0x5')]][_0x53d4('0x2b')]=_0x382b22[_0x53d4('0x2b')];recordings[_0x382b22[_0x53d4('0x5')]]['calleridname']=_0x382b22[_0x53d4('0x2c')];recordings[_0x382b22[_0x53d4('0x5')]][_0x53d4('0x2e')]=_0x382b22[_0x53d4('0x2e')];recordings[_0x382b22[_0x53d4('0x5')]][_0x53d4('0x2f')]=_0x382b22[_0x53d4('0x2f')];if(recordings[_0x382b22[_0x53d4('0x5')]][_0x53d4('0x30')]==_0x53d4('0x31')&&recordings[_0x382b22['uniqueid']]['accountcode']){recordings[_0x382b22[_0x53d4('0x5')]][_0x53d4('0x2e')]=recordings[_0x382b22['uniqueid']][_0x53d4('0x13')];recordings[_0x382b22['uniqueid']][_0x53d4('0x2f')]='';}recordings[_0x382b22['uniqueid']][_0x53d4('0x26')][_0x53d4('0x32')](function(_0x2c5e16){var _0x286962=_[_0x53d4('0x33')](recordings[_0x382b22['uniqueid']]);_0x286962[_0x53d4('0x22')]=_0x2c5e16[_0x53d4('0x22')];writeDB(_0x286962);});delete recordings[_0x382b22[_0x53d4('0x5')]];}}catch(_0x5d14a3){utils[_0x53d4('0x15')](util[_0x53d4('0xf')](_0x53d4('0x29'),_0x382b22['uniqueid']),_0x5d14a3);}};exports[_0x53d4('0x34')]=function(_0x7aacb2){try{if(!_[_0x53d4('0x18')](recordings[_0x7aacb2['uniqueid']])){utils['debug'](util[_0x53d4('0xf')](_0x53d4('0x35'),_0x7aacb2[_0x53d4('0x5')]),_0x7aacb2);utils[_0x53d4('0x3')](util[_0x53d4('0xf')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x7aacb2['uniqueid'],_0x7aacb2[_0x53d4('0x36')],_0x7aacb2[_0x53d4('0x37')]));if(_0x7aacb2[_0x53d4('0x36')][_0x53d4('0x38')]()==_0x53d4('0x39')&&_['startsWith'](_0x7aacb2[_0x53d4('0x37')][_0x53d4('0x38')](),_0x53d4('0x3a'))){var _0x260b84=_0x7aacb2['appdata'][_0x53d4('0x3b')]('=');var _0x2cc380=_0x260b84[0x0][_0x53d4('0x3c')](_0x260b84[0x0]['lastIndexOf']('(')+0x1,_0x260b84[0x0][_0x53d4('0x3d')](')'));var _0x243f1b=_0x260b84[0x1];recordings[_0x7aacb2[_0x53d4('0x5')]][_0x2cc380]=_0x243f1b;}}}catch(_0xd5f813){utils[_0x53d4('0x15')](util[_0x53d4('0xf')](_0x53d4('0x35'),_0x7aacb2[_0x53d4('0x5')]),_0xd5f813);}};exports[_0x53d4('0x3e')]=function(_0x23c339){try{if(!_[_0x53d4('0x18')](recordings[_0x23c339[_0x53d4('0x5')]])){utils['debug'](util[_0x53d4('0xf')](_0x53d4('0x3f'),_0x23c339['uniqueid']),_0x23c339);utils[_0x53d4('0x3')](util[_0x53d4('0xf')](_0x53d4('0x40'),_0x23c339['uniqueid'],_0x23c339[_0x53d4('0x41')]));recordings[_0x23c339[_0x53d4('0x5')]][_0x53d4('0x41')]=_0x23c339[_0x53d4('0x41')];}}catch(_0x2cdb45){utils[_0x53d4('0x15')](util['format'](_0x53d4('0x3f'),_0x23c339[_0x53d4('0x5')]),_0x2cdb45);}};
\ No newline at end of file