Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / services / xdr / recordings.controller.js
index 9ffb3a7..7a6c4af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabf9=['[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','monitors','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','lodash','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','getUserByInternal','accountcode','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','channelstate','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xabf9,0xf3));var _0x9abf=function(_0x39d4b1,_0x134bd6){_0x39d4b1=_0x39d4b1-0x0;var _0x1eab3d=_0xabf9[_0x39d4b1];return _0x1eab3d;};'use strict';var _=require(_0x9abf('0x0'));var util=require(_0x9abf('0x1'));var utils=require('./utils');var transfers=require(_0x9abf('0x2'));var recordings={};function writeDB(_0x322829){var _0x454cb2;utils[_0x9abf('0x3')](util[_0x9abf('0x4')](_0x9abf('0x5'),_0x322829[_0x9abf('0x6')]));if(transfers[_0x9abf('0x7')][_0x322829[_0x9abf('0x6')]]){_0x454cb2=_0x322829['uniqueid'];_0x322829[_0x9abf('0x6')]=transfers[_0x9abf('0x7')][_0x322829[_0x9abf('0x6')]]['transfereeuniqueid'];}if(_0x322829['accountcode']){utils[_0x9abf('0x8')](_0x322829[_0x9abf('0x9')])[_0x9abf('0xa')](function(_0x440909){if(_0x440909){_0x322829[_0x9abf('0xb')]=_0x440909[_0x9abf('0xc')];_0x322829[_0x9abf('0xd')]=_0x440909['id'];}utils['request'](_0x9abf('0xe'),_0x322829);});}else{utils[_0x9abf('0xf')]('CreateVoiceRecording',_0x322829);}if(_0x454cb2)delete transfers['blinds'][_0x454cb2];}exports[_0x9abf('0x10')]=function(_0x58e44f){try{utils[_0x9abf('0x11')](util['format'](_0x9abf('0x12'),_0x58e44f[_0x9abf('0x6')]),_0x58e44f);if(_0x58e44f[_0x9abf('0x6')]==_0x58e44f[_0x9abf('0x13')]){utils[_0x9abf('0x3')](util[_0x9abf('0x4')](_0x9abf('0x14'),_0x58e44f['uniqueid'],_0x58e44f[_0x9abf('0x15')],_0x58e44f[_0x9abf('0x16')]));recordings[_0x58e44f[_0x9abf('0x6')]]={'uniqueid':_0x58e44f['uniqueid'],'accountcode':_0x58e44f[_0x9abf('0x9')],'exten':_0x58e44f[_0x9abf('0x16')],'context':_0x58e44f[_0x9abf('0x15')],'channel':_0x58e44f[_0x9abf('0x17')],'monitors':[]};}}catch(_0x5b9dab){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x12'),_0x58e44f[_0x9abf('0x6')]),_0x5b9dab);}};exports['newstate']=function(_0x5a9463){try{utils['debug'](util[_0x9abf('0x4')](_0x9abf('0x19'),_0x5a9463[_0x9abf('0x6')]),_0x5a9463);if(!_[_0x9abf('0x1a')](recordings[_0x5a9463[_0x9abf('0x6')]])&&_0x5a9463[_0x9abf('0x1b')]==0x6){utils['info'](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x5a9463['uniqueid'],_0x5a9463[_0x9abf('0x15')],_0x5a9463[_0x9abf('0x17')]));}else if(!_[_0x9abf('0x1a')](recordings[_0x5a9463[_0x9abf('0x13')]])&&_0x5a9463['channelstate']==0x6&&_0x5a9463[_0x9abf('0x15')]!=_0x9abf('0x1c')){utils[_0x9abf('0x3')](util[_0x9abf('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5a9463[_0x9abf('0x6')],_0x5a9463['linkedid'],_0x5a9463[_0x9abf('0x15')],_0x5a9463[_0x9abf('0x17')]));recordings[_0x5a9463['linkedid']]['accountcode']=_0x5a9463[_0x9abf('0x9')];}}catch(_0x37b3a1){utils['error'](util[_0x9abf('0x4')]('[%s][recordings][newstate]',_0x5a9463[_0x9abf('0x6')]),_0x37b3a1);}};exports[_0x9abf('0x1d')]=function(_0x5a76a7){try{if(!_[_0x9abf('0x1a')](_0x5a76a7[_0x9abf('0x1e')])&&!_['isNil'](_0x5a76a7[_0x9abf('0x1e')][_0x9abf('0x1f')])){utils[_0x9abf('0x11')](util['format'](_0x9abf('0x20'),_0x5a76a7[_0x9abf('0x6')]),_0x5a76a7);utils[_0x9abf('0x3')](util[_0x9abf('0x4')](_0x9abf('0x21'),_0x5a76a7[_0x9abf('0x6')],_0x5a76a7['variable'],_0x5a76a7[_0x9abf('0x22')]));if(_[_0x9abf('0x23')](_0x5a76a7['value'],'.wav49')){_0x5a76a7[_0x9abf('0x22')]=_0x5a76a7[_0x9abf('0x22')][_0x9abf('0x24')](_0x9abf('0x25'),_0x9abf('0x26'));}if(recordings[_0x5a76a7['linkedid']]){var _0x47e3d1=_['find'](recordings[_0x5a76a7[_0x9abf('0x13')]][_0x9abf('0x27')],{'value':_0x5a76a7[_0x9abf('0x22')]});if(_[_0x9abf('0x1a')](_0x47e3d1)){recordings[_0x5a76a7[_0x9abf('0x13')]]['monitors']['push']({'value':_0x5a76a7[_0x9abf('0x22')]});}}}}catch(_0x352e67){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x20'),_0x5a76a7['uniqueid']),_0x352e67);}};exports[_0x9abf('0x28')]=function(_0x513a78){try{if(!_[_0x9abf('0x1a')](recordings[_0x513a78[_0x9abf('0x6')]])){utils[_0x9abf('0x11')](util['format']('[%s][recordings][hangup]',_0x513a78['uniqueid']),_0x513a78);utils[_0x9abf('0x3')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x513a78[_0x9abf('0x6')],_0x513a78[_0x9abf('0x29')],_0x513a78[_0x9abf('0x2a')],_0x513a78['cause-txt']));recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x29')]=_0x513a78['calleridnum'];recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x2a')]=_0x513a78[_0x9abf('0x2a')];recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x2b')]=_0x513a78[_0x9abf('0x2b')];recordings[_0x513a78[_0x9abf('0x6')]]['connectedlinename']=_0x513a78[_0x9abf('0x2c')];if(recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x2d')]==_0x9abf('0x2e')&&recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x9')]){recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x2b')]=recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x9')];recordings[_0x513a78['uniqueid']][_0x9abf('0x2c')]='';}recordings[_0x513a78[_0x9abf('0x6')]][_0x9abf('0x27')][_0x9abf('0x2f')](function(_0x385119){var _0x23fd49=_['clone'](recordings[_0x513a78[_0x9abf('0x6')]]);_0x23fd49['value']=_0x385119[_0x9abf('0x22')];writeDB(_0x23fd49);});delete recordings[_0x513a78[_0x9abf('0x6')]];}}catch(_0x42df8a){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x30'),_0x513a78[_0x9abf('0x6')]),_0x42df8a);}};exports['newexten']=function(_0x4c7496){try{if(!_[_0x9abf('0x1a')](recordings[_0x4c7496['uniqueid']])){utils[_0x9abf('0x11')](util['format'](_0x9abf('0x31'),_0x4c7496[_0x9abf('0x6')]),_0x4c7496);utils[_0x9abf('0x3')](util[_0x9abf('0x4')](_0x9abf('0x32'),_0x4c7496['uniqueid'],_0x4c7496[_0x9abf('0x33')],_0x4c7496['appdata']));if(_0x4c7496[_0x9abf('0x33')][_0x9abf('0x34')]()=='set'&&_[_0x9abf('0x35')](_0x4c7496[_0x9abf('0x36')][_0x9abf('0x34')](),_0x9abf('0x37'))){var _0x4a6c4c=_0x4c7496[_0x9abf('0x36')][_0x9abf('0x38')]('=');var _0x40e51e=_0x4a6c4c[0x0]['substring'](_0x4a6c4c[0x0]['lastIndexOf']('(')+0x1,_0x4a6c4c[0x0][_0x9abf('0x39')](')'));var _0x107f10=_0x4a6c4c[0x1];recordings[_0x4c7496[_0x9abf('0x6')]][_0x40e51e]=_0x107f10;}}}catch(_0x5f29b8){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x31'),_0x4c7496[_0x9abf('0x6')]),_0x5f29b8);}};exports[_0x9abf('0x3a')]=function(_0x2fd028){try{if(!_[_0x9abf('0x1a')](recordings[_0x2fd028[_0x9abf('0x6')]])){utils[_0x9abf('0x11')](util[_0x9abf('0x4')](_0x9abf('0x3b'),_0x2fd028[_0x9abf('0x6')]),_0x2fd028);utils[_0x9abf('0x3')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x2fd028[_0x9abf('0x6')],_0x2fd028['queue']));recordings[_0x2fd028['uniqueid']][_0x9abf('0x3c')]=_0x2fd028[_0x9abf('0x3c')];}}catch(_0xb565f4){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x3b'),_0x2fd028[_0x9abf('0x6')]),_0xb565f4);}};exports[_0x9abf('0x3d')]=function(_0x23f685){try{utils['debug'](util[_0x9abf('0x4')](_0x9abf('0x3e'),_0x23f685[_0x9abf('0x6')]),_0x23f685);utils[_0x9abf('0x3')](util[_0x9abf('0x4')](_0x9abf('0x3f'),_0x23f685[_0x9abf('0x6')],_0x23f685[_0x9abf('0x40')],_0x23f685[_0x9abf('0x41')],_0x23f685['transfereecalleridnum'],_0x23f685[_0x9abf('0x42')]));if(recordings[_0x23f685['transfereruniqueid']]&&transfers[_0x9abf('0x7')][_0x23f685['transfereruniqueid']]){transfers[_0x9abf('0x7')][_0x23f685[_0x9abf('0x43')]][_0x9abf('0x44')]=!![];}}catch(_0x5e1b7a){utils[_0x9abf('0x18')](util[_0x9abf('0x4')](_0x9abf('0x3e'),_0x23f685[_0x9abf('0x6')]),_0x5e1b7a);}};
\ No newline at end of file
+var _0x3797=['transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','then','name','UserId','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate'];(function(_0x6f45dc,_0x379e7e){var _0x6d01d7=function(_0x59597a){while(--_0x59597a){_0x6f45dc['push'](_0x6f45dc['shift']());}};_0x6d01d7(++_0x379e7e);}(_0x3797,0x1df));var _0x7379=function(_0x485584,_0x588a02){_0x485584=_0x485584-0x0;var _0x20c9f5=_0x3797[_0x485584];return _0x20c9f5;};'use strict';var _=require(_0x7379('0x0'));var util=require(_0x7379('0x1'));var utils=require(_0x7379('0x2'));var recordings={};function writeDB(_0x2995ea){utils[_0x7379('0x3')](util[_0x7379('0x4')](_0x7379('0x5'),_0x2995ea['uniqueid']));if(_0x2995ea[_0x7379('0x6')]){utils['getUserByInternal'](_0x2995ea[_0x7379('0x6')])[_0x7379('0x7')](function(_0x3f602f){if(_0x3f602f){_0x2995ea['membername']=_0x3f602f[_0x7379('0x8')];_0x2995ea[_0x7379('0x9')]=_0x3f602f['id'];}utils['request'](_0x7379('0xa'),_0x2995ea);});}else{utils['request']('CreateVoiceRecording',_0x2995ea);}}exports[_0x7379('0xb')]=function(_0x325e43){try{utils[_0x7379('0xc')](util[_0x7379('0x4')](_0x7379('0xd'),_0x325e43[_0x7379('0xe')]),_0x325e43);if(_0x325e43[_0x7379('0xe')]==_0x325e43[_0x7379('0xf')]){utils[_0x7379('0x3')](util[_0x7379('0x4')](_0x7379('0x10'),_0x325e43[_0x7379('0xe')],_0x325e43[_0x7379('0x11')],_0x325e43[_0x7379('0x12')]));recordings[_0x325e43['uniqueid']]={'uniqueid':_0x325e43[_0x7379('0xe')],'accountcode':_0x325e43[_0x7379('0x6')],'exten':_0x325e43[_0x7379('0x12')],'context':_0x325e43['context'],'channel':_0x325e43[_0x7379('0x13')],'monitors':[]};}}catch(_0x39493e){utils[_0x7379('0x14')](util[_0x7379('0x4')](_0x7379('0xd'),_0x325e43['uniqueid']),_0x39493e);}};exports['newstate']=function(_0x364dd8){try{utils[_0x7379('0xc')](util['format'](_0x7379('0x15'),_0x364dd8[_0x7379('0xe')]),_0x364dd8);if(!_[_0x7379('0x16')](recordings[_0x364dd8['uniqueid']])&&_0x364dd8['channelstate']==0x6){utils[_0x7379('0x3')](util['format'](_0x7379('0x17'),_0x364dd8['uniqueid'],_0x364dd8[_0x7379('0x11')],_0x364dd8[_0x7379('0x13')]));}else if(!_[_0x7379('0x16')](recordings[_0x364dd8[_0x7379('0xf')]])&&_0x364dd8[_0x7379('0x18')]==0x6&&_0x364dd8['context']!=_0x7379('0x19')){utils[_0x7379('0x3')](util[_0x7379('0x4')](_0x7379('0x1a'),_0x364dd8[_0x7379('0xe')],_0x364dd8[_0x7379('0xf')],_0x364dd8[_0x7379('0x11')],_0x364dd8[_0x7379('0x13')]));recordings[_0x364dd8[_0x7379('0xf')]][_0x7379('0x6')]=_0x364dd8['accountcode'];}}catch(_0x5b828a){utils[_0x7379('0x14')](util[_0x7379('0x4')](_0x7379('0x15'),_0x364dd8[_0x7379('0xe')]),_0x5b828a);}};exports[_0x7379('0x1b')]=function(_0x23866c){try{if(!_[_0x7379('0x16')](_0x23866c[_0x7379('0x1c')])&&!_['isNil'](_0x23866c[_0x7379('0x1c')][_0x7379('0x1d')])){utils[_0x7379('0xc')](util[_0x7379('0x4')](_0x7379('0x1e'),_0x23866c[_0x7379('0xe')]),_0x23866c);utils[_0x7379('0x3')](util[_0x7379('0x4')](_0x7379('0x1f'),_0x23866c['uniqueid'],_0x23866c[_0x7379('0x1c')],_0x23866c['value']));if(_[_0x7379('0x20')](_0x23866c[_0x7379('0x21')],'.wav49')){_0x23866c[_0x7379('0x21')]=_0x23866c[_0x7379('0x21')][_0x7379('0x22')](_0x7379('0x23'),_0x7379('0x24'));}if(recordings[_0x23866c[_0x7379('0xf')]]){var _0x53c0e6=_[_0x7379('0x25')](recordings[_0x23866c[_0x7379('0xf')]][_0x7379('0x26')],{'value':_0x23866c[_0x7379('0x21')]});if(_[_0x7379('0x16')](_0x53c0e6)){recordings[_0x23866c['linkedid']][_0x7379('0x26')][_0x7379('0x27')]({'value':_0x23866c[_0x7379('0x21')]});}}}}catch(_0x5bb45a){utils[_0x7379('0x14')](util['format'](_0x7379('0x1e'),_0x23866c['uniqueid']),_0x5bb45a);}};exports[_0x7379('0x28')]=function(_0x5085be){try{if(!_[_0x7379('0x16')](recordings[_0x5085be[_0x7379('0xe')]])){utils[_0x7379('0xc')](util[_0x7379('0x4')](_0x7379('0x29'),_0x5085be[_0x7379('0xe')]),_0x5085be);utils[_0x7379('0x3')](util[_0x7379('0x4')](_0x7379('0x2a'),_0x5085be[_0x7379('0xe')],_0x5085be[_0x7379('0x2b')],_0x5085be[_0x7379('0x2c')],_0x5085be['cause-txt']));recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2b')]=_0x5085be[_0x7379('0x2b')];recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2c')]=_0x5085be['calleridname'];recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2d')]=_0x5085be[_0x7379('0x2d')];recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2e')]=_0x5085be[_0x7379('0x2e')];if(recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2f')]=='outbound'&&recordings[_0x5085be[_0x7379('0xe')]]['accountcode']){recordings[_0x5085be['uniqueid']]['connectedlinenum']=recordings[_0x5085be[_0x7379('0xe')]]['accountcode'];recordings[_0x5085be[_0x7379('0xe')]][_0x7379('0x2e')]='';}recordings[_0x5085be['uniqueid']][_0x7379('0x26')][_0x7379('0x30')](function(_0x4ac468){var _0x25a83d=_[_0x7379('0x31')](recordings[_0x5085be[_0x7379('0xe')]]);_0x25a83d['value']=_0x4ac468[_0x7379('0x21')];writeDB(_0x25a83d);});delete recordings[_0x5085be['uniqueid']];}}catch(_0x555120){utils[_0x7379('0x14')](util[_0x7379('0x4')]('[%s][recordings][hangup]',_0x5085be[_0x7379('0xe')]),_0x555120);}};exports[_0x7379('0x32')]=function(_0x269544){try{if(!_[_0x7379('0x16')](recordings[_0x269544[_0x7379('0xe')]])){utils[_0x7379('0xc')](util[_0x7379('0x4')](_0x7379('0x33'),_0x269544[_0x7379('0xe')]),_0x269544);utils['info'](util[_0x7379('0x4')](_0x7379('0x34'),_0x269544[_0x7379('0xe')],_0x269544['application'],_0x269544['appdata']));if(_0x269544[_0x7379('0x35')][_0x7379('0x36')]()=='set'&&_[_0x7379('0x37')](_0x269544[_0x7379('0x38')][_0x7379('0x36')](),_0x7379('0x39'))){var _0x40f4bc=_0x269544['appdata'][_0x7379('0x3a')]('=');var _0x455eb9=_0x40f4bc[0x0]['substring'](_0x40f4bc[0x0][_0x7379('0x3b')]('(')+0x1,_0x40f4bc[0x0]['lastIndexOf'](')'));var _0x4f1eaf=_0x40f4bc[0x1];recordings[_0x269544['uniqueid']][_0x455eb9]=_0x4f1eaf;}}}catch(_0x405036){utils[_0x7379('0x14')](util['format'](_0x7379('0x33'),_0x269544[_0x7379('0xe')]),_0x405036);}};exports['queuecallerjoin']=function(_0x49058a){try{if(!_[_0x7379('0x16')](recordings[_0x49058a[_0x7379('0xe')]])){utils['debug'](util['format'](_0x7379('0x3c'),_0x49058a['uniqueid']),_0x49058a);utils[_0x7379('0x3')](util['format'](_0x7379('0x3d'),_0x49058a[_0x7379('0xe')],_0x49058a['queue']));recordings[_0x49058a['uniqueid']]['queue']=_0x49058a[_0x7379('0x3e')];}}catch(_0x360fb4){utils['error'](util[_0x7379('0x4')](_0x7379('0x3c'),_0x49058a['uniqueid']),_0x360fb4);}};
\ No newline at end of file