Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.model.js
index 4f4bdc2..2e66716 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x153f=['VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x153f,0x15b));var _0xf153=function(_0x57e88c,_0x204c7b){_0x57e88c=_0x57e88c-0x0;var _0x571059=_0x153f[_0x57e88c];return _0x571059;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var BPromise=require(_0xf153('0x2'));var attributes=require(_0xf153('0x3'));var getUserApplications=function(_0x2afb9a,_0x1ccc1c,_0x3b85fc){var _0x59757c=0x1;var _0x364e65=[];var _0x5c49c7={'context':_0x1ccc1c[_0xf153('0x4')]||_0xf153('0x5'),'exten':util[_0xf153('0x6')](_0xf153('0x7'),_0x2afb9a[_0xf153('0x8')],_0x3b85fc),'type':'system','isApp':![],'ChanSpyId':_0x2afb9a['id'],'UserId':_0x1ccc1c['id']};_0x364e65[_0xf153('0x9')](_[_0xf153('0xa')]({'app':_0xf153('0xb'),'appdata':util[_0xf153('0x6')](_0xf153('0xc'),_0xf153('0xd')),'priority':_0x59757c++},_0x5c49c7));if(_0x2afb9a[_0xf153('0xe')]){_0x364e65[_0xf153('0x9')](_[_0xf153('0xa')]({'app':_0xf153('0xf'),'appdata':util['format'](_0xf153('0x10'),_0x2afb9a[_0xf153('0x11')]),'priority':_0x59757c++},_0x5c49c7));}if(_0x2afb9a[_0xf153('0x12')]){_0x364e65['push'](_[_0xf153('0xa')]({'app':_0xf153('0x13'),'appdata':_0x2afb9a[_0xf153('0x14')],'priority':_0x59757c++},_0x5c49c7));}_0x364e65[_0xf153('0x9')](_[_0xf153('0xa')]({'app':_0xf153('0x15'),'appdata':util[_0xf153('0x6')](_0xf153('0x16'),_0x1ccc1c[_0xf153('0x17')],_0x2afb9a['options']?_0x2afb9a[_0xf153('0x18')][_0xf153('0x19')](''):''),'priority':_0x59757c++},_0x5c49c7));if(_0x2afb9a[_0xf153('0xe')]){_0x364e65[_0xf153('0x9')](_[_0xf153('0xa')]({'app':_0xf153('0x1a'),'priority':_0x59757c++},_0x5c49c7));}return _0x364e65;};var getChanSpyApplications=function(_0x273a90,_0x287bc6){var _0x47fbfe=[];for(var _0x35f4e8=0x0,_0x564eeb=0x1;_0x35f4e8<_0x287bc6[_0xf153('0x1b')];_0x35f4e8++,_0x564eeb=0x1){_0x47fbfe=_0x47fbfe[_0xf153('0x1c')](getUserApplications(_0x273a90,_0x287bc6[_0x35f4e8],_0x287bc6[_0x35f4e8][_0xf153('0x1d')]));if(_0x287bc6[_0x35f4e8][_0xf153('0x1d')]!=_0x287bc6[_0x35f4e8]['name']){_0x47fbfe=_0x47fbfe[_0xf153('0x1c')](getUserApplications(_0x273a90,_0x287bc6[_0x35f4e8],_0x287bc6[_0x35f4e8][_0xf153('0x17')]));}}return _0x47fbfe;};var getChanSpyPromise=function(_0x41946a,_0x14b83f){return new BPromise(function(_0x15230c,_0x2f290f){return _0x41946a[_0xf153('0x1e')][_0xf153('0x1f')]({'attributes':['id',_0xf153('0x17'),_0xf153('0x1d')],'where':{'role':_0xf153('0x20'),'chanspy':!![]},'raw':!![]})[_0xf153('0x21')](function(_0x493e8a){if(_0x493e8a){return _0x15230c(getChanSpyApplications(_0x14b83f,_0x493e8a));}return _0x15230c([]);})[_0xf153('0x22')](function(_0x395f28){_0x2f290f(_0x395f28);});});};module[_0xf153('0x23')]=function(_0x32e759,_0x5c9f44){var _0x3e94b5=_0x32e759[_0xf153('0x24')];return _0x32e759[_0xf153('0x25')](_0xf153('0x26'),attributes,{'tableName':_0xf153('0x27'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1570fc,_0x39f3ed,_0x35cfe3){return getChanSpyPromise(_0x3e94b5,_0x1570fc)[_0xf153('0x21')](function(_0xe490f8){if(_0xe490f8&&_0xe490f8[_0xf153('0x1b')]){return _0x3e94b5[_0xf153('0x28')][_0xf153('0x29')](_0xe490f8);}})[_0xf153('0x21')](function(){_0x35cfe3();})[_0xf153('0x22')](function(_0x48ebdc){_0x35cfe3(_0x48ebdc);});},'afterUpdate':function(_0x6d62ef,_0x3f1c6f,_0x576788){return _0x3e94b5[_0xf153('0x28')][_0xf153('0x2a')]({'where':{'ChanSpyId':_0x6d62ef['id']}})['then'](function(){return getChanSpyPromise(_0x3e94b5,_0x6d62ef);})[_0xf153('0x21')](function(_0x10295e){if(_0x10295e&&_0x10295e[_0xf153('0x1b')]){return _0x3e94b5[_0xf153('0x28')][_0xf153('0x29')](_0x10295e);}})[_0xf153('0x21')](function(){_0x576788();})[_0xf153('0x22')](function(_0x3b5f4f){_0x576788(_0x3b5f4f);});},'afterDestroy':function(_0x19a568,_0x8e31bf,_0x13b541){return _0x3e94b5[_0xf153('0x28')]['destroy']({'where':{'ChanSpyId':_0x19a568['id']}})[_0xf153('0x21')](function(){_0x13b541();})[_0xf153('0x22')](function(_0x313516){_0x13b541(_0x313516);});}}});};
\ No newline at end of file
+var _0x8d9b=['exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','prefix','Set','format','CDR(type)=%s','chanspy','record','push','merge','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','agent','then','catch'];(function(_0xbf4ddf,_0x66b3cb){var _0x3cb273=function(_0x3cf903){while(--_0x3cf903){_0xbf4ddf['push'](_0xbf4ddf['shift']());}};_0x3cb273(++_0x66b3cb);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var util=require(_0xb8d9('0x1'));var BPromise=require(_0xb8d9('0x2'));var attributes=require(_0xb8d9('0x3'));var getUserApplications=function(_0x44ddd9,_0x5d3b29,_0x4daeb1){var _0x3f763a=0x1;var _0x47b650=[];var _0x2192ff={'context':_0x5d3b29[_0xb8d9('0x4')]||'from-sip','exten':util['format']('%s%s',_0x44ddd9[_0xb8d9('0x5')],_0x4daeb1),'type':'system','isApp':![],'ChanSpyId':_0x44ddd9['id'],'UserId':_0x5d3b29['id']};_0x47b650['push'](_['merge']({'app':_0xb8d9('0x6'),'appdata':util[_0xb8d9('0x7')](_0xb8d9('0x8'),_0xb8d9('0x9')),'priority':_0x3f763a++},_0x2192ff));if(_0x44ddd9[_0xb8d9('0xa')]){_0x47b650[_0xb8d9('0xb')](_[_0xb8d9('0xc')]({'app':'MixMonitor','appdata':util[_0xb8d9('0x7')]('${UNIQUEID}.%s,a',_0x44ddd9[_0xb8d9('0xd')]),'priority':_0x3f763a++},_0x2192ff));}if(_0x44ddd9[_0xb8d9('0xe')]){_0x47b650[_0xb8d9('0xb')](_[_0xb8d9('0xc')]({'app':_0xb8d9('0xf'),'appdata':_0x44ddd9[_0xb8d9('0x10')],'priority':_0x3f763a++},_0x2192ff));}_0x47b650[_0xb8d9('0xb')](_[_0xb8d9('0xc')]({'app':_0xb8d9('0x11'),'appdata':util[_0xb8d9('0x7')](_0xb8d9('0x12'),_0x5d3b29[_0xb8d9('0x13')],_0x44ddd9[_0xb8d9('0x14')]?_0x44ddd9[_0xb8d9('0x14')]['join'](''):''),'priority':_0x3f763a++},_0x2192ff));if(_0x44ddd9[_0xb8d9('0xa')]){_0x47b650[_0xb8d9('0xb')](_[_0xb8d9('0xc')]({'app':_0xb8d9('0x15'),'priority':_0x3f763a++},_0x2192ff));}return _0x47b650;};var getChanSpyApplications=function(_0x283780,_0x5081dc){var _0x542141=[];for(var _0x5b7d5a=0x0,_0x2d2fc3=0x1;_0x5b7d5a<_0x5081dc[_0xb8d9('0x16')];_0x5b7d5a++,_0x2d2fc3=0x1){_0x542141=_0x542141[_0xb8d9('0x17')](getUserApplications(_0x283780,_0x5081dc[_0x5b7d5a],_0x5081dc[_0x5b7d5a][_0xb8d9('0x18')]));if(_0x5081dc[_0x5b7d5a]['internal']!=_0x5081dc[_0x5b7d5a][_0xb8d9('0x13')]){_0x542141=_0x542141['concat'](getUserApplications(_0x283780,_0x5081dc[_0x5b7d5a],_0x5081dc[_0x5b7d5a][_0xb8d9('0x13')]));}}return _0x542141;};var getChanSpyPromise=function(_0x1709da,_0x447367){return new BPromise(function(_0x3ff41e,_0x96b2eb){return _0x1709da['User']['findAll']({'attributes':['id','name',_0xb8d9('0x18')],'where':{'role':_0xb8d9('0x19'),'chanspy':!![]},'raw':!![]})[_0xb8d9('0x1a')](function(_0x32fd09){if(_0x32fd09){return _0x3ff41e(getChanSpyApplications(_0x447367,_0x32fd09));}return _0x3ff41e([]);})[_0xb8d9('0x1b')](function(_0x48c504){_0x96b2eb(_0x48c504);});});};module[_0xb8d9('0x1c')]=function(_0x430794,_0x1a2bfe){var _0x1e70e2=_0x430794[_0xb8d9('0x1d')];return _0x430794[_0xb8d9('0x1e')](_0xb8d9('0x1f'),attributes,{'tableName':_0xb8d9('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fa36e,_0x250457,_0x52df47){return getChanSpyPromise(_0x1e70e2,_0x3fa36e)[_0xb8d9('0x1a')](function(_0x49380d){if(_0x49380d&&_0x49380d['length']){return _0x1e70e2[_0xb8d9('0x21')][_0xb8d9('0x22')](_0x49380d);}})[_0xb8d9('0x1a')](function(){_0x52df47();})[_0xb8d9('0x1b')](function(_0x30b346){_0x52df47(_0x30b346);});},'afterUpdate':function(_0x4885f2,_0x241041,_0x282db6){return _0x1e70e2[_0xb8d9('0x21')]['destroy']({'where':{'ChanSpyId':_0x4885f2['id']}})[_0xb8d9('0x1a')](function(){return getChanSpyPromise(_0x1e70e2,_0x4885f2);})[_0xb8d9('0x1a')](function(_0x336918){if(_0x336918&&_0x336918['length']){return _0x1e70e2[_0xb8d9('0x21')][_0xb8d9('0x22')](_0x336918);}})['then'](function(){_0x282db6();})[_0xb8d9('0x1b')](function(_0x6cd7f6){_0x282db6(_0x6cd7f6);});},'afterDestroy':function(_0x2694f0,_0x1b1212,_0x358e4d){return _0x1e70e2[_0xb8d9('0x21')][_0xb8d9('0x23')]({'where':{'ChanSpyId':_0x2694f0['id']}})[_0xb8d9('0x1a')](function(){_0x358e4d();})[_0xb8d9('0x1b')](function(_0x390a28){_0x358e4d(_0x390a28);});}}});};
\ No newline at end of file