Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / services / xdr / recordings.controller.js
index 3227302..53f6bed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x277f=['accountcode','membername','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newchannel]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','channel','[%s][recordings][newstate]','varset','variable','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid'];(function(_0x458d65,_0x1ddb20){var _0x50e750=function(_0xb80554){while(--_0xb80554){_0x458d65['push'](_0x458d65['shift']());}};_0x50e750(++_0x1ddb20);}(_0x277f,0xc6));var _0xf277=function(_0x31ac9f,_0x526097){_0x31ac9f=_0x31ac9f-0x0;var _0x1e2a7c=_0x277f[_0x31ac9f];return _0x1e2a7c;};'use strict';var _=require(_0xf277('0x0'));var util=require('util');var utils=require(_0xf277('0x1'));var transfers=require(_0xf277('0x2'));var recordings={};function writeDB(_0x2868cf){var _0x479347;utils[_0xf277('0x3')](util[_0xf277('0x4')](_0xf277('0x5'),_0x2868cf[_0xf277('0x6')]));if(transfers[_0xf277('0x7')][_0x2868cf[_0xf277('0x6')]]){_0x479347=_0x2868cf[_0xf277('0x6')];_0x2868cf[_0xf277('0x6')]=transfers[_0xf277('0x7')][_0x2868cf[_0xf277('0x6')]][_0xf277('0x8')];}if(_0x2868cf[_0xf277('0x9')]){utils['getUserByInternal'](_0x2868cf['accountcode'])['then'](function(_0x1b095e){if(_0x1b095e){_0x2868cf[_0xf277('0xa')]=_0x1b095e['name'];_0x2868cf['UserId']=_0x1b095e['id'];}utils['request'](_0xf277('0xb'),_0x2868cf);});}else{utils['request'](_0xf277('0xb'),_0x2868cf);}if(_0x479347)delete transfers['blinds'][_0x479347];}exports[_0xf277('0xc')]=function(_0x198687){try{utils[_0xf277('0xd')](util[_0xf277('0x4')]('[%s][recordings][newchannel]',_0x198687['uniqueid']),_0x198687);if(_0x198687['uniqueid']==_0x198687[_0xf277('0xe')]){utils[_0xf277('0x3')](util['format'](_0xf277('0xf'),_0x198687[_0xf277('0x6')],_0x198687[_0xf277('0x10')],_0x198687[_0xf277('0x11')]));recordings[_0x198687[_0xf277('0x6')]]={'uniqueid':_0x198687['uniqueid'],'accountcode':_0x198687[_0xf277('0x9')],'exten':_0x198687[_0xf277('0x11')],'context':_0x198687[_0xf277('0x10')],'channel':_0x198687['channel'],'monitors':[]};}}catch(_0x4792f6){utils[_0xf277('0x12')](util[_0xf277('0x4')](_0xf277('0x13'),_0x198687[_0xf277('0x6')]),_0x4792f6);}};exports['newstate']=function(_0x45815a){try{utils[_0xf277('0xd')](util['format']('[%s][recordings][newstate]',_0x45815a[_0xf277('0x6')]),_0x45815a);if(!_[_0xf277('0x14')](recordings[_0x45815a[_0xf277('0x6')]])&&_0x45815a[_0xf277('0x15')]==0x6){utils[_0xf277('0x3')](util[_0xf277('0x4')](_0xf277('0x16'),_0x45815a[_0xf277('0x6')],_0x45815a['context'],_0x45815a['channel']));}else if(!_[_0xf277('0x14')](recordings[_0x45815a[_0xf277('0xe')]])&&_0x45815a[_0xf277('0x15')]==0x6&&_0x45815a['context']!=_0xf277('0x17')){utils[_0xf277('0x3')](util['format'](_0xf277('0x18'),_0x45815a[_0xf277('0x6')],_0x45815a['linkedid'],_0x45815a['context'],_0x45815a[_0xf277('0x19')]));recordings[_0x45815a[_0xf277('0xe')]][_0xf277('0x9')]=_0x45815a[_0xf277('0x9')];}}catch(_0x60b5aa){utils[_0xf277('0x12')](util[_0xf277('0x4')](_0xf277('0x1a'),_0x45815a['uniqueid']),_0x60b5aa);}};exports[_0xf277('0x1b')]=function(_0x2bb1fc){try{if(!_[_0xf277('0x14')](_0x2bb1fc[_0xf277('0x1c')])&&!_[_0xf277('0x14')](_0x2bb1fc[_0xf277('0x1c')]['mixmonitor_filename'])){utils[_0xf277('0xd')](util[_0xf277('0x4')]('[%s][recordings][varset]',_0x2bb1fc['uniqueid']),_0x2bb1fc);utils[_0xf277('0x3')](util[_0xf277('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x2bb1fc[_0xf277('0x6')],_0x2bb1fc[_0xf277('0x1c')],_0x2bb1fc[_0xf277('0x1d')]));if(_['endsWith'](_0x2bb1fc[_0xf277('0x1d')],_0xf277('0x1e'))){_0x2bb1fc['value']=_0x2bb1fc[_0xf277('0x1d')][_0xf277('0x1f')](_0xf277('0x1e'),_0xf277('0x20'));}if(recordings[_0x2bb1fc[_0xf277('0xe')]]){var _0x3f184f=_[_0xf277('0x21')](recordings[_0x2bb1fc['linkedid']]['monitors'],{'value':_0x2bb1fc[_0xf277('0x1d')]});if(_[_0xf277('0x14')](_0x3f184f)){recordings[_0x2bb1fc[_0xf277('0xe')]][_0xf277('0x22')][_0xf277('0x23')]({'value':_0x2bb1fc[_0xf277('0x1d')]});}}}}catch(_0xdb5d0){utils[_0xf277('0x12')](util[_0xf277('0x4')]('[%s][recordings][varset]',_0x2bb1fc[_0xf277('0x6')]),_0xdb5d0);}};exports[_0xf277('0x24')]=function(_0x176ef2){try{if(!_[_0xf277('0x14')](recordings[_0x176ef2[_0xf277('0x6')]])){utils['debug'](util[_0xf277('0x4')](_0xf277('0x25'),_0x176ef2[_0xf277('0x6')]),_0x176ef2);utils[_0xf277('0x3')](util[_0xf277('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x176ef2[_0xf277('0x6')],_0x176ef2['calleridnum'],_0x176ef2[_0xf277('0x26')],_0x176ef2[_0xf277('0x27')]));recordings[_0x176ef2[_0xf277('0x6')]][_0xf277('0x28')]=_0x176ef2[_0xf277('0x28')];recordings[_0x176ef2[_0xf277('0x6')]]['calleridname']=_0x176ef2[_0xf277('0x26')];recordings[_0x176ef2[_0xf277('0x6')]][_0xf277('0x29')]=_0x176ef2['connectedlinenum'];recordings[_0x176ef2[_0xf277('0x6')]][_0xf277('0x2a')]=_0x176ef2[_0xf277('0x2a')];if(recordings[_0x176ef2[_0xf277('0x6')]][_0xf277('0x2b')]==_0xf277('0x2c')&&recordings[_0x176ef2['uniqueid']][_0xf277('0x9')]){recordings[_0x176ef2[_0xf277('0x6')]][_0xf277('0x29')]=recordings[_0x176ef2[_0xf277('0x6')]][_0xf277('0x9')];recordings[_0x176ef2[_0xf277('0x6')]][_0xf277('0x2a')]='';}recordings[_0x176ef2[_0xf277('0x6')]][_0xf277('0x22')][_0xf277('0x2d')](function(_0x5a781a){var _0x2e1258=_[_0xf277('0x2e')](recordings[_0x176ef2[_0xf277('0x6')]]);_0x2e1258[_0xf277('0x1d')]=_0x5a781a['value'];writeDB(_0x2e1258);});delete recordings[_0x176ef2[_0xf277('0x6')]];}}catch(_0x2c68b8){utils[_0xf277('0x12')](util[_0xf277('0x4')]('[%s][recordings][hangup]',_0x176ef2[_0xf277('0x6')]),_0x2c68b8);}};exports[_0xf277('0x2f')]=function(_0x52b7fe){try{if(!_[_0xf277('0x14')](recordings[_0x52b7fe[_0xf277('0x6')]])){utils[_0xf277('0xd')](util[_0xf277('0x4')](_0xf277('0x30'),_0x52b7fe['uniqueid']),_0x52b7fe);utils[_0xf277('0x3')](util[_0xf277('0x4')](_0xf277('0x31'),_0x52b7fe['uniqueid'],_0x52b7fe[_0xf277('0x32')],_0x52b7fe[_0xf277('0x33')]));if(_0x52b7fe['application'][_0xf277('0x34')]()==_0xf277('0x35')&&_[_0xf277('0x36')](_0x52b7fe['appdata'][_0xf277('0x34')](),_0xf277('0x37'))){var _0x1fc0b0=_0x52b7fe[_0xf277('0x33')][_0xf277('0x38')]('=');var _0x59bff6=_0x1fc0b0[0x0][_0xf277('0x39')](_0x1fc0b0[0x0][_0xf277('0x3a')]('(')+0x1,_0x1fc0b0[0x0][_0xf277('0x3a')](')'));var _0x44e5e9=_0x1fc0b0[0x1];recordings[_0x52b7fe[_0xf277('0x6')]][_0x59bff6]=_0x44e5e9;}}}catch(_0x5551ee){utils['error'](util[_0xf277('0x4')](_0xf277('0x30'),_0x52b7fe[_0xf277('0x6')]),_0x5551ee);}};exports[_0xf277('0x3b')]=function(_0x11302d){try{if(!_[_0xf277('0x14')](recordings[_0x11302d[_0xf277('0x6')]])){utils['debug'](util[_0xf277('0x4')]('[%s][recordings][queuecallerjoin]',_0x11302d[_0xf277('0x6')]),_0x11302d);utils[_0xf277('0x3')](util[_0xf277('0x4')](_0xf277('0x3c'),_0x11302d[_0xf277('0x6')],_0x11302d[_0xf277('0x3d')]));recordings[_0x11302d[_0xf277('0x6')]][_0xf277('0x3d')]=_0x11302d[_0xf277('0x3d')];}}catch(_0x35eda6){utils[_0xf277('0x12')](util[_0xf277('0x4')]('[%s][recordings][queuecallerjoin]',_0x11302d[_0xf277('0x6')]),_0x35eda6);}};exports['blindtransfer']=function(_0x181740){try{utils[_0xf277('0xd')](util[_0xf277('0x4')](_0xf277('0x3e'),_0x181740[_0xf277('0x6')]),_0x181740);utils[_0xf277('0x3')](util[_0xf277('0x4')](_0xf277('0x3f'),_0x181740[_0xf277('0x6')],_0x181740[_0xf277('0x40')],_0x181740[_0xf277('0x41')],_0x181740[_0xf277('0x42')],_0x181740[_0xf277('0x43')]));if(recordings[_0x181740['transfereruniqueid']]&&transfers[_0xf277('0x7')][_0x181740[_0xf277('0x44')]]){transfers['blinds'][_0x181740['transfereruniqueid']]['recording']=!![];}}catch(_0x59ed46){utils[_0xf277('0x12')](util[_0xf277('0x4')]('[%s][recordings][blindtransfer]',_0x181740[_0xf277('0x6')]),_0x59ed46);}};
\ 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