Built motion from commit 47436d59.|2.6.7
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.model.js
index 7bcf81c..32978d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b1b=['options','join','length','concat','internal','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','then','destroy','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','chanspy','record','merge','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name'];(function(_0x4c49ef,_0x2a2ac4){var _0x168b85=function(_0x38daf7){while(--_0x38daf7){_0x4c49ef['push'](_0x4c49ef['shift']());}};_0x168b85(++_0x2a2ac4);}(_0x1b1b,0x1a2));var _0xb1b1=function(_0x29b8c1,_0x20140f){_0x29b8c1=_0x29b8c1-0x0;var _0xda1c47=_0x1b1b[_0x29b8c1];return _0xda1c47;};'use strict';var _=require('lodash');var util=require(_0xb1b1('0x0'));var BPromise=require('bluebird');var attributes=require(_0xb1b1('0x1'));var getUserApplications=function(_0x3b5f2f,_0x185d6f,_0x308c1b){var _0x8c4ac0=0x1;var _0x56fec1=[];var _0x2131c8={'context':_0x185d6f[_0xb1b1('0x2')]||_0xb1b1('0x3'),'exten':util[_0xb1b1('0x4')](_0xb1b1('0x5'),_0x3b5f2f[_0xb1b1('0x6')],_0x308c1b),'type':_0xb1b1('0x7'),'isApp':![],'ChanSpyId':_0x3b5f2f['id'],'UserId':_0x185d6f['id']};_0x56fec1[_0xb1b1('0x8')](_['merge']({'app':_0xb1b1('0x9'),'appdata':util[_0xb1b1('0x4')](_0xb1b1('0xa'),_0xb1b1('0xb')),'priority':_0x8c4ac0++},_0x2131c8));if(_0x3b5f2f[_0xb1b1('0xc')]){_0x56fec1[_0xb1b1('0x8')](_[_0xb1b1('0xd')]({'app':'MixMonitor','appdata':util[_0xb1b1('0x4')](_0xb1b1('0xe'),_0x3b5f2f[_0xb1b1('0xf')]),'priority':_0x8c4ac0++},_0x2131c8));}if(_0x3b5f2f[_0xb1b1('0x10')]){_0x56fec1[_0xb1b1('0x8')](_['merge']({'app':_0xb1b1('0x11'),'appdata':_0x3b5f2f[_0xb1b1('0x12')],'priority':_0x8c4ac0++},_0x2131c8));}_0x56fec1[_0xb1b1('0x8')](_[_0xb1b1('0xd')]({'app':_0xb1b1('0x13'),'appdata':util[_0xb1b1('0x4')](_0xb1b1('0x14'),_0x185d6f[_0xb1b1('0x15')],_0x3b5f2f[_0xb1b1('0x16')]?_0x3b5f2f[_0xb1b1('0x16')][_0xb1b1('0x17')](''):''),'priority':_0x8c4ac0++},_0x2131c8));if(_0x3b5f2f[_0xb1b1('0xc')]){_0x56fec1[_0xb1b1('0x8')](_[_0xb1b1('0xd')]({'app':'StopMixMonitor','priority':_0x8c4ac0++},_0x2131c8));}return _0x56fec1;};var getChanSpyApplications=function(_0x15e262,_0x23f440){var _0x4c6230=[];for(var _0x32b441=0x0,_0x5551e2=0x1;_0x32b441<_0x23f440[_0xb1b1('0x18')];_0x32b441++,_0x5551e2=0x1){_0x4c6230=_0x4c6230[_0xb1b1('0x19')](getUserApplications(_0x15e262,_0x23f440[_0x32b441],_0x23f440[_0x32b441][_0xb1b1('0x1a')]));if(_0x23f440[_0x32b441][_0xb1b1('0x1a')]!=_0x23f440[_0x32b441][_0xb1b1('0x15')]){_0x4c6230=_0x4c6230[_0xb1b1('0x19')](getUserApplications(_0x15e262,_0x23f440[_0x32b441],_0x23f440[_0x32b441]['name']));}}return _0x4c6230;};var getChanSpyPromise=function(_0x3de52b,_0x532a3c){return new BPromise(function(_0x10f89b,_0x50d8cd){return _0x3de52b[_0xb1b1('0x1b')][_0xb1b1('0x1c')]({'attributes':['id',_0xb1b1('0x15'),'internal'],'where':{'role':_0xb1b1('0x1d'),'chanspy':!![]},'raw':!![]})['then'](function(_0x562113){if(_0x562113){return _0x10f89b(getChanSpyApplications(_0x532a3c,_0x562113));}return _0x10f89b([]);})[_0xb1b1('0x1e')](function(_0x377022){_0x50d8cd(_0x377022);});});};module[_0xb1b1('0x1f')]=function(_0x5e4edc,_0x508948){var _0x4e5c18=_0x5e4edc[_0xb1b1('0x20')];return _0x5e4edc[_0xb1b1('0x21')](_0xb1b1('0x22'),attributes,{'tableName':_0xb1b1('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f3948,_0x548ebe,_0x1fd1e6){return getChanSpyPromise(_0x4e5c18,_0x4f3948)['then'](function(_0x53e7b9){if(_0x53e7b9&&_0x53e7b9[_0xb1b1('0x18')]){return _0x4e5c18[_0xb1b1('0x24')][_0xb1b1('0x25')](_0x53e7b9);}})['then'](function(){_0x1fd1e6();})[_0xb1b1('0x1e')](function(_0x415f7){_0x1fd1e6(_0x415f7);});},'afterUpdate':function(_0x8eb6f8,_0x1eed24,_0xa5475c){return _0x4e5c18['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x8eb6f8['id']}})[_0xb1b1('0x26')](function(){return getChanSpyPromise(_0x4e5c18,_0x8eb6f8);})[_0xb1b1('0x26')](function(_0xc58b0f){if(_0xc58b0f&&_0xc58b0f[_0xb1b1('0x18')]){return _0x4e5c18[_0xb1b1('0x24')]['bulkCreate'](_0xc58b0f);}})[_0xb1b1('0x26')](function(){_0xa5475c();})[_0xb1b1('0x1e')](function(_0x5329e7){_0xa5475c(_0x5329e7);});},'afterDestroy':function(_0x51b0de,_0x5d9233,_0x4bea0){return _0x4e5c18[_0xb1b1('0x24')][_0xb1b1('0x27')]({'where':{'ChanSpyId':_0x51b0de['id']}})[_0xb1b1('0x26')](function(){_0x4bea0();})[_0xb1b1('0x1e')](function(_0x4d988d){_0x4bea0(_0x4d988d);});}}});};
\ No newline at end of file
+var _0x90f7=['format','%s%s','prefix','system','merge','Set','CDR(type)=%s','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','findAll','agent','then','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','from-sip'];(function(_0x4197ad,_0x1d252e){var _0x24a66a=function(_0x3ed1c5){while(--_0x3ed1c5){_0x4197ad['push'](_0x4197ad['shift']());}};_0x24a66a(++_0x1d252e);}(_0x90f7,0xba));var _0x790f=function(_0x49cee9,_0x28e9de){_0x49cee9=_0x49cee9-0x0;var _0x5c896d=_0x90f7[_0x49cee9];return _0x5c896d;};'use strict';var _=require(_0x790f('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x790f('0x1'));var getUserApplications=function(_0x165015,_0x2041f4,_0x3195a0){var _0xf51350=0x1;var _0x4fbff=[];var _0x11da23={'context':_0x2041f4[_0x790f('0x2')]||_0x790f('0x3'),'exten':util[_0x790f('0x4')](_0x790f('0x5'),_0x165015[_0x790f('0x6')],_0x3195a0),'type':_0x790f('0x7'),'isApp':![],'ChanSpyId':_0x165015['id'],'UserId':_0x2041f4['id']};_0x4fbff['push'](_[_0x790f('0x8')]({'app':_0x790f('0x9'),'appdata':util[_0x790f('0x4')](_0x790f('0xa'),'chanspy'),'priority':_0xf51350++},_0x11da23));if(_0x165015[_0x790f('0xb')]){_0x4fbff[_0x790f('0xc')](_[_0x790f('0x8')]({'app':_0x790f('0xd'),'appdata':util['format'](_0x790f('0xe'),_0x165015[_0x790f('0xf')]),'priority':_0xf51350++},_0x11da23));}if(_0x165015[_0x790f('0x10')]){_0x4fbff[_0x790f('0xc')](_[_0x790f('0x8')]({'app':_0x790f('0x11'),'appdata':_0x165015[_0x790f('0x12')],'priority':_0xf51350++},_0x11da23));}_0x4fbff[_0x790f('0xc')](_[_0x790f('0x8')]({'app':_0x790f('0x13'),'appdata':util[_0x790f('0x4')](_0x790f('0x14'),_0x2041f4[_0x790f('0x15')],_0x165015[_0x790f('0x16')]?_0x165015['options'][_0x790f('0x17')](''):''),'priority':_0xf51350++},_0x11da23));if(_0x165015[_0x790f('0xb')]){_0x4fbff[_0x790f('0xc')](_[_0x790f('0x8')]({'app':_0x790f('0x18'),'priority':_0xf51350++},_0x11da23));}return _0x4fbff;};var getChanSpyApplications=function(_0x4fc000,_0x59ba5d){var _0x1fa417=[];for(var _0x17d59c=0x0,_0x5c3db3=0x1;_0x17d59c<_0x59ba5d[_0x790f('0x19')];_0x17d59c++,_0x5c3db3=0x1){_0x1fa417=_0x1fa417['concat'](getUserApplications(_0x4fc000,_0x59ba5d[_0x17d59c],_0x59ba5d[_0x17d59c][_0x790f('0x1a')]));if(_0x59ba5d[_0x17d59c]['internal']!=_0x59ba5d[_0x17d59c][_0x790f('0x15')]){_0x1fa417=_0x1fa417['concat'](getUserApplications(_0x4fc000,_0x59ba5d[_0x17d59c],_0x59ba5d[_0x17d59c][_0x790f('0x15')]));}}return _0x1fa417;};var getChanSpyPromise=function(_0x5dd652,_0x51c2d2){return new BPromise(function(_0x330134,_0x336943){return _0x5dd652['User'][_0x790f('0x1b')]({'attributes':['id',_0x790f('0x15'),_0x790f('0x1a')],'where':{'role':_0x790f('0x1c'),'chanspy':!![]},'raw':!![]})[_0x790f('0x1d')](function(_0x478e8e){if(_0x478e8e){return _0x330134(getChanSpyApplications(_0x51c2d2,_0x478e8e));}return _0x330134([]);})[_0x790f('0x1e')](function(_0x578092){_0x336943(_0x578092);});});};module[_0x790f('0x1f')]=function(_0x1c8306,_0x1645de){var _0x5e74f2=_0x1c8306[_0x790f('0x20')];return _0x1c8306[_0x790f('0x21')]('VoiceChanSpy',attributes,{'tableName':_0x790f('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xf00736,_0x28d46c,_0x42b471){return getChanSpyPromise(_0x5e74f2,_0xf00736)[_0x790f('0x1d')](function(_0x30924b){if(_0x30924b&&_0x30924b[_0x790f('0x19')]){return _0x5e74f2[_0x790f('0x23')][_0x790f('0x24')](_0x30924b);}})[_0x790f('0x1d')](function(){_0x42b471();})[_0x790f('0x1e')](function(_0x17522e){_0x42b471(_0x17522e);});},'afterUpdate':function(_0x56b722,_0x1cb69a,_0x1a341a){return _0x5e74f2[_0x790f('0x23')][_0x790f('0x25')]({'where':{'ChanSpyId':_0x56b722['id']}})[_0x790f('0x1d')](function(){return getChanSpyPromise(_0x5e74f2,_0x56b722);})[_0x790f('0x1d')](function(_0x2c1e01){if(_0x2c1e01&&_0x2c1e01[_0x790f('0x19')]){return _0x5e74f2[_0x790f('0x23')]['bulkCreate'](_0x2c1e01);}})[_0x790f('0x1d')](function(){_0x1a341a();})[_0x790f('0x1e')](function(_0x2b9a8e){_0x1a341a(_0x2b9a8e);});},'afterDestroy':function(_0x4bd57b,_0xaf08a5,_0x18c976){return _0x5e74f2[_0x790f('0x23')][_0x790f('0x25')]({'where':{'ChanSpyId':_0x4bd57b['id']}})['then'](function(){_0x18c976();})['catch'](function(_0x1af4f4){_0x18c976(_0x1af4f4);});}}});};
\ No newline at end of file