Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.model.js
index ef16ddb..8008ca9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdfcc=['name','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','length','lodash','util','bluebird','format','%s%s','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','password','ChanSpy','SIP/%s,%s','options','concat','internal'];(function(_0x3b52bf,_0xe47312){var _0x253982=function(_0x13feb2){while(--_0x13feb2){_0x3b52bf['push'](_0x3b52bf['shift']());}};_0x253982(++_0xe47312);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0xdfcc[_0x1646fa];return _0x5a47a5;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var BPromise=require(_0xcdfc('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x133c72,_0x851248,_0x54bd16){var _0x4aef49=0x1;var _0x468275=[];var _0x4e9e63={'context':_0x851248['context']||'from-sip','exten':util[_0xcdfc('0x3')](_0xcdfc('0x4'),_0x133c72['prefix'],_0x54bd16),'type':_0xcdfc('0x5'),'isApp':![],'ChanSpyId':_0x133c72['id'],'UserId':_0x851248['id']};_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':_0xcdfc('0x8'),'appdata':util['format'](_0xcdfc('0x9'),'chanspy'),'priority':_0x4aef49++},_0x4e9e63));if(_0x133c72[_0xcdfc('0xa')]){_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':_0xcdfc('0xb'),'appdata':util[_0xcdfc('0x3')](_0xcdfc('0xc'),_0x133c72['recordingFormat']),'priority':_0x4aef49++},_0x4e9e63));}if(_0x133c72['auth']){_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':'Authenticate','appdata':_0x133c72[_0xcdfc('0xd')],'priority':_0x4aef49++},_0x4e9e63));}_0x468275[_0xcdfc('0x6')](_['merge']({'app':_0xcdfc('0xe'),'appdata':util[_0xcdfc('0x3')](_0xcdfc('0xf'),_0x851248['name'],_0x133c72[_0xcdfc('0x10')]?_0x133c72[_0xcdfc('0x10')]['join'](''):''),'priority':_0x4aef49++},_0x4e9e63));if(_0x133c72[_0xcdfc('0xa')]){_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':'StopMixMonitor','priority':_0x4aef49++},_0x4e9e63));}return _0x468275;};var getChanSpyApplications=function(_0x3834aa,_0x1a8095){var _0x48f497=[];for(var _0x375ae5=0x0,_0x19f868=0x1;_0x375ae5<_0x1a8095['length'];_0x375ae5++,_0x19f868=0x1){_0x48f497=_0x48f497[_0xcdfc('0x11')](getUserApplications(_0x3834aa,_0x1a8095[_0x375ae5],_0x1a8095[_0x375ae5][_0xcdfc('0x12')]));if(_0x1a8095[_0x375ae5][_0xcdfc('0x12')]!=_0x1a8095[_0x375ae5]['name']){_0x48f497=_0x48f497[_0xcdfc('0x11')](getUserApplications(_0x3834aa,_0x1a8095[_0x375ae5],_0x1a8095[_0x375ae5][_0xcdfc('0x13')]));}}return _0x48f497;};var getChanSpyPromise=function(_0x5ad601,_0x3e1707){return new BPromise(function(_0x7e62d0,_0x1efa4e){return _0x5ad601[_0xcdfc('0x14')][_0xcdfc('0x15')]({'attributes':['id',_0xcdfc('0x13'),'internal'],'where':{'role':_0xcdfc('0x16'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2124cf){if(_0x2124cf){return _0x7e62d0(getChanSpyApplications(_0x3e1707,_0x2124cf));}return _0x7e62d0([]);})[_0xcdfc('0x17')](function(_0x2b7868){_0x1efa4e(_0x2b7868);});});};module[_0xcdfc('0x18')]=function(_0x4e58ce,_0x183ada){var _0x1949df=_0x4e58ce[_0xcdfc('0x19')];return _0x4e58ce[_0xcdfc('0x1a')](_0xcdfc('0x1b'),attributes,{'tableName':_0xcdfc('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x101ba0,_0x3bdd7f,_0xf31d8a){return getChanSpyPromise(_0x1949df,_0x101ba0)[_0xcdfc('0x1d')](function(_0x44ab0b){if(_0x44ab0b&&_0x44ab0b['length']){return _0x1949df[_0xcdfc('0x1e')]['bulkCreate'](_0x44ab0b);}})[_0xcdfc('0x1d')](function(){_0xf31d8a();})[_0xcdfc('0x17')](function(_0x762f0e){_0xf31d8a(_0x762f0e);});},'afterUpdate':function(_0x28d4bc,_0x1de322,_0x180198){return _0x1949df[_0xcdfc('0x1e')]['destroy']({'where':{'ChanSpyId':_0x28d4bc['id']}})['then'](function(){return getChanSpyPromise(_0x1949df,_0x28d4bc);})[_0xcdfc('0x1d')](function(_0x260843){if(_0x260843&&_0x260843[_0xcdfc('0x1f')]){return _0x1949df[_0xcdfc('0x1e')]['bulkCreate'](_0x260843);}})[_0xcdfc('0x1d')](function(){_0x180198();})[_0xcdfc('0x17')](function(_0x5561bd){_0x180198(_0x5561bd);});},'afterDestroy':function(_0x5b19e2,_0x29cc4e,_0x3854cf){return _0x1949df[_0xcdfc('0x1e')]['destroy']({'where':{'ChanSpyId':_0x5b19e2['id']}})[_0xcdfc('0x1d')](function(){_0x3854cf();})[_0xcdfc('0x17')](function(_0x40008e){_0x3854cf(_0x40008e);});}}});};
\ No newline at end of file
+var _0x10a5=['from-sip','format','%s%s','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','StopMixMonitor','concat','internal','User','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x10a5,0x163));var _0x510a=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0x10a5[_0x37e845];return _0x59e55b;};'use strict';var _=require(_0x510a('0x0'));var util=require(_0x510a('0x1'));var BPromise=require(_0x510a('0x2'));var attributes=require(_0x510a('0x3'));var getUserApplications=function(_0x15a46b,_0x3dce5a,_0x68c824){var _0x29c239=0x1;var _0xc8089=[];var _0x5f6539={'context':_0x3dce5a[_0x510a('0x4')]||_0x510a('0x5'),'exten':util[_0x510a('0x6')](_0x510a('0x7'),_0x15a46b['prefix'],_0x68c824),'type':'system','isApp':![],'ChanSpyId':_0x15a46b['id'],'UserId':_0x3dce5a['id']};_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0xa'),'appdata':util[_0x510a('0x6')](_0x510a('0xb'),_0x510a('0xc')),'priority':_0x29c239++},_0x5f6539));if(_0x15a46b[_0x510a('0xd')]){_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':'MixMonitor','appdata':util[_0x510a('0x6')](_0x510a('0xe'),_0x15a46b['recordingFormat']),'priority':_0x29c239++},_0x5f6539));}if(_0x15a46b[_0x510a('0xf')]){_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0x10'),'appdata':_0x15a46b[_0x510a('0x11')],'priority':_0x29c239++},_0x5f6539));}_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0x12'),'appdata':util['format'](_0x510a('0x13'),_0x3dce5a[_0x510a('0x14')],_0x15a46b['options']?_0x15a46b['options']['join'](''):''),'priority':_0x29c239++},_0x5f6539));if(_0x15a46b[_0x510a('0xd')]){_0xc8089[_0x510a('0x8')](_[_0x510a('0x9')]({'app':_0x510a('0x15'),'priority':_0x29c239++},_0x5f6539));}return _0xc8089;};var getChanSpyApplications=function(_0x15fd06,_0x2d15af){var _0x5a079c=[];for(var _0x19f5c4=0x0,_0x11e0dc=0x1;_0x19f5c4<_0x2d15af['length'];_0x19f5c4++,_0x11e0dc=0x1){_0x5a079c=_0x5a079c[_0x510a('0x16')](getUserApplications(_0x15fd06,_0x2d15af[_0x19f5c4],_0x2d15af[_0x19f5c4][_0x510a('0x17')]));if(_0x2d15af[_0x19f5c4][_0x510a('0x17')]!=_0x2d15af[_0x19f5c4]['name']){_0x5a079c=_0x5a079c[_0x510a('0x16')](getUserApplications(_0x15fd06,_0x2d15af[_0x19f5c4],_0x2d15af[_0x19f5c4]['name']));}}return _0x5a079c;};var getChanSpyPromise=function(_0x167721,_0x1d78c1){return new BPromise(function(_0x3e64d4,_0x22ff84){return _0x167721[_0x510a('0x18')]['findAll']({'attributes':['id',_0x510a('0x14'),_0x510a('0x17')],'where':{'role':_0x510a('0x19'),'chanspy':!![]},'raw':!![]})[_0x510a('0x1a')](function(_0x157127){if(_0x157127){return _0x3e64d4(getChanSpyApplications(_0x1d78c1,_0x157127));}return _0x3e64d4([]);})[_0x510a('0x1b')](function(_0x5b24fb){_0x22ff84(_0x5b24fb);});});};module[_0x510a('0x1c')]=function(_0x4ee01f,_0xc23844){var _0x3cec5b=_0x4ee01f[_0x510a('0x1d')];return _0x4ee01f['define'](_0x510a('0x1e'),attributes,{'tableName':_0x510a('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e923e,_0xab5f53,_0x54cc9c){return getChanSpyPromise(_0x3cec5b,_0x5e923e)[_0x510a('0x1a')](function(_0x26bcf1){if(_0x26bcf1&&_0x26bcf1[_0x510a('0x20')]){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x22')](_0x26bcf1);}})[_0x510a('0x1a')](function(){_0x54cc9c();})[_0x510a('0x1b')](function(_0x197da9){_0x54cc9c(_0x197da9);});},'afterUpdate':function(_0xf08430,_0x26b4f8,_0x24fc29){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x23')]({'where':{'ChanSpyId':_0xf08430['id']}})[_0x510a('0x1a')](function(){return getChanSpyPromise(_0x3cec5b,_0xf08430);})[_0x510a('0x1a')](function(_0x1b7e4b){if(_0x1b7e4b&&_0x1b7e4b[_0x510a('0x20')]){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x22')](_0x1b7e4b);}})[_0x510a('0x1a')](function(){_0x24fc29();})[_0x510a('0x1b')](function(_0x57f0a6){_0x24fc29(_0x57f0a6);});},'afterDestroy':function(_0x340fef,_0x2a4bd2,_0x48f9eb){return _0x3cec5b[_0x510a('0x21')][_0x510a('0x23')]({'where':{'ChanSpyId':_0x340fef['id']}})['then'](function(){_0x48f9eb();})[_0x510a('0x1b')](function(_0x2cbac5){_0x48f9eb(_0x2cbac5);});}}});};
\ No newline at end of file