Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.model.js
index 914a292..cde04fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x10bd=['agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','length','VoiceExtension','destroy','util','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','recordingFormat','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','findAll'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x10bd,0x97));var _0xd10b=function(_0x32d525,_0x1d435b){_0x32d525=_0x32d525-0x0;var _0x1038a0=_0x10bd[_0x32d525];return _0x1038a0;};'use strict';var _=require('lodash');var util=require(_0xd10b('0x0'));var BPromise=require('bluebird');var attributes=require(_0xd10b('0x1'));var getUserApplications=function(_0x39cc86,_0x49ebe0,_0x52f36f){var _0x17d6ae=0x1;var _0x2a20d4=[];var _0xe08c54={'context':_0x49ebe0[_0xd10b('0x2')]||'from-sip','exten':util[_0xd10b('0x3')](_0xd10b('0x4'),_0x39cc86[_0xd10b('0x5')],_0x52f36f),'type':_0xd10b('0x6'),'isApp':![],'ChanSpyId':_0x39cc86['id'],'UserId':_0x49ebe0['id']};_0x2a20d4[_0xd10b('0x7')](_[_0xd10b('0x8')]({'app':_0xd10b('0x9'),'appdata':util[_0xd10b('0x3')](_0xd10b('0xa'),_0xd10b('0xb')),'priority':_0x17d6ae++},_0xe08c54));if(_0x39cc86[_0xd10b('0xc')]){_0x2a20d4['push'](_['merge']({'app':'MixMonitor','appdata':util[_0xd10b('0x3')]('${UNIQUEID}.%s,ab',_0x39cc86[_0xd10b('0xd')]),'priority':_0x17d6ae++},_0xe08c54));}if(_0x39cc86['auth']){_0x2a20d4[_0xd10b('0x7')](_[_0xd10b('0x8')]({'app':_0xd10b('0xe'),'appdata':_0x39cc86['password'],'priority':_0x17d6ae++},_0xe08c54));}_0x2a20d4[_0xd10b('0x7')](_[_0xd10b('0x8')]({'app':_0xd10b('0xf'),'appdata':util['format'](_0xd10b('0x10'),_0x49ebe0[_0xd10b('0x11')],_0x39cc86[_0xd10b('0x12')]?_0x39cc86[_0xd10b('0x12')][_0xd10b('0x13')](''):''),'priority':_0x17d6ae++},_0xe08c54));if(_0x39cc86[_0xd10b('0xc')]){_0x2a20d4[_0xd10b('0x7')](_['merge']({'app':_0xd10b('0x14'),'priority':_0x17d6ae++},_0xe08c54));}return _0x2a20d4;};var getChanSpyApplications=function(_0x37e3be,_0x2026f0){var _0x594a41=[];for(var _0x3383f1=0x0,_0x4c0faf=0x1;_0x3383f1<_0x2026f0['length'];_0x3383f1++,_0x4c0faf=0x1){_0x594a41=_0x594a41[_0xd10b('0x15')](getUserApplications(_0x37e3be,_0x2026f0[_0x3383f1],_0x2026f0[_0x3383f1][_0xd10b('0x16')]));if(_0x2026f0[_0x3383f1][_0xd10b('0x16')]!=_0x2026f0[_0x3383f1]['name']){_0x594a41=_0x594a41[_0xd10b('0x15')](getUserApplications(_0x37e3be,_0x2026f0[_0x3383f1],_0x2026f0[_0x3383f1][_0xd10b('0x11')]));}}return _0x594a41;};var getChanSpyPromise=function(_0x1e057e,_0x162975){return new BPromise(function(_0x1777b5,_0x4cdec1){return _0x1e057e['User'][_0xd10b('0x17')]({'attributes':['id',_0xd10b('0x11'),_0xd10b('0x16')],'where':{'role':_0xd10b('0x18'),'chanspy':!![]},'raw':!![]})['then'](function(_0x4f69ef){if(_0x4f69ef){return _0x1777b5(getChanSpyApplications(_0x162975,_0x4f69ef));}return _0x1777b5([]);})[_0xd10b('0x19')](function(_0x167426){_0x4cdec1(_0x167426);});});};module[_0xd10b('0x1a')]=function(_0x356007,_0x18c6d2){var _0x1663fd=_0x356007[_0xd10b('0x1b')];return _0x356007[_0xd10b('0x1c')](_0xd10b('0x1d'),attributes,{'tableName':_0xd10b('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x111fd5,_0x6b6e03,_0x532fd7){return getChanSpyPromise(_0x1663fd,_0x111fd5)[_0xd10b('0x1f')](function(_0x5bc693){if(_0x5bc693&&_0x5bc693[_0xd10b('0x20')]){return _0x1663fd[_0xd10b('0x21')]['bulkCreate'](_0x5bc693);}})[_0xd10b('0x1f')](function(){_0x532fd7();})[_0xd10b('0x19')](function(_0x5d87e0){_0x532fd7(_0x5d87e0);});},'afterUpdate':function(_0x419fed,_0x4e731e,_0x57a773){return _0x1663fd['VoiceExtension'][_0xd10b('0x22')]({'where':{'ChanSpyId':_0x419fed['id']}})[_0xd10b('0x1f')](function(){return getChanSpyPromise(_0x1663fd,_0x419fed);})[_0xd10b('0x1f')](function(_0x379d71){if(_0x379d71&&_0x379d71['length']){return _0x1663fd[_0xd10b('0x21')]['bulkCreate'](_0x379d71);}})[_0xd10b('0x1f')](function(){_0x57a773();})[_0xd10b('0x19')](function(_0x3948d9){_0x57a773(_0x3948d9);});},'afterDestroy':function(_0x11360a,_0x473d0a,_0x469858){return _0x1663fd[_0xd10b('0x21')]['destroy']({'where':{'ChanSpyId':_0x11360a['id']}})[_0xd10b('0x1f')](function(){_0x469858();})[_0xd10b('0x19')](function(_0x3584eb){_0x469858(_0x3584eb);});}}});};
\ No newline at end of file
+var _0xeec3=['record','${UNIQUEID}.%s,ab','recordingFormat','auth','ChanSpy','SIP/%s,%s','options','length','concat','internal','name','findAll','agent','catch','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','context','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy'];(function(_0x4ad533,_0x286658){var _0x29d81b=function(_0x59f760){while(--_0x59f760){_0x4ad533['push'](_0x4ad533['shift']());}};_0x29d81b(++_0x286658);}(_0xeec3,0x1c3));var _0x3eec=function(_0x140390,_0x435228){_0x140390=_0x140390-0x0;var _0x361859=_0xeec3[_0x140390];return _0x361859;};'use strict';var _=require(_0x3eec('0x0'));var util=require(_0x3eec('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x52bfc8,_0x5537d9,_0x5266ea){var _0x4726fe=0x1;var _0x11ea5e=[];var _0x5be6c5={'context':_0x5537d9[_0x3eec('0x2')]||'from-sip','exten':util[_0x3eec('0x3')](_0x3eec('0x4'),_0x52bfc8['prefix'],_0x5266ea),'type':_0x3eec('0x5'),'isApp':![],'ChanSpyId':_0x52bfc8['id'],'UserId':_0x5537d9['id']};_0x11ea5e[_0x3eec('0x6')](_[_0x3eec('0x7')]({'app':_0x3eec('0x8'),'appdata':util[_0x3eec('0x3')](_0x3eec('0x9'),_0x3eec('0xa')),'priority':_0x4726fe++},_0x5be6c5));if(_0x52bfc8[_0x3eec('0xb')]){_0x11ea5e['push'](_[_0x3eec('0x7')]({'app':'MixMonitor','appdata':util[_0x3eec('0x3')](_0x3eec('0xc'),_0x52bfc8[_0x3eec('0xd')]),'priority':_0x4726fe++},_0x5be6c5));}if(_0x52bfc8[_0x3eec('0xe')]){_0x11ea5e['push'](_[_0x3eec('0x7')]({'app':'Authenticate','appdata':_0x52bfc8['password'],'priority':_0x4726fe++},_0x5be6c5));}_0x11ea5e['push'](_[_0x3eec('0x7')]({'app':_0x3eec('0xf'),'appdata':util[_0x3eec('0x3')](_0x3eec('0x10'),_0x5537d9['name'],_0x52bfc8[_0x3eec('0x11')]?_0x52bfc8['options']['join'](''):''),'priority':_0x4726fe++},_0x5be6c5));if(_0x52bfc8['record']){_0x11ea5e[_0x3eec('0x6')](_['merge']({'app':'StopMixMonitor','priority':_0x4726fe++},_0x5be6c5));}return _0x11ea5e;};var getChanSpyApplications=function(_0xbf8c3e,_0x335c87){var _0x7698b=[];for(var _0x48b170=0x0,_0x5d6451=0x1;_0x48b170<_0x335c87[_0x3eec('0x12')];_0x48b170++,_0x5d6451=0x1){_0x7698b=_0x7698b[_0x3eec('0x13')](getUserApplications(_0xbf8c3e,_0x335c87[_0x48b170],_0x335c87[_0x48b170]['internal']));if(_0x335c87[_0x48b170][_0x3eec('0x14')]!=_0x335c87[_0x48b170]['name']){_0x7698b=_0x7698b[_0x3eec('0x13')](getUserApplications(_0xbf8c3e,_0x335c87[_0x48b170],_0x335c87[_0x48b170][_0x3eec('0x15')]));}}return _0x7698b;};var getChanSpyPromise=function(_0x59b20f,_0x2bbbd0){return new BPromise(function(_0x5c9593,_0x1fd0d8){return _0x59b20f['User'][_0x3eec('0x16')]({'attributes':['id',_0x3eec('0x15'),'internal'],'where':{'role':_0x3eec('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0x50bdd1){if(_0x50bdd1){return _0x5c9593(getChanSpyApplications(_0x2bbbd0,_0x50bdd1));}return _0x5c9593([]);})[_0x3eec('0x18')](function(_0x44810b){_0x1fd0d8(_0x44810b);});});};module['exports']=function(_0x39e62d,_0x5e279f){var _0x37e5af=_0x39e62d[_0x3eec('0x19')];return _0x39e62d[_0x3eec('0x1a')](_0x3eec('0x1b'),attributes,{'tableName':_0x3eec('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x203b3f,_0x34fbe4,_0x1023a0){return getChanSpyPromise(_0x37e5af,_0x203b3f)[_0x3eec('0x1d')](function(_0x29eb99){if(_0x29eb99&&_0x29eb99[_0x3eec('0x12')]){return _0x37e5af[_0x3eec('0x1e')][_0x3eec('0x1f')](_0x29eb99);}})['then'](function(){_0x1023a0();})[_0x3eec('0x18')](function(_0x5d1f27){_0x1023a0(_0x5d1f27);});},'afterUpdate':function(_0x206b9d,_0x3cf5ed,_0x279404){return _0x37e5af[_0x3eec('0x1e')][_0x3eec('0x20')]({'where':{'ChanSpyId':_0x206b9d['id']}})[_0x3eec('0x1d')](function(){return getChanSpyPromise(_0x37e5af,_0x206b9d);})[_0x3eec('0x1d')](function(_0x17c896){if(_0x17c896&&_0x17c896[_0x3eec('0x12')]){return _0x37e5af[_0x3eec('0x1e')][_0x3eec('0x1f')](_0x17c896);}})[_0x3eec('0x1d')](function(){_0x279404();})[_0x3eec('0x18')](function(_0x26fb08){_0x279404(_0x26fb08);});},'afterDestroy':function(_0x1d4f89,_0x305313,_0x4ba0e7){return _0x37e5af[_0x3eec('0x1e')][_0x3eec('0x20')]({'where':{'ChanSpyId':_0x1d4f89['id']}})[_0x3eec('0x1d')](function(){_0x4ba0e7();})[_0x3eec('0x18')](function(_0x25eded){_0x4ba0e7(_0x25eded);});}}});};
\ No newline at end of file