Built motion from commit (unavailable).|2.0.71
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.model.js
index be0a59f..0b7a5f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb986=['models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','../../config/logger','from-sip','system','format','prefix','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,ab','auth','Authenticate','password','SIP/%s,%s','name','options','join','push','length','concat','User','findAll','internal','agent','then','catch','exports'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xb986,0x183));var _0x6b98=function(_0xd3925f,_0x2c2220){_0xd3925f=_0xd3925f-0x0;var _0x4a357f=_0xb986[_0xd3925f];return _0x4a357f;};'use strict';var _=require('lodash');var util=require(_0x6b98('0x0'));var BPromise=require(_0x6b98('0x1'));var logger=require(_0x6b98('0x2'))('api');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x130778,_0x302828,_0x10dd5c){var _0x3dd36e=0x1;var _0xd969df=[];var _0x1cc80a={'context':_0x6b98('0x3'),'type':_0x6b98('0x4'),'isApp':![]};var _0x95b096={'exten':util[_0x6b98('0x5')]('%s%s',_0x130778[_0x6b98('0x6')],_0x10dd5c),'ChanSpyId':_0x130778['id'],'UserId':_0x302828['id']};_0xd969df['push'](_[_0x6b98('0x7')]({'app':_0x6b98('0x8'),'appdata':util[_0x6b98('0x5')](_0x6b98('0x9'),_0x6b98('0xa')),'priority':_0x3dd36e++},_0x1cc80a,_0x95b096));if(_0x130778[_0x6b98('0xb')]){_0xd969df['push'](_[_0x6b98('0x7')]({'app':_0x6b98('0xc'),'appdata':util[_0x6b98('0x5')](_0x6b98('0xd'),_0x130778['recordingFormat']),'priority':_0x3dd36e++},_0x1cc80a,_0x95b096));}if(_0x130778[_0x6b98('0xe')]){_0xd969df['push'](_[_0x6b98('0x7')]({'app':_0x6b98('0xf'),'appdata':_0x130778[_0x6b98('0x10')],'priority':_0x3dd36e++},_0x1cc80a,_0x95b096));}_0xd969df['push'](_[_0x6b98('0x7')]({'app':'ChanSpy','appdata':util['format'](_0x6b98('0x11'),_0x302828[_0x6b98('0x12')],_0x130778['options']?_0x130778[_0x6b98('0x13')][_0x6b98('0x14')](''):''),'priority':_0x3dd36e++},_0x1cc80a,_0x95b096));if(_0x130778[_0x6b98('0xb')]){_0xd969df[_0x6b98('0x15')](_[_0x6b98('0x7')]({'app':'StopMixMonitor','priority':_0x3dd36e++},_0x1cc80a,_0x95b096));}return _0xd969df;};var getChanSpyApplications=function(_0x235cd8,_0x3c919b){var _0x49341a=[];for(var _0x3fc7cc=0x0,_0x288103=0x1;_0x3fc7cc<_0x3c919b[_0x6b98('0x16')];_0x3fc7cc++,_0x288103=0x1){var _0x516eb5=getUserApplications(_0x235cd8,_0x3c919b[_0x3fc7cc],_0x3c919b[_0x3fc7cc]['internal']);var _0xc629bb=getUserApplications(_0x235cd8,_0x3c919b[_0x3fc7cc],_0x3c919b[_0x3fc7cc][_0x6b98('0x12')]);_0x49341a=_0x49341a[_0x6b98('0x17')](_0x516eb5,_0xc629bb);}return _0x49341a;};var getChanSpyPromise=function(_0x22b0f5,_0x1e3a67){return new BPromise(function(_0x11a58b,_0x4c3a4e){return _0x22b0f5[_0x6b98('0x18')][_0x6b98('0x19')]({'attributes':['id',_0x6b98('0x12'),_0x6b98('0x1a')],'where':{'role':_0x6b98('0x1b'),'chanspy':!![]},'raw':!![]})[_0x6b98('0x1c')](function(_0x2319e8){if(_0x2319e8){return _0x11a58b(getChanSpyApplications(_0x1e3a67,_0x2319e8));}return _0x11a58b([]);})[_0x6b98('0x1d')](function(_0x2fb9b4){_0x4c3a4e(_0x2fb9b4);});});};module[_0x6b98('0x1e')]=function(_0x1da305,_0x4fe927){var _0x575adc=_0x1da305[_0x6b98('0x1f')];return _0x1da305[_0x6b98('0x20')](_0x6b98('0x21'),attributes,{'tableName':_0x6b98('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4fc272,_0x4db73e,_0x3e20e2){return getChanSpyPromise(_0x575adc,_0x4fc272)['then'](function(_0x22876a){if(_0x22876a&&_0x22876a['length']){return _0x575adc[_0x6b98('0x23')][_0x6b98('0x24')](_0x22876a);}})['then'](function(){_0x3e20e2();})['catch'](function(_0x5a8600){_0x3e20e2(_0x5a8600);});},'afterUpdate':function(_0x1d102c,_0x50103b,_0x2d43cf){return _0x575adc[_0x6b98('0x23')][_0x6b98('0x25')]({'where':{'ChanSpyId':_0x1d102c['id']}})['then'](function(){return getChanSpyPromise(_0x575adc,_0x1d102c);})[_0x6b98('0x1c')](function(_0x27291e){if(_0x27291e&&_0x27291e[_0x6b98('0x16')]){return _0x575adc[_0x6b98('0x23')][_0x6b98('0x24')](_0x27291e);}})[_0x6b98('0x1c')](function(){_0x2d43cf();})[_0x6b98('0x1d')](function(_0x4f9f24){_0x2d43cf(_0x4f9f24);});},'afterDestroy':function(_0x4eb005,_0x2af6db,_0x2b1fa9){return _0x575adc[_0x6b98('0x23')][_0x6b98('0x25')]({'where':{'ChanSpyId':_0x4eb005['id']}})[_0x6b98('0x1c')](function(){_0x2b1fa9();})['catch'](function(_0x4b0290){_0x2b1fa9(_0x4b0290);});}}});};
\ No newline at end of file
+var _0x4080=['password','SIP/%s,%s','name','options','StopMixMonitor','length','internal','User','agent','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','system','format','merge','Set','CDR(type)=%s','record','push','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate'];(function(_0x4215b9,_0x100d7e){var _0x469e4c=function(_0x3cb0d5){while(--_0x3cb0d5){_0x4215b9['push'](_0x4215b9['shift']());}};_0x469e4c(++_0x100d7e);}(_0x4080,0x7b));var _0x0408=function(_0x2baca1,_0x2f3557){_0x2baca1=_0x2baca1-0x0;var _0x9aa62a=_0x4080[_0x2baca1];return _0x9aa62a;};'use strict';var _=require(_0x0408('0x0'));var util=require(_0x0408('0x1'));var BPromise=require(_0x0408('0x2'));var logger=require('../../config/logger')('api');var attributes=require(_0x0408('0x3'));var getUserApplications=function(_0x202d5f,_0x1662a3,_0x2d3c07){var _0xd08b57=0x1;var _0x3f03b3=[];var _0x18b07c={'context':_0x0408('0x4'),'type':_0x0408('0x5'),'isApp':![]};var _0x4ca93f={'exten':util[_0x0408('0x6')]('%s%s',_0x202d5f['prefix'],_0x2d3c07),'ChanSpyId':_0x202d5f['id'],'UserId':_0x1662a3['id']};_0x3f03b3['push'](_[_0x0408('0x7')]({'app':_0x0408('0x8'),'appdata':util['format'](_0x0408('0x9'),'chanspy'),'priority':_0xd08b57++},_0x18b07c,_0x4ca93f));if(_0x202d5f[_0x0408('0xa')]){_0x3f03b3[_0x0408('0xb')](_[_0x0408('0x7')]({'app':_0x0408('0xc'),'appdata':util['format'](_0x0408('0xd'),_0x202d5f[_0x0408('0xe')]),'priority':_0xd08b57++},_0x18b07c,_0x4ca93f));}if(_0x202d5f[_0x0408('0xf')]){_0x3f03b3['push'](_['merge']({'app':_0x0408('0x10'),'appdata':_0x202d5f[_0x0408('0x11')],'priority':_0xd08b57++},_0x18b07c,_0x4ca93f));}_0x3f03b3[_0x0408('0xb')](_[_0x0408('0x7')]({'app':'ChanSpy','appdata':util[_0x0408('0x6')](_0x0408('0x12'),_0x1662a3[_0x0408('0x13')],_0x202d5f['options']?_0x202d5f[_0x0408('0x14')]['join'](''):''),'priority':_0xd08b57++},_0x18b07c,_0x4ca93f));if(_0x202d5f[_0x0408('0xa')]){_0x3f03b3[_0x0408('0xb')](_['merge']({'app':_0x0408('0x15'),'priority':_0xd08b57++},_0x18b07c,_0x4ca93f));}return _0x3f03b3;};var getChanSpyApplications=function(_0x40ea29,_0x20907a){var _0x3b8608=[];for(var _0x1627e0=0x0,_0x33d696=0x1;_0x1627e0<_0x20907a[_0x0408('0x16')];_0x1627e0++,_0x33d696=0x1){var _0x2bebc8=getUserApplications(_0x40ea29,_0x20907a[_0x1627e0],_0x20907a[_0x1627e0][_0x0408('0x17')]);var _0x280e0d=getUserApplications(_0x40ea29,_0x20907a[_0x1627e0],_0x20907a[_0x1627e0][_0x0408('0x13')]);_0x3b8608=_0x3b8608['concat'](_0x2bebc8,_0x280e0d);}return _0x3b8608;};var getChanSpyPromise=function(_0x682e47,_0x2df694){return new BPromise(function(_0x4e9bf4,_0xfe94b){return _0x682e47[_0x0408('0x18')]['findAll']({'attributes':['id',_0x0408('0x13'),_0x0408('0x17')],'where':{'role':_0x0408('0x19'),'chanspy':!![]},'raw':!![]})[_0x0408('0x1a')](function(_0xc76bbc){if(_0xc76bbc){return _0x4e9bf4(getChanSpyApplications(_0x2df694,_0xc76bbc));}return _0x4e9bf4([]);})[_0x0408('0x1b')](function(_0x3dccc6){_0xfe94b(_0x3dccc6);});});};module[_0x0408('0x1c')]=function(_0x501eff,_0x344d19){var _0x38c221=_0x501eff[_0x0408('0x1d')];return _0x501eff[_0x0408('0x1e')](_0x0408('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3239a0,_0x545869,_0x488f43){return getChanSpyPromise(_0x38c221,_0x3239a0)[_0x0408('0x1a')](function(_0x4b5d0f){if(_0x4b5d0f&&_0x4b5d0f[_0x0408('0x16')]){return _0x38c221[_0x0408('0x20')]['bulkCreate'](_0x4b5d0f);}})['then'](function(){_0x488f43();})['catch'](function(_0x538812){_0x488f43(_0x538812);});},'afterUpdate':function(_0x1d0c2b,_0x27e4be,_0x54d49b){return _0x38c221[_0x0408('0x20')][_0x0408('0x21')]({'where':{'ChanSpyId':_0x1d0c2b['id']}})[_0x0408('0x1a')](function(){return getChanSpyPromise(_0x38c221,_0x1d0c2b);})[_0x0408('0x1a')](function(_0x57f189){if(_0x57f189&&_0x57f189['length']){return _0x38c221[_0x0408('0x20')][_0x0408('0x22')](_0x57f189);}})['then'](function(){_0x54d49b();})[_0x0408('0x1b')](function(_0x28c14b){_0x54d49b(_0x28c14b);});},'afterDestroy':function(_0x5a5d35,_0x116e47,_0x43bcb8){return _0x38c221[_0x0408('0x20')]['destroy']({'where':{'ChanSpyId':_0x5a5d35['id']}})[_0x0408('0x1a')](function(){_0x43bcb8();})[_0x0408('0x1b')](function(_0x29c978){_0x43bcb8(_0x29c978);});}}});};
\ No newline at end of file