Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / services / xdr / recordings.controller.js
index 53d35ed..0412ba9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4bd7=['cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','substring','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','util','./utils','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','channelstate','channel','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname'];(function(_0x4df8ce,_0x366183){var _0x50367d=function(_0x16e2dd){while(--_0x16e2dd){_0x4df8ce['push'](_0x4df8ce['shift']());}};_0x50367d(++_0x366183);}(_0x4bd7,0x13e));var _0x74bd=function(_0x95b44e,_0x4af5e1){_0x95b44e=_0x95b44e-0x0;var _0x4d33ea=_0x4bd7[_0x95b44e];return _0x4d33ea;};'use strict';var _=require('lodash');var util=require(_0x74bd('0x0'));var utils=require(_0x74bd('0x1'));var recordings={};function writeDB(_0x53ce58){utils['info'](util['format'](_0x74bd('0x2'),_0x53ce58[_0x74bd('0x3')]));if(_0x53ce58['accountcode']){utils['getUserByInternal'](_0x53ce58[_0x74bd('0x4')])[_0x74bd('0x5')](function(_0x47acd7){if(_0x47acd7){_0x53ce58[_0x74bd('0x6')]=_0x47acd7['name'];_0x53ce58[_0x74bd('0x7')]=_0x47acd7['id'];}utils[_0x74bd('0x8')](_0x74bd('0x9'),_0x53ce58);});}else{utils[_0x74bd('0x8')](_0x74bd('0x9'),_0x53ce58);}}exports[_0x74bd('0xa')]=function(_0x3166a1){try{utils[_0x74bd('0xb')](util[_0x74bd('0xc')](_0x74bd('0xd'),_0x3166a1[_0x74bd('0x3')]),_0x3166a1);if(_0x3166a1['uniqueid']==_0x3166a1['linkedid']){utils[_0x74bd('0xe')](util[_0x74bd('0xc')](_0x74bd('0xf'),_0x3166a1[_0x74bd('0x3')],_0x3166a1[_0x74bd('0x10')],_0x3166a1[_0x74bd('0x11')]));recordings[_0x3166a1[_0x74bd('0x3')]]={'uniqueid':_0x3166a1[_0x74bd('0x3')],'accountcode':_0x3166a1[_0x74bd('0x4')],'exten':_0x3166a1['exten'],'context':_0x3166a1[_0x74bd('0x10')],'channel':_0x3166a1['channel'],'monitors':[]};}}catch(_0x5e9cfb){utils[_0x74bd('0x12')](util[_0x74bd('0xc')](_0x74bd('0xd'),_0x3166a1['uniqueid']),_0x5e9cfb);}};exports[_0x74bd('0x13')]=function(_0x501a71){try{utils['debug'](util[_0x74bd('0xc')](_0x74bd('0x14'),_0x501a71['uniqueid']),_0x501a71);if(!_['isNil'](recordings[_0x501a71[_0x74bd('0x3')]])&&_0x501a71[_0x74bd('0x15')]==0x6){utils[_0x74bd('0xe')](util[_0x74bd('0xc')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x501a71[_0x74bd('0x3')],_0x501a71[_0x74bd('0x10')],_0x501a71[_0x74bd('0x16')]));}else if(!_[_0x74bd('0x17')](recordings[_0x501a71[_0x74bd('0x18')]])&&_0x501a71[_0x74bd('0x15')]==0x6&&_0x501a71[_0x74bd('0x10')]!=_0x74bd('0x19')){utils[_0x74bd('0xe')](util[_0x74bd('0xc')](_0x74bd('0x1a'),_0x501a71[_0x74bd('0x3')],_0x501a71[_0x74bd('0x18')],_0x501a71['context'],_0x501a71['channel']));recordings[_0x501a71['linkedid']]['accountcode']=_0x501a71['accountcode'];}}catch(_0x57d34b){utils['error'](util[_0x74bd('0xc')](_0x74bd('0x14'),_0x501a71[_0x74bd('0x3')]),_0x57d34b);}};exports['varset']=function(_0x2e2c58){try{if(!_['isNil'](_0x2e2c58[_0x74bd('0x1b')])&&!_[_0x74bd('0x17')](_0x2e2c58[_0x74bd('0x1b')][_0x74bd('0x1c')])){utils[_0x74bd('0xb')](util[_0x74bd('0xc')]('[%s][recordings][varset]',_0x2e2c58['uniqueid']),_0x2e2c58);utils[_0x74bd('0xe')](util['format'](_0x74bd('0x1d'),_0x2e2c58[_0x74bd('0x3')],_0x2e2c58[_0x74bd('0x1b')],_0x2e2c58[_0x74bd('0x1e')]));if(_[_0x74bd('0x1f')](_0x2e2c58[_0x74bd('0x1e')],_0x74bd('0x20'))){_0x2e2c58[_0x74bd('0x1e')]=_0x2e2c58['value']['replace'](_0x74bd('0x20'),'.WAV');}if(recordings[_0x2e2c58['linkedid']]){var _0xa116ba=_[_0x74bd('0x21')](recordings[_0x2e2c58[_0x74bd('0x18')]][_0x74bd('0x22')],{'value':_0x2e2c58[_0x74bd('0x1e')]});if(_['isNil'](_0xa116ba)){recordings[_0x2e2c58[_0x74bd('0x18')]][_0x74bd('0x22')][_0x74bd('0x23')]({'value':_0x2e2c58[_0x74bd('0x1e')]});}}}}catch(_0x2da75a){utils['error'](util[_0x74bd('0xc')](_0x74bd('0x24'),_0x2e2c58[_0x74bd('0x3')]),_0x2da75a);}};exports[_0x74bd('0x25')]=function(_0x2a12ad){try{if(!_['isNil'](recordings[_0x2a12ad[_0x74bd('0x3')]])){utils[_0x74bd('0xb')](util['format'](_0x74bd('0x26'),_0x2a12ad[_0x74bd('0x3')]),_0x2a12ad);utils[_0x74bd('0xe')](util[_0x74bd('0xc')](_0x74bd('0x27'),_0x2a12ad[_0x74bd('0x3')],_0x2a12ad[_0x74bd('0x28')],_0x2a12ad[_0x74bd('0x29')],_0x2a12ad[_0x74bd('0x2a')]));recordings[_0x2a12ad[_0x74bd('0x3')]]['calleridnum']=_0x2a12ad[_0x74bd('0x28')];recordings[_0x2a12ad[_0x74bd('0x3')]][_0x74bd('0x29')]=_0x2a12ad[_0x74bd('0x29')];recordings[_0x2a12ad[_0x74bd('0x3')]]['connectedlinenum']=_0x2a12ad[_0x74bd('0x2b')];recordings[_0x2a12ad['uniqueid']][_0x74bd('0x2c')]=_0x2a12ad['connectedlinename'];if(recordings[_0x2a12ad[_0x74bd('0x3')]][_0x74bd('0x2d')]==_0x74bd('0x2e')&&recordings[_0x2a12ad[_0x74bd('0x3')]][_0x74bd('0x4')]){recordings[_0x2a12ad[_0x74bd('0x3')]][_0x74bd('0x2b')]=recordings[_0x2a12ad['uniqueid']]['accountcode'];recordings[_0x2a12ad[_0x74bd('0x3')]][_0x74bd('0x2c')]='';}recordings[_0x2a12ad[_0x74bd('0x3')]][_0x74bd('0x22')][_0x74bd('0x2f')](function(_0x522569){var _0x46981a=_[_0x74bd('0x30')](recordings[_0x2a12ad['uniqueid']]);_0x46981a[_0x74bd('0x1e')]=_0x522569[_0x74bd('0x1e')];writeDB(_0x46981a);});delete recordings[_0x2a12ad['uniqueid']];}}catch(_0x27200c){utils[_0x74bd('0x12')](util[_0x74bd('0xc')](_0x74bd('0x26'),_0x2a12ad[_0x74bd('0x3')]),_0x27200c);}};exports['newexten']=function(_0x2de4a7){try{if(!_[_0x74bd('0x17')](recordings[_0x2de4a7[_0x74bd('0x3')]])){utils[_0x74bd('0xb')](util[_0x74bd('0xc')](_0x74bd('0x31'),_0x2de4a7['uniqueid']),_0x2de4a7);utils[_0x74bd('0xe')](util[_0x74bd('0xc')](_0x74bd('0x32'),_0x2de4a7[_0x74bd('0x3')],_0x2de4a7[_0x74bd('0x33')],_0x2de4a7[_0x74bd('0x34')]));if(_0x2de4a7[_0x74bd('0x33')]['toLowerCase']()=='set'&&_[_0x74bd('0x35')](_0x2de4a7[_0x74bd('0x34')][_0x74bd('0x36')](),'cdr')){var _0x27b942=_0x2de4a7['appdata']['split']('=');var _0x5d7c55=_0x27b942[0x0][_0x74bd('0x37')](_0x27b942[0x0][_0x74bd('0x38')]('(')+0x1,_0x27b942[0x0][_0x74bd('0x38')](')'));var _0x5718f4=_0x27b942[0x1];recordings[_0x2de4a7[_0x74bd('0x3')]][_0x5d7c55]=_0x5718f4;}}}catch(_0x372779){utils[_0x74bd('0x12')](util['format'](_0x74bd('0x31'),_0x2de4a7[_0x74bd('0x3')]),_0x372779);}};exports[_0x74bd('0x39')]=function(_0x362af4){try{if(!_[_0x74bd('0x17')](recordings[_0x362af4[_0x74bd('0x3')]])){utils[_0x74bd('0xb')](util[_0x74bd('0xc')]('[%s][recordings][queuecallerjoin]',_0x362af4[_0x74bd('0x3')]),_0x362af4);utils[_0x74bd('0xe')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x362af4[_0x74bd('0x3')],_0x362af4[_0x74bd('0x3a')]));recordings[_0x362af4[_0x74bd('0x3')]]['queue']=_0x362af4[_0x74bd('0x3a')];}}catch(_0xfbd9b3){utils[_0x74bd('0x12')](util[_0x74bd('0xc')](_0x74bd('0x3b'),_0x362af4[_0x74bd('0x3')]),_0xfbd9b3);}};
\ No newline at end of file
+var _0x0809=['transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','util','./utils','info','uniqueid','accountcode','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s'];(function(_0x6b6fd9,_0x2d3157){var _0x575b9e=function(_0x270624){while(--_0x270624){_0x6b6fd9['push'](_0x6b6fd9['shift']());}};_0x575b9e(++_0x2d3157);}(_0x0809,0x1a8));var _0x9080=function(_0x18929a,_0x1409a2){_0x18929a=_0x18929a-0x0;var _0x16f4db=_0x0809[_0x18929a];return _0x16f4db;};'use strict';var _=require('lodash');var util=require(_0x9080('0x0'));var utils=require(_0x9080('0x1'));var recordings={};function writeDB(_0x590aae){utils[_0x9080('0x2')](util['format']('[%s][recordings][writeDB]',_0x590aae[_0x9080('0x3')]));if(_0x590aae[_0x9080('0x4')]){utils['getUserByInternal'](_0x590aae[_0x9080('0x4')])[_0x9080('0x5')](function(_0x163bbb){if(_0x163bbb){_0x590aae['membername']=_0x163bbb[_0x9080('0x6')];_0x590aae[_0x9080('0x7')]=_0x163bbb['id'];}utils[_0x9080('0x8')](_0x9080('0x9'),_0x590aae);});}else{utils[_0x9080('0x8')](_0x9080('0x9'),_0x590aae);}}exports[_0x9080('0xa')]=function(_0x2add84){try{utils[_0x9080('0xb')](util[_0x9080('0xc')](_0x9080('0xd'),_0x2add84['uniqueid']),_0x2add84);if(_0x2add84[_0x9080('0x3')]==_0x2add84[_0x9080('0xe')]){utils[_0x9080('0x2')](util[_0x9080('0xc')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2add84[_0x9080('0x3')],_0x2add84[_0x9080('0xf')],_0x2add84[_0x9080('0x10')]));recordings[_0x2add84[_0x9080('0x3')]]={'uniqueid':_0x2add84[_0x9080('0x3')],'accountcode':_0x2add84[_0x9080('0x4')],'exten':_0x2add84['exten'],'context':_0x2add84[_0x9080('0xf')],'channel':_0x2add84[_0x9080('0x11')],'monitors':[]};}}catch(_0x4b1ec4){utils[_0x9080('0x12')](util[_0x9080('0xc')](_0x9080('0xd'),_0x2add84[_0x9080('0x3')]),_0x4b1ec4);}};exports[_0x9080('0x13')]=function(_0x40d1f3){try{utils[_0x9080('0xb')](util[_0x9080('0xc')](_0x9080('0x14'),_0x40d1f3['uniqueid']),_0x40d1f3);if(!_[_0x9080('0x15')](recordings[_0x40d1f3[_0x9080('0x3')]])&&_0x40d1f3[_0x9080('0x16')]==0x6){utils['info'](util[_0x9080('0xc')](_0x9080('0x17'),_0x40d1f3[_0x9080('0x3')],_0x40d1f3[_0x9080('0xf')],_0x40d1f3[_0x9080('0x11')]));}else if(!_[_0x9080('0x15')](recordings[_0x40d1f3['linkedid']])&&_0x40d1f3['channelstate']==0x6&&_0x40d1f3[_0x9080('0xf')]!=_0x9080('0x18')){utils[_0x9080('0x2')](util[_0x9080('0xc')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x40d1f3[_0x9080('0x3')],_0x40d1f3[_0x9080('0xe')],_0x40d1f3['context'],_0x40d1f3[_0x9080('0x11')]));recordings[_0x40d1f3[_0x9080('0xe')]][_0x9080('0x4')]=_0x40d1f3[_0x9080('0x4')];}}catch(_0x3721e6){utils[_0x9080('0x12')](util[_0x9080('0xc')](_0x9080('0x14'),_0x40d1f3[_0x9080('0x3')]),_0x3721e6);}};exports[_0x9080('0x19')]=function(_0x21875c){try{if(!_['isNil'](_0x21875c['variable'])&&!_[_0x9080('0x15')](_0x21875c[_0x9080('0x1a')][_0x9080('0x1b')])){utils[_0x9080('0xb')](util[_0x9080('0xc')](_0x9080('0x1c'),_0x21875c[_0x9080('0x3')]),_0x21875c);utils[_0x9080('0x2')](util[_0x9080('0xc')](_0x9080('0x1d'),_0x21875c[_0x9080('0x3')],_0x21875c[_0x9080('0x1a')],_0x21875c['value']));if(_[_0x9080('0x1e')](_0x21875c[_0x9080('0x1f')],_0x9080('0x20'))){_0x21875c[_0x9080('0x1f')]=_0x21875c[_0x9080('0x1f')]['replace'](_0x9080('0x20'),_0x9080('0x21'));}if(recordings[_0x21875c[_0x9080('0xe')]]){var _0x2dcf62=_[_0x9080('0x22')](recordings[_0x21875c[_0x9080('0xe')]][_0x9080('0x23')],{'value':_0x21875c[_0x9080('0x1f')]});if(_[_0x9080('0x15')](_0x2dcf62)){recordings[_0x21875c[_0x9080('0xe')]][_0x9080('0x23')][_0x9080('0x24')]({'value':_0x21875c['value']});}}}}catch(_0x439f1a){utils[_0x9080('0x12')](util[_0x9080('0xc')](_0x9080('0x1c'),_0x21875c[_0x9080('0x3')]),_0x439f1a);}};exports['hangup']=function(_0x2ad2e8){try{if(!_['isNil'](recordings[_0x2ad2e8['uniqueid']])){utils[_0x9080('0xb')](util[_0x9080('0xc')](_0x9080('0x25'),_0x2ad2e8[_0x9080('0x3')]),_0x2ad2e8);utils[_0x9080('0x2')](util[_0x9080('0xc')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x2ad2e8['uniqueid'],_0x2ad2e8[_0x9080('0x26')],_0x2ad2e8[_0x9080('0x27')],_0x2ad2e8[_0x9080('0x28')]));recordings[_0x2ad2e8[_0x9080('0x3')]][_0x9080('0x26')]=_0x2ad2e8['calleridnum'];recordings[_0x2ad2e8['uniqueid']]['calleridname']=_0x2ad2e8[_0x9080('0x27')];recordings[_0x2ad2e8[_0x9080('0x3')]][_0x9080('0x29')]=_0x2ad2e8[_0x9080('0x29')];recordings[_0x2ad2e8['uniqueid']][_0x9080('0x2a')]=_0x2ad2e8[_0x9080('0x2a')];if(recordings[_0x2ad2e8[_0x9080('0x3')]]['type']==_0x9080('0x2b')&&recordings[_0x2ad2e8['uniqueid']][_0x9080('0x4')]){recordings[_0x2ad2e8[_0x9080('0x3')]][_0x9080('0x29')]=recordings[_0x2ad2e8[_0x9080('0x3')]][_0x9080('0x4')];recordings[_0x2ad2e8[_0x9080('0x3')]][_0x9080('0x2a')]='';}recordings[_0x2ad2e8[_0x9080('0x3')]][_0x9080('0x23')][_0x9080('0x2c')](function(_0x675298){var _0x559ff0=_[_0x9080('0x2d')](recordings[_0x2ad2e8[_0x9080('0x3')]]);_0x559ff0[_0x9080('0x1f')]=_0x675298[_0x9080('0x1f')];writeDB(_0x559ff0);});delete recordings[_0x2ad2e8[_0x9080('0x3')]];}}catch(_0x5823ad){utils['error'](util[_0x9080('0xc')](_0x9080('0x25'),_0x2ad2e8[_0x9080('0x3')]),_0x5823ad);}};exports[_0x9080('0x2e')]=function(_0x59461e){try{if(!_[_0x9080('0x15')](recordings[_0x59461e[_0x9080('0x3')]])){utils[_0x9080('0xb')](util[_0x9080('0xc')](_0x9080('0x2f'),_0x59461e[_0x9080('0x3')]),_0x59461e);utils[_0x9080('0x2')](util[_0x9080('0xc')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x59461e[_0x9080('0x3')],_0x59461e['application'],_0x59461e[_0x9080('0x30')]));if(_0x59461e['application']['toLowerCase']()=='set'&&_['startsWith'](_0x59461e[_0x9080('0x30')]['toLowerCase'](),_0x9080('0x31'))){var _0x2a303b=_0x59461e[_0x9080('0x30')][_0x9080('0x32')]('=');var _0x4663a2=_0x2a303b[0x0][_0x9080('0x33')](_0x2a303b[0x0][_0x9080('0x34')]('(')+0x1,_0x2a303b[0x0]['lastIndexOf'](')'));var _0x381bd2=_0x2a303b[0x1];recordings[_0x59461e[_0x9080('0x3')]][_0x4663a2]=_0x381bd2;}}}catch(_0x3e7013){utils[_0x9080('0x12')](util['format'](_0x9080('0x2f'),_0x59461e[_0x9080('0x3')]),_0x3e7013);}};exports[_0x9080('0x35')]=function(_0x293251){try{if(!_[_0x9080('0x15')](recordings[_0x293251['uniqueid']])){utils['debug'](util[_0x9080('0xc')]('[%s][recordings][queuecallerjoin]',_0x293251['uniqueid']),_0x293251);utils['info'](util[_0x9080('0xc')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x293251[_0x9080('0x3')],_0x293251[_0x9080('0x36')]));recordings[_0x293251[_0x9080('0x3')]]['queue']=_0x293251[_0x9080('0x36')];}}catch(_0x4dec32){utils[_0x9080('0x12')](util['format'](_0x9080('0x37'),_0x293251[_0x9080('0x3')]),_0x4dec32);}};
\ No newline at end of file