Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / services / xdr / recordings.controller.js
index db9a1e4..53f6bed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb91=['uniqueid','channelstate','transfer','error','varset','variable','mixmonitor_filename','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode','getUserByInternal','then','name','UserId','CreateVoiceRecording','request','newchannel','linkedid','exten','context','channel','stack','newstate','isNil'];(function(_0x402c3a,_0x18423f){var _0x9a9842=function(_0x1bfbcf){while(--_0x1bfbcf){_0x402c3a['push'](_0x402c3a['shift']());}};_0x9a9842(++_0x18423f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xcb91[_0x337748];return _0x3bb03f;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x26fe42){utils[_0x1cb9('0x0')](_0x26fe42);if(_0x26fe42[_0x1cb9('0x1')]){utils[_0x1cb9('0x2')](_0x26fe42['accountcode'])[_0x1cb9('0x3')](function(_0x2c17b8){if(_0x2c17b8){_0x26fe42['membername']=_0x2c17b8[_0x1cb9('0x4')];_0x26fe42[_0x1cb9('0x5')]=_0x2c17b8['id'];}utils['request'](_0x1cb9('0x6'),_0x26fe42);});}else{utils[_0x1cb9('0x7')]('CreateVoiceRecording',_0x26fe42);}}exports[_0x1cb9('0x8')]=function(_0x12567c){try{if(_0x12567c['uniqueid']==_0x12567c[_0x1cb9('0x9')]){recordings[_0x12567c['uniqueid']]={'uniqueid':_0x12567c['uniqueid'],'accountcode':_0x12567c[_0x1cb9('0x1')],'exten':_0x12567c[_0x1cb9('0xa')],'context':_0x12567c[_0x1cb9('0xb')],'channel':_0x12567c[_0x1cb9('0xc')],'monitors':[]};}}catch(_0x2fc627){utils['error'](_0x2fc627[_0x1cb9('0xd')]);}};exports[_0x1cb9('0xe')]=function(_0x3af35f){try{if(!_[_0x1cb9('0xf')](recordings[_0x3af35f[_0x1cb9('0x10')]])&&_0x3af35f['channelstate']==0x6){}else if(!_['isNil'](recordings[_0x3af35f['linkedid']])&&_0x3af35f[_0x1cb9('0x11')]==0x6&&_0x3af35f[_0x1cb9('0xb')]!=_0x1cb9('0x12')){recordings[_0x3af35f[_0x1cb9('0x9')]]['accountcode']=_0x3af35f[_0x1cb9('0x1')];}}catch(_0x6ef389){utils[_0x1cb9('0x13')](_0x6ef389[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x14')]=function(_0x5806d8){try{if(!_['isNil'](_0x5806d8[_0x1cb9('0x15')])&&!_[_0x1cb9('0xf')](_0x5806d8[_0x1cb9('0x15')][_0x1cb9('0x16')])){if(_[_0x1cb9('0x17')](_0x5806d8[_0x1cb9('0x18')],_0x1cb9('0x19'))){_0x5806d8['value']=_0x5806d8['value'][_0x1cb9('0x1a')](_0x1cb9('0x19'),_0x1cb9('0x1b'));}if(recordings[_0x5806d8[_0x1cb9('0x9')]]){var _0x280a84=_[_0x1cb9('0x1c')](recordings[_0x5806d8[_0x1cb9('0x9')]]['monitors'],{'value':_0x5806d8['value']});if(_[_0x1cb9('0xf')](_0x280a84)){recordings[_0x5806d8['linkedid']][_0x1cb9('0x1d')][_0x1cb9('0x1e')]({'value':_0x5806d8['value']});}}}}catch(_0x599275){utils[_0x1cb9('0x13')](_0x599275[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x1f')]=function(_0x4601b8){try{if(!_[_0x1cb9('0xf')](recordings[_0x4601b8[_0x1cb9('0x10')]])){recordings[_0x4601b8['uniqueid']]['calleridnum']=_0x4601b8[_0x1cb9('0x20')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x21')]=_0x4601b8[_0x1cb9('0x21')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=_0x4601b8[_0x1cb9('0x22')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x23')]=_0x4601b8[_0x1cb9('0x23')];if(recordings[_0x4601b8['uniqueid']][_0x1cb9('0x24')]==_0x1cb9('0x25')&&recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')]){recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x23')]='';}recordings[_0x4601b8['uniqueid']][_0x1cb9('0x1d')]['forEach'](_0x110282=>{var _0x4efebc=_[_0x1cb9('0x26')](recordings[_0x4601b8[_0x1cb9('0x10')]]);_0x4efebc[_0x1cb9('0x18')]=_0x110282[_0x1cb9('0x18')];writeDB(_0x4efebc);});delete recordings[_0x4601b8['uniqueid']];}}catch(_0x1c701f){utils['error'](_0x1c701f[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x27')]=function(_0x4220d7){try{if(!_['isNil'](recordings[_0x4220d7[_0x1cb9('0x10')]])){if(_0x4220d7['application'][_0x1cb9('0x28')]()=='set'&&_[_0x1cb9('0x29')](_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x28')](),_0x1cb9('0x2b'))){var _0x56c3e0=_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x2c')]('=');var _0x3467d5=_0x56c3e0[0x0][_0x1cb9('0x2d')](_0x56c3e0[0x0][_0x1cb9('0x2e')]('(')+0x1,_0x56c3e0[0x0][_0x1cb9('0x2e')](')'));var _0xc6d5fd=_0x56c3e0[0x1];recordings[_0x4220d7[_0x1cb9('0x10')]][_0x3467d5]=_0xc6d5fd;}}}catch(_0x386e8b){utils[_0x1cb9('0x13')](_0x386e8b[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x2f')]=function(_0x29f149){try{if(!_['isNil'](recordings[_0x29f149['uniqueid']])){recordings[_0x29f149[_0x1cb9('0x10')]][_0x1cb9('0x30')]=_0x29f149[_0x1cb9('0x30')];}}catch(_0x29f451){utils[_0x1cb9('0x13')](_0x29f451[_0x1cb9('0xd')]);}};
\ 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