Built motion from commit 980b26c3.|2.6.29
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.model.js
index 77f9b72..b026afb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdf8d=['join','length','internal','concat','User','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','chanspy','record','MixMonitor','auth','Authenticate','password','ChanSpy','name','options'];(function(_0x570221,_0x4185f5){var _0x535449=function(_0x4f9284){while(--_0x4f9284){_0x570221['push'](_0x570221['shift']());}};_0x535449(++_0x4185f5);}(_0xdf8d,0x19c));var _0xddf8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdf8d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xddf8('0x0'));var util=require(_0xddf8('0x1'));var BPromise=require(_0xddf8('0x2'));var attributes=require(_0xddf8('0x3'));var getUserApplications=function(_0x2c2859,_0x4f17ca,_0x355f19){var _0x2f6cd5=0x1;var _0x1346ef=[];var _0x5c59f1={'context':_0x4f17ca[_0xddf8('0x4')]||_0xddf8('0x5'),'exten':util[_0xddf8('0x6')](_0xddf8('0x7'),_0x2c2859[_0xddf8('0x8')],_0x355f19),'type':'system','isApp':![],'ChanSpyId':_0x2c2859['id'],'UserId':_0x4f17ca['id']};_0x1346ef[_0xddf8('0x9')](_[_0xddf8('0xa')]({'app':'Set','appdata':util[_0xddf8('0x6')]('CDR(type)=%s',_0xddf8('0xb')),'priority':_0x2f6cd5++},_0x5c59f1));if(_0x2c2859[_0xddf8('0xc')]){_0x1346ef[_0xddf8('0x9')](_[_0xddf8('0xa')]({'app':_0xddf8('0xd'),'appdata':util[_0xddf8('0x6')]('${UNIQUEID}.%s,a',_0x2c2859['recordingFormat']),'priority':_0x2f6cd5++},_0x5c59f1));}if(_0x2c2859[_0xddf8('0xe')]){_0x1346ef[_0xddf8('0x9')](_[_0xddf8('0xa')]({'app':_0xddf8('0xf'),'appdata':_0x2c2859[_0xddf8('0x10')],'priority':_0x2f6cd5++},_0x5c59f1));}_0x1346ef[_0xddf8('0x9')](_['merge']({'app':_0xddf8('0x11'),'appdata':util[_0xddf8('0x6')]('SIP/%s,%s',_0x4f17ca[_0xddf8('0x12')],_0x2c2859['options']?_0x2c2859[_0xddf8('0x13')][_0xddf8('0x14')](''):''),'priority':_0x2f6cd5++},_0x5c59f1));if(_0x2c2859[_0xddf8('0xc')]){_0x1346ef[_0xddf8('0x9')](_[_0xddf8('0xa')]({'app':'StopMixMonitor','priority':_0x2f6cd5++},_0x5c59f1));}return _0x1346ef;};var getChanSpyApplications=function(_0x2ceea4,_0x1ed6b9){var _0x482aac=[];for(var _0x38f3cd=0x0,_0x395869=0x1;_0x38f3cd<_0x1ed6b9[_0xddf8('0x15')];_0x38f3cd++,_0x395869=0x1){_0x482aac=_0x482aac['concat'](getUserApplications(_0x2ceea4,_0x1ed6b9[_0x38f3cd],_0x1ed6b9[_0x38f3cd][_0xddf8('0x16')]));if(_0x1ed6b9[_0x38f3cd]['internal']!=_0x1ed6b9[_0x38f3cd][_0xddf8('0x12')]){_0x482aac=_0x482aac[_0xddf8('0x17')](getUserApplications(_0x2ceea4,_0x1ed6b9[_0x38f3cd],_0x1ed6b9[_0x38f3cd][_0xddf8('0x12')]));}}return _0x482aac;};var getChanSpyPromise=function(_0x43f693,_0x429bf1){return new BPromise(function(_0x44d0e8,_0x153579){return _0x43f693[_0xddf8('0x18')][_0xddf8('0x19')]({'attributes':['id',_0xddf8('0x12'),'internal'],'where':{'role':_0xddf8('0x1a'),'chanspy':!![]},'raw':!![]})[_0xddf8('0x1b')](function(_0x2097e9){if(_0x2097e9){return _0x44d0e8(getChanSpyApplications(_0x429bf1,_0x2097e9));}return _0x44d0e8([]);})[_0xddf8('0x1c')](function(_0x1067ab){_0x153579(_0x1067ab);});});};module['exports']=function(_0x218d47,_0x2bc76e){var _0x1c6bc8=_0x218d47[_0xddf8('0x1d')];return _0x218d47[_0xddf8('0x1e')](_0xddf8('0x1f'),attributes,{'tableName':_0xddf8('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ba5fb,_0x1951af,_0x1f8b85){return getChanSpyPromise(_0x1c6bc8,_0x3ba5fb)[_0xddf8('0x1b')](function(_0x272e47){if(_0x272e47&&_0x272e47[_0xddf8('0x15')]){return _0x1c6bc8[_0xddf8('0x21')]['bulkCreate'](_0x272e47);}})[_0xddf8('0x1b')](function(){_0x1f8b85();})['catch'](function(_0x5bb1ad){_0x1f8b85(_0x5bb1ad);});},'afterUpdate':function(_0x290193,_0x390327,_0x25b163){return _0x1c6bc8['VoiceExtension'][_0xddf8('0x22')]({'where':{'ChanSpyId':_0x290193['id']}})[_0xddf8('0x1b')](function(){return getChanSpyPromise(_0x1c6bc8,_0x290193);})[_0xddf8('0x1b')](function(_0xbf111d){if(_0xbf111d&&_0xbf111d[_0xddf8('0x15')]){return _0x1c6bc8[_0xddf8('0x21')][_0xddf8('0x23')](_0xbf111d);}})['then'](function(){_0x25b163();})[_0xddf8('0x1c')](function(_0x48b4fe){_0x25b163(_0x48b4fe);});},'afterDestroy':function(_0x1188e9,_0x26907e,_0x14df47){return _0x1c6bc8[_0xddf8('0x21')][_0xddf8('0x22')]({'where':{'ChanSpyId':_0x1188e9['id']}})['then'](function(){_0x14df47();})[_0xddf8('0x1c')](function(_0x11cf38){_0x14df47(_0x11cf38);});}}});};
\ No newline at end of file
+var _0xdfff=['name','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','VoiceExtension','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','chanspy','record','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdfff,0x169));var _0xfdff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdfff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfdff('0x0'));var util=require(_0xfdff('0x1'));var BPromise=require(_0xfdff('0x2'));var attributes=require(_0xfdff('0x3'));var getUserApplications=function(_0x7fb161,_0x5e3fb0,_0x41d041){var _0x2ed92f=0x1;var _0x391b14=[];var _0x1e8c63={'context':_0x5e3fb0[_0xfdff('0x4')]||_0xfdff('0x5'),'exten':util[_0xfdff('0x6')](_0xfdff('0x7'),_0x7fb161[_0xfdff('0x8')],_0x41d041),'type':'system','isApp':![],'ChanSpyId':_0x7fb161['id'],'UserId':_0x5e3fb0['id']};_0x391b14[_0xfdff('0x9')](_[_0xfdff('0xa')]({'app':'Set','appdata':util[_0xfdff('0x6')]('CDR(type)=%s',_0xfdff('0xb')),'priority':_0x2ed92f++},_0x1e8c63));if(_0x7fb161[_0xfdff('0xc')]){_0x391b14[_0xfdff('0x9')](_[_0xfdff('0xa')]({'app':'MixMonitor','appdata':util[_0xfdff('0x6')](_0xfdff('0xd'),_0x7fb161['recordingFormat']),'priority':_0x2ed92f++},_0x1e8c63));}if(_0x7fb161[_0xfdff('0xe')]){_0x391b14[_0xfdff('0x9')](_[_0xfdff('0xa')]({'app':'Authenticate','appdata':_0x7fb161[_0xfdff('0xf')],'priority':_0x2ed92f++},_0x1e8c63));}_0x391b14[_0xfdff('0x9')](_['merge']({'app':_0xfdff('0x10'),'appdata':util[_0xfdff('0x6')](_0xfdff('0x11'),_0x5e3fb0['name'],_0x7fb161[_0xfdff('0x12')]?_0x7fb161[_0xfdff('0x12')][_0xfdff('0x13')](''):''),'priority':_0x2ed92f++},_0x1e8c63));if(_0x7fb161[_0xfdff('0xc')]){_0x391b14['push'](_[_0xfdff('0xa')]({'app':_0xfdff('0x14'),'priority':_0x2ed92f++},_0x1e8c63));}return _0x391b14;};var getChanSpyApplications=function(_0x4a6312,_0x580ce8){var _0x28e645=[];for(var _0x560869=0x0,_0x48a245=0x1;_0x560869<_0x580ce8[_0xfdff('0x15')];_0x560869++,_0x48a245=0x1){_0x28e645=_0x28e645[_0xfdff('0x16')](getUserApplications(_0x4a6312,_0x580ce8[_0x560869],_0x580ce8[_0x560869][_0xfdff('0x17')]));if(_0x580ce8[_0x560869][_0xfdff('0x17')]!=_0x580ce8[_0x560869][_0xfdff('0x18')]){_0x28e645=_0x28e645['concat'](getUserApplications(_0x4a6312,_0x580ce8[_0x560869],_0x580ce8[_0x560869][_0xfdff('0x18')]));}}return _0x28e645;};var getChanSpyPromise=function(_0x3dd80a,_0x338e51){return new BPromise(function(_0x516eb1,_0x2d17da){return _0x3dd80a[_0xfdff('0x19')][_0xfdff('0x1a')]({'attributes':['id','name','internal'],'where':{'role':_0xfdff('0x1b'),'chanspy':!![]},'raw':!![]})[_0xfdff('0x1c')](function(_0x5d9516){if(_0x5d9516){return _0x516eb1(getChanSpyApplications(_0x338e51,_0x5d9516));}return _0x516eb1([]);})[_0xfdff('0x1d')](function(_0x340a89){_0x2d17da(_0x340a89);});});};module[_0xfdff('0x1e')]=function(_0x469591,_0x5478ca){var _0x1f0d1d=_0x469591['models'];return _0x469591[_0xfdff('0x1f')](_0xfdff('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x24f0ba,_0xa23216,_0x160413){return getChanSpyPromise(_0x1f0d1d,_0x24f0ba)['then'](function(_0x12735d){if(_0x12735d&&_0x12735d[_0xfdff('0x15')]){return _0x1f0d1d[_0xfdff('0x21')][_0xfdff('0x22')](_0x12735d);}})[_0xfdff('0x1c')](function(){_0x160413();})['catch'](function(_0x2bfc14){_0x160413(_0x2bfc14);});},'afterUpdate':function(_0x3ca8aa,_0x2c8033,_0x2a90bb){return _0x1f0d1d['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x3ca8aa['id']}})[_0xfdff('0x1c')](function(){return getChanSpyPromise(_0x1f0d1d,_0x3ca8aa);})['then'](function(_0x15bc5f){if(_0x15bc5f&&_0x15bc5f[_0xfdff('0x15')]){return _0x1f0d1d[_0xfdff('0x21')][_0xfdff('0x22')](_0x15bc5f);}})[_0xfdff('0x1c')](function(){_0x2a90bb();})[_0xfdff('0x1d')](function(_0x562d6b){_0x2a90bb(_0x562d6b);});},'afterDestroy':function(_0xfeae57,_0x422f44,_0x2d533c){return _0x1f0d1d[_0xfdff('0x21')]['destroy']({'where':{'ChanSpyId':_0xfeae57['id']}})['then'](function(){_0x2d533c();})[_0xfdff('0x1d')](function(_0x1780c){_0x2d533c(_0x1780c);});}}});};
\ No newline at end of file