Built motion from commit (unavailable).|2.3.4
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.model.js
index 949bd33..ca6f16c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb3a8=['chanspy','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','record','StopMixMonitor','internal','concat','User','findAll','agent','then','catch','exports','models','define','voice_chanspy','length','bulkCreate','destroy','VoiceExtension','lodash','util','../../config/logger','api','./voiceChanSpy.attributes','system','format','%s%s','prefix','push','merge','Set','CDR(type)=%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb3a8,0x1a0));var _0x8b3a=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xb3a8[_0x243217];return _0x478029;};'use strict';var _=require(_0x8b3a('0x0'));var util=require(_0x8b3a('0x1'));var BPromise=require('bluebird');var logger=require(_0x8b3a('0x2'))(_0x8b3a('0x3'));var attributes=require(_0x8b3a('0x4'));var getUserApplications=function(_0x5bfbec,_0x4faecb,_0x11eaf0){var _0x17ee49=0x1;var _0x5eb79d=[];var _0x1b4b81={'context':'from-sip','type':_0x8b3a('0x5'),'isApp':![]};var _0x1baf76={'exten':util[_0x8b3a('0x6')](_0x8b3a('0x7'),_0x5bfbec[_0x8b3a('0x8')],_0x11eaf0),'ChanSpyId':_0x5bfbec['id'],'UserId':_0x4faecb['id']};_0x5eb79d[_0x8b3a('0x9')](_[_0x8b3a('0xa')]({'app':_0x8b3a('0xb'),'appdata':util[_0x8b3a('0x6')](_0x8b3a('0xc'),_0x8b3a('0xd')),'priority':_0x17ee49++},_0x1b4b81,_0x1baf76));if(_0x5bfbec['record']){_0x5eb79d[_0x8b3a('0x9')](_['merge']({'app':'MixMonitor','appdata':util['format']('${UNIQUEID}.%s,ab',_0x5bfbec[_0x8b3a('0xe')]),'priority':_0x17ee49++},_0x1b4b81,_0x1baf76));}if(_0x5bfbec[_0x8b3a('0xf')]){_0x5eb79d[_0x8b3a('0x9')](_[_0x8b3a('0xa')]({'app':_0x8b3a('0x10'),'appdata':_0x5bfbec[_0x8b3a('0x11')],'priority':_0x17ee49++},_0x1b4b81,_0x1baf76));}_0x5eb79d[_0x8b3a('0x9')](_['merge']({'app':_0x8b3a('0x12'),'appdata':util[_0x8b3a('0x6')]('SIP/%s,%s',_0x4faecb[_0x8b3a('0x13')],_0x5bfbec[_0x8b3a('0x14')]?_0x5bfbec['options'][_0x8b3a('0x15')](''):''),'priority':_0x17ee49++},_0x1b4b81,_0x1baf76));if(_0x5bfbec[_0x8b3a('0x16')]){_0x5eb79d[_0x8b3a('0x9')](_[_0x8b3a('0xa')]({'app':_0x8b3a('0x17'),'priority':_0x17ee49++},_0x1b4b81,_0x1baf76));}return _0x5eb79d;};var getChanSpyApplications=function(_0x15089d,_0x1ec664){var _0x483a77=[];for(var _0x3aceb8=0x0,_0x3fedb6=0x1;_0x3aceb8<_0x1ec664['length'];_0x3aceb8++,_0x3fedb6=0x1){var _0x4d63b3=getUserApplications(_0x15089d,_0x1ec664[_0x3aceb8],_0x1ec664[_0x3aceb8][_0x8b3a('0x18')]);var _0x366d0f=getUserApplications(_0x15089d,_0x1ec664[_0x3aceb8],_0x1ec664[_0x3aceb8][_0x8b3a('0x13')]);_0x483a77=_0x483a77[_0x8b3a('0x19')](_0x4d63b3,_0x366d0f);}return _0x483a77;};var getChanSpyPromise=function(_0x441102,_0x5aa54f){return new BPromise(function(_0x192356,_0x4a1e72){return _0x441102[_0x8b3a('0x1a')][_0x8b3a('0x1b')]({'attributes':['id',_0x8b3a('0x13'),_0x8b3a('0x18')],'where':{'role':_0x8b3a('0x1c'),'chanspy':!![]},'raw':!![]})[_0x8b3a('0x1d')](function(_0x172a35){if(_0x172a35){return _0x192356(getChanSpyApplications(_0x5aa54f,_0x172a35));}return _0x192356([]);})[_0x8b3a('0x1e')](function(_0xe55fa5){_0x4a1e72(_0xe55fa5);});});};module[_0x8b3a('0x1f')]=function(_0xcef4a5,_0x582576){var _0x27e3db=_0xcef4a5[_0x8b3a('0x20')];return _0xcef4a5[_0x8b3a('0x21')]('VoiceChanSpy',attributes,{'tableName':_0x8b3a('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x38bdea,_0x47284d,_0x4ccdc7){return getChanSpyPromise(_0x27e3db,_0x38bdea)['then'](function(_0x52c645){if(_0x52c645&&_0x52c645[_0x8b3a('0x23')]){return _0x27e3db['VoiceExtension'][_0x8b3a('0x24')](_0x52c645);}})['then'](function(){_0x4ccdc7();})[_0x8b3a('0x1e')](function(_0x3464c7){_0x4ccdc7(_0x3464c7);});},'afterUpdate':function(_0x404ef6,_0x21316a,_0x1be4aa){return _0x27e3db['VoiceExtension'][_0x8b3a('0x25')]({'where':{'ChanSpyId':_0x404ef6['id']}})[_0x8b3a('0x1d')](function(){return getChanSpyPromise(_0x27e3db,_0x404ef6);})['then'](function(_0x3349c1){if(_0x3349c1&&_0x3349c1[_0x8b3a('0x23')]){return _0x27e3db[_0x8b3a('0x26')][_0x8b3a('0x24')](_0x3349c1);}})['then'](function(){_0x1be4aa();})[_0x8b3a('0x1e')](function(_0x2aa422){_0x1be4aa(_0x2aa422);});},'afterDestroy':function(_0x1671be,_0x334935,_0x4620f1){return _0x27e3db[_0x8b3a('0x26')][_0x8b3a('0x25')]({'where':{'ChanSpyId':_0x1671be['id']}})[_0x8b3a('0x1d')](function(){_0x4620f1();})[_0x8b3a('0x1e')](function(_0x1b25c9){_0x4620f1(_0x1b25c9);});}}});};
\ No newline at end of file
+var _0xc36e=['recordingFormat','auth','SIP/%s,%s','name','options','StopMixMonitor','length','internal','concat','findAll','agent','exports','define','voice_chanspy','then','bulkCreate','catch','VoiceExtension','destroy','util','../../config/logger','api','./voiceChanSpy.attributes','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,ab'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0xc36e,0x79));var _0xec36=function(_0x22a8c4,_0x51c09a){_0x22a8c4=_0x22a8c4-0x0;var _0x104c6d=_0xc36e[_0x22a8c4];return _0x104c6d;};'use strict';var _=require('lodash');var util=require(_0xec36('0x0'));var BPromise=require('bluebird');var logger=require(_0xec36('0x1'))(_0xec36('0x2'));var attributes=require(_0xec36('0x3'));var getUserApplications=function(_0x1d2bed,_0x448fe3,_0x86293e){var _0x502d5f=0x1;var _0x276319=[];var _0xb3de6={'context':'from-sip','type':'system','isApp':![]};var _0xa8c6d8={'exten':util[_0xec36('0x4')](_0xec36('0x5'),_0x1d2bed[_0xec36('0x6')],_0x86293e),'ChanSpyId':_0x1d2bed['id'],'UserId':_0x448fe3['id']};_0x276319[_0xec36('0x7')](_[_0xec36('0x8')]({'app':_0xec36('0x9'),'appdata':util[_0xec36('0x4')](_0xec36('0xa'),_0xec36('0xb')),'priority':_0x502d5f++},_0xb3de6,_0xa8c6d8));if(_0x1d2bed[_0xec36('0xc')]){_0x276319['push'](_[_0xec36('0x8')]({'app':_0xec36('0xd'),'appdata':util[_0xec36('0x4')](_0xec36('0xe'),_0x1d2bed[_0xec36('0xf')]),'priority':_0x502d5f++},_0xb3de6,_0xa8c6d8));}if(_0x1d2bed[_0xec36('0x10')]){_0x276319['push'](_['merge']({'app':'Authenticate','appdata':_0x1d2bed['password'],'priority':_0x502d5f++},_0xb3de6,_0xa8c6d8));}_0x276319['push'](_['merge']({'app':'ChanSpy','appdata':util[_0xec36('0x4')](_0xec36('0x11'),_0x448fe3[_0xec36('0x12')],_0x1d2bed['options']?_0x1d2bed[_0xec36('0x13')]['join'](''):''),'priority':_0x502d5f++},_0xb3de6,_0xa8c6d8));if(_0x1d2bed[_0xec36('0xc')]){_0x276319[_0xec36('0x7')](_[_0xec36('0x8')]({'app':_0xec36('0x14'),'priority':_0x502d5f++},_0xb3de6,_0xa8c6d8));}return _0x276319;};var getChanSpyApplications=function(_0x569320,_0x150b25){var _0x2b9103=[];for(var _0x5a42d9=0x0,_0x1fb059=0x1;_0x5a42d9<_0x150b25[_0xec36('0x15')];_0x5a42d9++,_0x1fb059=0x1){var _0x5bcd60=getUserApplications(_0x569320,_0x150b25[_0x5a42d9],_0x150b25[_0x5a42d9][_0xec36('0x16')]);var _0x8315f4=getUserApplications(_0x569320,_0x150b25[_0x5a42d9],_0x150b25[_0x5a42d9][_0xec36('0x12')]);_0x2b9103=_0x2b9103[_0xec36('0x17')](_0x5bcd60,_0x8315f4);}return _0x2b9103;};var getChanSpyPromise=function(_0x204455,_0x4bdb11){return new BPromise(function(_0x5613ad,_0x53d77f){return _0x204455['User'][_0xec36('0x18')]({'attributes':['id',_0xec36('0x12'),'internal'],'where':{'role':_0xec36('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x31f17a){if(_0x31f17a){return _0x5613ad(getChanSpyApplications(_0x4bdb11,_0x31f17a));}return _0x5613ad([]);})['catch'](function(_0x292ba8){_0x53d77f(_0x292ba8);});});};module[_0xec36('0x1a')]=function(_0x2706a3,_0x4b9a3b){var _0xd635f5=_0x2706a3['models'];return _0x2706a3[_0xec36('0x1b')]('VoiceChanSpy',attributes,{'tableName':_0xec36('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x41208f,_0x16b8c5,_0x4dd753){return getChanSpyPromise(_0xd635f5,_0x41208f)[_0xec36('0x1d')](function(_0x2c2b14){if(_0x2c2b14&&_0x2c2b14['length']){return _0xd635f5['VoiceExtension'][_0xec36('0x1e')](_0x2c2b14);}})[_0xec36('0x1d')](function(){_0x4dd753();})[_0xec36('0x1f')](function(_0x5e76e9){_0x4dd753(_0x5e76e9);});},'afterUpdate':function(_0x1701eb,_0x2bbf95,_0x1586f4){return _0xd635f5[_0xec36('0x20')][_0xec36('0x21')]({'where':{'ChanSpyId':_0x1701eb['id']}})[_0xec36('0x1d')](function(){return getChanSpyPromise(_0xd635f5,_0x1701eb);})[_0xec36('0x1d')](function(_0x2fd630){if(_0x2fd630&&_0x2fd630['length']){return _0xd635f5[_0xec36('0x20')]['bulkCreate'](_0x2fd630);}})[_0xec36('0x1d')](function(){_0x1586f4();})['catch'](function(_0x12b78b){_0x1586f4(_0x12b78b);});},'afterDestroy':function(_0x1b85f7,_0x1a2bd4,_0x16ab39){return _0xd635f5[_0xec36('0x20')][_0xec36('0x21')]({'where':{'ChanSpyId':_0x1b85f7['id']}})['then'](function(){_0x16ab39();})[_0xec36('0x1f')](function(_0x1c59f3){_0x16ab39(_0x1c59f3);});}}});};
\ No newline at end of file