Built motion from commit fda31434.|2.5.44
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.model.js
index 58ed634..f9f8133 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x202d=['util','bluebird','./voiceChanSpy.attributes','context','%s%s','prefix','system','push','Set','format','CDR(type)=%s','chanspy','record','merge','MixMonitor','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','then','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash'];(function(_0x2e8b77,_0x5d473c){var _0xe01d2b=function(_0x508187){while(--_0x508187){_0x2e8b77['push'](_0x2e8b77['shift']());}};_0xe01d2b(++_0x5d473c);}(_0x202d,0x1e0));var _0xd202=function(_0x45a06f,_0x254a92){_0x45a06f=_0x45a06f-0x0;var _0x1dd577=_0x202d[_0x45a06f];return _0x1dd577;};'use strict';var _=require(_0xd202('0x0'));var util=require(_0xd202('0x1'));var BPromise=require(_0xd202('0x2'));var attributes=require(_0xd202('0x3'));var getUserApplications=function(_0x16e2ed,_0x4e448c,_0x2b5424){var _0x12c3f3=0x1;var _0x4f988d=[];var _0x3bca9f={'context':_0x4e448c[_0xd202('0x4')]||'from-sip','exten':util['format'](_0xd202('0x5'),_0x16e2ed[_0xd202('0x6')],_0x2b5424),'type':_0xd202('0x7'),'isApp':![],'ChanSpyId':_0x16e2ed['id'],'UserId':_0x4e448c['id']};_0x4f988d[_0xd202('0x8')](_['merge']({'app':_0xd202('0x9'),'appdata':util[_0xd202('0xa')](_0xd202('0xb'),_0xd202('0xc')),'priority':_0x12c3f3++},_0x3bca9f));if(_0x16e2ed[_0xd202('0xd')]){_0x4f988d[_0xd202('0x8')](_[_0xd202('0xe')]({'app':_0xd202('0xf'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x16e2ed['recordingFormat']),'priority':_0x12c3f3++},_0x3bca9f));}if(_0x16e2ed['auth']){_0x4f988d[_0xd202('0x8')](_['merge']({'app':_0xd202('0x10'),'appdata':_0x16e2ed[_0xd202('0x11')],'priority':_0x12c3f3++},_0x3bca9f));}_0x4f988d[_0xd202('0x8')](_[_0xd202('0xe')]({'app':_0xd202('0x12'),'appdata':util['format'](_0xd202('0x13'),_0x4e448c[_0xd202('0x14')],_0x16e2ed[_0xd202('0x15')]?_0x16e2ed[_0xd202('0x15')][_0xd202('0x16')](''):''),'priority':_0x12c3f3++},_0x3bca9f));if(_0x16e2ed[_0xd202('0xd')]){_0x4f988d[_0xd202('0x8')](_['merge']({'app':_0xd202('0x17'),'priority':_0x12c3f3++},_0x3bca9f));}return _0x4f988d;};var getChanSpyApplications=function(_0x5a7dcf,_0x1fd61e){var _0x55d6e8=[];for(var _0x5926f6=0x0,_0x1e9624=0x1;_0x5926f6<_0x1fd61e[_0xd202('0x18')];_0x5926f6++,_0x1e9624=0x1){_0x55d6e8=_0x55d6e8[_0xd202('0x19')](getUserApplications(_0x5a7dcf,_0x1fd61e[_0x5926f6],_0x1fd61e[_0x5926f6]['internal']));if(_0x1fd61e[_0x5926f6][_0xd202('0x1a')]!=_0x1fd61e[_0x5926f6][_0xd202('0x14')]){_0x55d6e8=_0x55d6e8[_0xd202('0x19')](getUserApplications(_0x5a7dcf,_0x1fd61e[_0x5926f6],_0x1fd61e[_0x5926f6][_0xd202('0x14')]));}}return _0x55d6e8;};var getChanSpyPromise=function(_0x372ed9,_0x3f3c32){return new BPromise(function(_0x2f416b,_0xb7ed65){return _0x372ed9['User'][_0xd202('0x1b')]({'attributes':['id',_0xd202('0x14'),_0xd202('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xd202('0x1c')](function(_0x14f20e){if(_0x14f20e){return _0x2f416b(getChanSpyApplications(_0x3f3c32,_0x14f20e));}return _0x2f416b([]);})[_0xd202('0x1d')](function(_0x5a7f5b){_0xb7ed65(_0x5a7f5b);});});};module[_0xd202('0x1e')]=function(_0x51e311,_0x35fc5e){var _0x57878c=_0x51e311[_0xd202('0x1f')];return _0x51e311[_0xd202('0x20')]('VoiceChanSpy',attributes,{'tableName':_0xd202('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4334b7,_0x280dd1,_0x49b449){return getChanSpyPromise(_0x57878c,_0x4334b7)[_0xd202('0x1c')](function(_0x2ba756){if(_0x2ba756&&_0x2ba756[_0xd202('0x18')]){return _0x57878c[_0xd202('0x22')][_0xd202('0x23')](_0x2ba756);}})[_0xd202('0x1c')](function(){_0x49b449();})[_0xd202('0x1d')](function(_0x1e393e){_0x49b449(_0x1e393e);});},'afterUpdate':function(_0xffc880,_0x5d7703,_0x42c864){return _0x57878c['VoiceExtension'][_0xd202('0x24')]({'where':{'ChanSpyId':_0xffc880['id']}})[_0xd202('0x1c')](function(){return getChanSpyPromise(_0x57878c,_0xffc880);})[_0xd202('0x1c')](function(_0x3a136a){if(_0x3a136a&&_0x3a136a[_0xd202('0x18')]){return _0x57878c[_0xd202('0x22')][_0xd202('0x23')](_0x3a136a);}})[_0xd202('0x1c')](function(){_0x42c864();})[_0xd202('0x1d')](function(_0xd2ea00){_0x42c864(_0xd2ea00);});},'afterDestroy':function(_0x34c81d,_0x1f095b,_0x522e99){return _0x57878c[_0xd202('0x22')]['destroy']({'where':{'ChanSpyId':_0x34c81d['id']}})[_0xd202('0x1c')](function(){_0x522e99();})['catch'](function(_0x1ec296){_0x522e99(_0x1ec296);});}}});};
\ No newline at end of file
+var _0xeda3=['system','merge','Set','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','join','concat','internal','agent','then','catch','models','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xeda3,0x10f));var _0x3eda=function(_0x103a83,_0x28180b){_0x103a83=_0x103a83-0x0;var _0x5a181e=_0xeda3[_0x103a83];return _0x5a181e;};'use strict';var _=require(_0x3eda('0x0'));var util=require(_0x3eda('0x1'));var BPromise=require(_0x3eda('0x2'));var attributes=require(_0x3eda('0x3'));var getUserApplications=function(_0x4e9def,_0x58cfaf,_0xcb2565){var _0x11a96d=0x1;var _0x51cbe4=[];var _0x30c774={'context':_0x58cfaf[_0x3eda('0x4')]||_0x3eda('0x5'),'exten':util[_0x3eda('0x6')](_0x3eda('0x7'),_0x4e9def[_0x3eda('0x8')],_0xcb2565),'type':_0x3eda('0x9'),'isApp':![],'ChanSpyId':_0x4e9def['id'],'UserId':_0x58cfaf['id']};_0x51cbe4['push'](_[_0x3eda('0xa')]({'app':_0x3eda('0xb'),'appdata':util['format']('CDR(type)=%s',_0x3eda('0xc')),'priority':_0x11a96d++},_0x30c774));if(_0x4e9def[_0x3eda('0xd')]){_0x51cbe4[_0x3eda('0xe')](_[_0x3eda('0xa')]({'app':_0x3eda('0xf'),'appdata':util[_0x3eda('0x6')](_0x3eda('0x10'),_0x4e9def['recordingFormat']),'priority':_0x11a96d++},_0x30c774));}if(_0x4e9def[_0x3eda('0x11')]){_0x51cbe4[_0x3eda('0xe')](_[_0x3eda('0xa')]({'app':_0x3eda('0x12'),'appdata':_0x4e9def[_0x3eda('0x13')],'priority':_0x11a96d++},_0x30c774));}_0x51cbe4[_0x3eda('0xe')](_['merge']({'app':_0x3eda('0x14'),'appdata':util[_0x3eda('0x6')](_0x3eda('0x15'),_0x58cfaf[_0x3eda('0x16')],_0x4e9def['options']?_0x4e9def['options'][_0x3eda('0x17')](''):''),'priority':_0x11a96d++},_0x30c774));if(_0x4e9def[_0x3eda('0xd')]){_0x51cbe4[_0x3eda('0xe')](_['merge']({'app':'StopMixMonitor','priority':_0x11a96d++},_0x30c774));}return _0x51cbe4;};var getChanSpyApplications=function(_0x399296,_0x2dc801){var _0x16b24f=[];for(var _0x385557=0x0,_0x30a612=0x1;_0x385557<_0x2dc801['length'];_0x385557++,_0x30a612=0x1){_0x16b24f=_0x16b24f[_0x3eda('0x18')](getUserApplications(_0x399296,_0x2dc801[_0x385557],_0x2dc801[_0x385557]['internal']));if(_0x2dc801[_0x385557][_0x3eda('0x19')]!=_0x2dc801[_0x385557][_0x3eda('0x16')]){_0x16b24f=_0x16b24f[_0x3eda('0x18')](getUserApplications(_0x399296,_0x2dc801[_0x385557],_0x2dc801[_0x385557][_0x3eda('0x16')]));}}return _0x16b24f;};var getChanSpyPromise=function(_0x257a13,_0x4aa1b8){return new BPromise(function(_0x3fdc9b,_0x2afe35){return _0x257a13['User']['findAll']({'attributes':['id',_0x3eda('0x16'),_0x3eda('0x19')],'where':{'role':_0x3eda('0x1a'),'chanspy':!![]},'raw':!![]})[_0x3eda('0x1b')](function(_0x5a1a8c){if(_0x5a1a8c){return _0x3fdc9b(getChanSpyApplications(_0x4aa1b8,_0x5a1a8c));}return _0x3fdc9b([]);})[_0x3eda('0x1c')](function(_0x1d8d38){_0x2afe35(_0x1d8d38);});});};module['exports']=function(_0x1ec46b,_0x4816fc){var _0x39ec56=_0x1ec46b[_0x3eda('0x1d')];return _0x1ec46b['define']('VoiceChanSpy',attributes,{'tableName':_0x3eda('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x44cde5,_0x2e126a,_0x555037){return getChanSpyPromise(_0x39ec56,_0x44cde5)[_0x3eda('0x1b')](function(_0x2d81ea){if(_0x2d81ea&&_0x2d81ea[_0x3eda('0x1f')]){return _0x39ec56[_0x3eda('0x20')][_0x3eda('0x21')](_0x2d81ea);}})[_0x3eda('0x1b')](function(){_0x555037();})['catch'](function(_0x1db070){_0x555037(_0x1db070);});},'afterUpdate':function(_0x42545c,_0x2fd78d,_0xd6209e){return _0x39ec56[_0x3eda('0x20')][_0x3eda('0x22')]({'where':{'ChanSpyId':_0x42545c['id']}})[_0x3eda('0x1b')](function(){return getChanSpyPromise(_0x39ec56,_0x42545c);})[_0x3eda('0x1b')](function(_0x1ef455){if(_0x1ef455&&_0x1ef455[_0x3eda('0x1f')]){return _0x39ec56[_0x3eda('0x20')][_0x3eda('0x21')](_0x1ef455);}})[_0x3eda('0x1b')](function(){_0xd6209e();})[_0x3eda('0x1c')](function(_0x2e0894){_0xd6209e(_0x2e0894);});},'afterDestroy':function(_0x532238,_0x494c74,_0x201da8){return _0x39ec56['VoiceExtension'][_0x3eda('0x22')]({'where':{'ChanSpyId':_0x532238['id']}})['then'](function(){_0x201da8();})[_0x3eda('0x1c')](function(_0x2c032c){_0x201da8(_0x2c032c);});}}});};
\ No newline at end of file