Built motion from commit (unavailable).|2.5.14
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.model.js
index cf661f3..457fa11 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a2e=['from-sip','%s%s','system','merge','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird'];(function(_0x5165bb,_0x41a5d3){var _0x5a56ee=function(_0x4f4767){while(--_0x4f4767){_0x5165bb['push'](_0x5165bb['shift']());}};_0x5a56ee(++_0x41a5d3);}(_0x4a2e,0x125));var _0xe4a2=function(_0x5185c6,_0x4e7c65){_0x5185c6=_0x5185c6-0x0;var _0x1a9c19=_0x4a2e[_0x5185c6];return _0x1a9c19;};'use strict';var _=require(_0xe4a2('0x0'));var util=require(_0xe4a2('0x1'));var BPromise=require(_0xe4a2('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x36e827,_0x38471b,_0x4f067f){var _0x847d40=0x1;var _0x39b079=[];var _0x583dab={'context':_0x38471b['context']||_0xe4a2('0x3'),'exten':util['format'](_0xe4a2('0x4'),_0x36e827['prefix'],_0x4f067f),'type':_0xe4a2('0x5'),'isApp':![],'ChanSpyId':_0x36e827['id'],'UserId':_0x38471b['id']};_0x39b079['push'](_[_0xe4a2('0x6')]({'app':'Set','appdata':util['format'](_0xe4a2('0x7'),_0xe4a2('0x8')),'priority':_0x847d40++},_0x583dab));if(_0x36e827[_0xe4a2('0x9')]){_0x39b079[_0xe4a2('0xa')](_[_0xe4a2('0x6')]({'app':_0xe4a2('0xb'),'appdata':util['format'](_0xe4a2('0xc'),_0x36e827[_0xe4a2('0xd')]),'priority':_0x847d40++},_0x583dab));}if(_0x36e827[_0xe4a2('0xe')]){_0x39b079['push'](_[_0xe4a2('0x6')]({'app':'Authenticate','appdata':_0x36e827[_0xe4a2('0xf')],'priority':_0x847d40++},_0x583dab));}_0x39b079[_0xe4a2('0xa')](_[_0xe4a2('0x6')]({'app':_0xe4a2('0x10'),'appdata':util['format'](_0xe4a2('0x11'),_0x38471b[_0xe4a2('0x12')],_0x36e827[_0xe4a2('0x13')]?_0x36e827[_0xe4a2('0x13')][_0xe4a2('0x14')](''):''),'priority':_0x847d40++},_0x583dab));if(_0x36e827['record']){_0x39b079['push'](_[_0xe4a2('0x6')]({'app':_0xe4a2('0x15'),'priority':_0x847d40++},_0x583dab));}return _0x39b079;};var getChanSpyApplications=function(_0x419171,_0x3e72d3){var _0x23b2fe=[];for(var _0x1a77ef=0x0,_0x5d3c7b=0x1;_0x1a77ef<_0x3e72d3[_0xe4a2('0x16')];_0x1a77ef++,_0x5d3c7b=0x1){_0x23b2fe=_0x23b2fe[_0xe4a2('0x17')](getUserApplications(_0x419171,_0x3e72d3[_0x1a77ef],_0x3e72d3[_0x1a77ef][_0xe4a2('0x18')]));if(_0x3e72d3[_0x1a77ef][_0xe4a2('0x18')]!=_0x3e72d3[_0x1a77ef]['name']){_0x23b2fe=_0x23b2fe[_0xe4a2('0x17')](getUserApplications(_0x419171,_0x3e72d3[_0x1a77ef],_0x3e72d3[_0x1a77ef][_0xe4a2('0x12')]));}}return _0x23b2fe;};var getChanSpyPromise=function(_0x39af3b,_0x6c3786){return new BPromise(function(_0xb56dcc,_0x53114b){return _0x39af3b[_0xe4a2('0x19')][_0xe4a2('0x1a')]({'attributes':['id',_0xe4a2('0x12'),_0xe4a2('0x18')],'where':{'role':_0xe4a2('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x1f058){if(_0x1f058){return _0xb56dcc(getChanSpyApplications(_0x6c3786,_0x1f058));}return _0xb56dcc([]);})[_0xe4a2('0x1c')](function(_0x4a44f2){_0x53114b(_0x4a44f2);});});};module['exports']=function(_0x1a84f6,_0x56a4ae){var _0x556b24=_0x1a84f6[_0xe4a2('0x1d')];return _0x1a84f6[_0xe4a2('0x1e')](_0xe4a2('0x1f'),attributes,{'tableName':_0xe4a2('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe8362b,_0x174f29,_0x435390){return getChanSpyPromise(_0x556b24,_0xe8362b)[_0xe4a2('0x21')](function(_0x151f21){if(_0x151f21&&_0x151f21[_0xe4a2('0x16')]){return _0x556b24[_0xe4a2('0x22')]['bulkCreate'](_0x151f21);}})[_0xe4a2('0x21')](function(){_0x435390();})['catch'](function(_0x3eabc8){_0x435390(_0x3eabc8);});},'afterUpdate':function(_0x352211,_0x51bca2,_0xf94859){return _0x556b24['VoiceExtension'][_0xe4a2('0x23')]({'where':{'ChanSpyId':_0x352211['id']}})[_0xe4a2('0x21')](function(){return getChanSpyPromise(_0x556b24,_0x352211);})[_0xe4a2('0x21')](function(_0x2f0a48){if(_0x2f0a48&&_0x2f0a48[_0xe4a2('0x16')]){return _0x556b24[_0xe4a2('0x22')][_0xe4a2('0x24')](_0x2f0a48);}})[_0xe4a2('0x21')](function(){_0xf94859();})[_0xe4a2('0x1c')](function(_0x1f3f14){_0xf94859(_0x1f3f14);});},'afterDestroy':function(_0x2aa2db,_0x4cad40,_0x3b69ff){return _0x556b24[_0xe4a2('0x22')][_0xe4a2('0x23')]({'where':{'ChanSpyId':_0x2aa2db['id']}})[_0xe4a2('0x21')](function(){_0x3b69ff();})['catch'](function(_0x53d86c){_0x3b69ff(_0x53d86c);});}}});};
\ No newline at end of file
+var _0x51f4=['MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','merge','password','SIP/%s,%s','name','options','join','concat','agent','catch','models','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension','destroy','length','lodash','util','bluebird','context','from-sip','format','prefix','system','push','Set','CDR(type)=%s','chanspy'];(function(_0x31b287,_0xdc3071){var _0x12f98d=function(_0x5cf48e){while(--_0x5cf48e){_0x31b287['push'](_0x31b287['shift']());}};_0x12f98d(++_0xdc3071);}(_0x51f4,0x1c2));var _0x451f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x51f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x451f('0x0'));var util=require(_0x451f('0x1'));var BPromise=require(_0x451f('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xace018,_0x444171,_0x1e75d1){var _0x48f14d=0x1;var _0x2e4ede=[];var _0x4dcf23={'context':_0x444171[_0x451f('0x3')]||_0x451f('0x4'),'exten':util[_0x451f('0x5')]('%s%s',_0xace018[_0x451f('0x6')],_0x1e75d1),'type':_0x451f('0x7'),'isApp':![],'ChanSpyId':_0xace018['id'],'UserId':_0x444171['id']};_0x2e4ede[_0x451f('0x8')](_['merge']({'app':_0x451f('0x9'),'appdata':util[_0x451f('0x5')](_0x451f('0xa'),_0x451f('0xb')),'priority':_0x48f14d++},_0x4dcf23));if(_0xace018['record']){_0x2e4ede[_0x451f('0x8')](_['merge']({'app':_0x451f('0xc'),'appdata':util[_0x451f('0x5')](_0x451f('0xd'),_0xace018[_0x451f('0xe')]),'priority':_0x48f14d++},_0x4dcf23));}if(_0xace018[_0x451f('0xf')]){_0x2e4ede[_0x451f('0x8')](_[_0x451f('0x10')]({'app':'Authenticate','appdata':_0xace018[_0x451f('0x11')],'priority':_0x48f14d++},_0x4dcf23));}_0x2e4ede[_0x451f('0x8')](_[_0x451f('0x10')]({'app':'ChanSpy','appdata':util[_0x451f('0x5')](_0x451f('0x12'),_0x444171[_0x451f('0x13')],_0xace018[_0x451f('0x14')]?_0xace018['options'][_0x451f('0x15')](''):''),'priority':_0x48f14d++},_0x4dcf23));if(_0xace018['record']){_0x2e4ede[_0x451f('0x8')](_['merge']({'app':'StopMixMonitor','priority':_0x48f14d++},_0x4dcf23));}return _0x2e4ede;};var getChanSpyApplications=function(_0x242390,_0x522b9c){var _0x18ca77=[];for(var _0x53b34a=0x0,_0x5a6605=0x1;_0x53b34a<_0x522b9c['length'];_0x53b34a++,_0x5a6605=0x1){_0x18ca77=_0x18ca77[_0x451f('0x16')](getUserApplications(_0x242390,_0x522b9c[_0x53b34a],_0x522b9c[_0x53b34a]['internal']));if(_0x522b9c[_0x53b34a]['internal']!=_0x522b9c[_0x53b34a][_0x451f('0x13')]){_0x18ca77=_0x18ca77[_0x451f('0x16')](getUserApplications(_0x242390,_0x522b9c[_0x53b34a],_0x522b9c[_0x53b34a][_0x451f('0x13')]));}}return _0x18ca77;};var getChanSpyPromise=function(_0x54774e,_0x15896f){return new BPromise(function(_0x2d6281,_0x29ad73){return _0x54774e['User']['findAll']({'attributes':['id','name','internal'],'where':{'role':_0x451f('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2182a3){if(_0x2182a3){return _0x2d6281(getChanSpyApplications(_0x15896f,_0x2182a3));}return _0x2d6281([]);})[_0x451f('0x18')](function(_0x5b762b){_0x29ad73(_0x5b762b);});});};module['exports']=function(_0x5f5589,_0x4b051b){var _0x74fe04=_0x5f5589[_0x451f('0x19')];return _0x5f5589['define'](_0x451f('0x1a'),attributes,{'tableName':_0x451f('0x1b'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xd8ce4,_0x2f2d45,_0x2fcb00){return getChanSpyPromise(_0x74fe04,_0xd8ce4)[_0x451f('0x1c')](function(_0x2e85e1){if(_0x2e85e1&&_0x2e85e1['length']){return _0x74fe04['VoiceExtension'][_0x451f('0x1d')](_0x2e85e1);}})[_0x451f('0x1c')](function(){_0x2fcb00();})[_0x451f('0x18')](function(_0x5a215a){_0x2fcb00(_0x5a215a);});},'afterUpdate':function(_0x12d19f,_0x53bf4a,_0x4492e0){return _0x74fe04[_0x451f('0x1e')][_0x451f('0x1f')]({'where':{'ChanSpyId':_0x12d19f['id']}})[_0x451f('0x1c')](function(){return getChanSpyPromise(_0x74fe04,_0x12d19f);})[_0x451f('0x1c')](function(_0x4d4071){if(_0x4d4071&&_0x4d4071[_0x451f('0x20')]){return _0x74fe04[_0x451f('0x1e')][_0x451f('0x1d')](_0x4d4071);}})[_0x451f('0x1c')](function(){_0x4492e0();})[_0x451f('0x18')](function(_0xd40efe){_0x4492e0(_0xd40efe);});},'afterDestroy':function(_0x154ce1,_0x3dcd93,_0x1eb65d){return _0x74fe04[_0x451f('0x1e')][_0x451f('0x1f')]({'where':{'ChanSpyId':_0x154ce1['id']}})[_0x451f('0x1c')](function(){_0x1eb65d();})[_0x451f('0x18')](function(_0x5c2bfd){_0x1eb65d(_0x5c2bfd);});}}});};
\ No newline at end of file