Built motion from commit 37e1ed56.|2.6.29
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.model.js
index b00a678..321bf36 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x58ff=['recordingFormat','auth','push','ChanSpy','SIP/%s,%s','options','StopMixMonitor','length','concat','internal','name','findAll','agent','then','catch','models','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','merge','Set','chanspy','record','${UNIQUEID}.%s,a'];(function(_0x1c2517,_0x310fc4){var _0x7661ef=function(_0x165f6c){while(--_0x165f6c){_0x1c2517['push'](_0x1c2517['shift']());}};_0x7661ef(++_0x310fc4);}(_0x58ff,0x1d4));var _0xf58f=function(_0x3e14a3,_0x479d7b){_0x3e14a3=_0x3e14a3-0x0;var _0x3c330d=_0x58ff[_0x3e14a3];return _0x3c330d;};'use strict';var _=require(_0xf58f('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xf58f('0x1'));var getUserApplications=function(_0x495f5a,_0x478a98,_0x4e27d3){var _0x44c8f8=0x1;var _0x7b897e=[];var _0xb0fe10={'context':_0x478a98[_0xf58f('0x2')]||_0xf58f('0x3'),'exten':util[_0xf58f('0x4')](_0xf58f('0x5'),_0x495f5a['prefix'],_0x4e27d3),'type':_0xf58f('0x6'),'isApp':![],'ChanSpyId':_0x495f5a['id'],'UserId':_0x478a98['id']};_0x7b897e['push'](_[_0xf58f('0x7')]({'app':_0xf58f('0x8'),'appdata':util[_0xf58f('0x4')]('CDR(type)=%s',_0xf58f('0x9')),'priority':_0x44c8f8++},_0xb0fe10));if(_0x495f5a[_0xf58f('0xa')]){_0x7b897e['push'](_[_0xf58f('0x7')]({'app':'MixMonitor','appdata':util[_0xf58f('0x4')](_0xf58f('0xb'),_0x495f5a[_0xf58f('0xc')]),'priority':_0x44c8f8++},_0xb0fe10));}if(_0x495f5a[_0xf58f('0xd')]){_0x7b897e[_0xf58f('0xe')](_[_0xf58f('0x7')]({'app':'Authenticate','appdata':_0x495f5a['password'],'priority':_0x44c8f8++},_0xb0fe10));}_0x7b897e[_0xf58f('0xe')](_[_0xf58f('0x7')]({'app':_0xf58f('0xf'),'appdata':util['format'](_0xf58f('0x10'),_0x478a98['name'],_0x495f5a[_0xf58f('0x11')]?_0x495f5a['options']['join'](''):''),'priority':_0x44c8f8++},_0xb0fe10));if(_0x495f5a['record']){_0x7b897e[_0xf58f('0xe')](_[_0xf58f('0x7')]({'app':_0xf58f('0x12'),'priority':_0x44c8f8++},_0xb0fe10));}return _0x7b897e;};var getChanSpyApplications=function(_0x3d1754,_0x2d6b62){var _0x213497=[];for(var _0x1e6449=0x0,_0x1ce66b=0x1;_0x1e6449<_0x2d6b62[_0xf58f('0x13')];_0x1e6449++,_0x1ce66b=0x1){_0x213497=_0x213497[_0xf58f('0x14')](getUserApplications(_0x3d1754,_0x2d6b62[_0x1e6449],_0x2d6b62[_0x1e6449][_0xf58f('0x15')]));if(_0x2d6b62[_0x1e6449][_0xf58f('0x15')]!=_0x2d6b62[_0x1e6449][_0xf58f('0x16')]){_0x213497=_0x213497[_0xf58f('0x14')](getUserApplications(_0x3d1754,_0x2d6b62[_0x1e6449],_0x2d6b62[_0x1e6449]['name']));}}return _0x213497;};var getChanSpyPromise=function(_0x1c7985,_0x2fa043){return new BPromise(function(_0x389515,_0x2bd328){return _0x1c7985['User'][_0xf58f('0x17')]({'attributes':['id',_0xf58f('0x16'),_0xf58f('0x15')],'where':{'role':_0xf58f('0x18'),'chanspy':!![]},'raw':!![]})[_0xf58f('0x19')](function(_0x1b066c){if(_0x1b066c){return _0x389515(getChanSpyApplications(_0x2fa043,_0x1b066c));}return _0x389515([]);})[_0xf58f('0x1a')](function(_0x2f41ca){_0x2bd328(_0x2f41ca);});});};module['exports']=function(_0x293d5c,_0x5cfcb7){var _0x456319=_0x293d5c[_0xf58f('0x1b')];return _0x293d5c['define']('VoiceChanSpy',attributes,{'tableName':_0xf58f('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d5190,_0x1b805f,_0x406289){return getChanSpyPromise(_0x456319,_0x4d5190)[_0xf58f('0x19')](function(_0x304253){if(_0x304253&&_0x304253[_0xf58f('0x13')]){return _0x456319[_0xf58f('0x1d')][_0xf58f('0x1e')](_0x304253);}})[_0xf58f('0x19')](function(){_0x406289();})[_0xf58f('0x1a')](function(_0x236a24){_0x406289(_0x236a24);});},'afterUpdate':function(_0x17c75d,_0x559ca5,_0x5299d2){return _0x456319['VoiceExtension'][_0xf58f('0x1f')]({'where':{'ChanSpyId':_0x17c75d['id']}})['then'](function(){return getChanSpyPromise(_0x456319,_0x17c75d);})[_0xf58f('0x19')](function(_0x5b0f3f){if(_0x5b0f3f&&_0x5b0f3f[_0xf58f('0x13')]){return _0x456319[_0xf58f('0x1d')]['bulkCreate'](_0x5b0f3f);}})['then'](function(){_0x5299d2();})[_0xf58f('0x1a')](function(_0x6abca7){_0x5299d2(_0x6abca7);});},'afterDestroy':function(_0x2a8807,_0x3519cc,_0x332eb7){return _0x456319[_0xf58f('0x1d')][_0xf58f('0x1f')]({'where':{'ChanSpyId':_0x2a8807['id']}})[_0xf58f('0x19')](function(){_0x332eb7();})[_0xf58f('0x1a')](function(_0x5a0555){_0x332eb7(_0x5a0555);});}}});};
\ No newline at end of file
+var _0x108e=['User','findAll','internal','agent','then','catch','exports','models','define','VoiceChanSpy','length','bulkCreate','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','concat'];(function(_0x571f98,_0x428cdf){var _0x426266=function(_0x34e576){while(--_0x34e576){_0x571f98['push'](_0x571f98['shift']());}};_0x426266(++_0x428cdf);}(_0x108e,0x1c6));var _0xe108=function(_0x3d1af5,_0x3d628f){_0x3d1af5=_0x3d1af5-0x0;var _0x4f9b2e=_0x108e[_0x3d1af5];return _0x4f9b2e;};'use strict';var _=require(_0xe108('0x0'));var util=require(_0xe108('0x1'));var BPromise=require(_0xe108('0x2'));var attributes=require(_0xe108('0x3'));var getUserApplications=function(_0x443a7d,_0x28e4d4,_0x536469){var _0x15f9f6=0x1;var _0x76e9ea=[];var _0x38f03f={'context':_0x28e4d4[_0xe108('0x4')]||_0xe108('0x5'),'exten':util[_0xe108('0x6')](_0xe108('0x7'),_0x443a7d['prefix'],_0x536469),'type':_0xe108('0x8'),'isApp':![],'ChanSpyId':_0x443a7d['id'],'UserId':_0x28e4d4['id']};_0x76e9ea[_0xe108('0x9')](_[_0xe108('0xa')]({'app':'Set','appdata':util[_0xe108('0x6')](_0xe108('0xb'),_0xe108('0xc')),'priority':_0x15f9f6++},_0x38f03f));if(_0x443a7d[_0xe108('0xd')]){_0x76e9ea['push'](_[_0xe108('0xa')]({'app':_0xe108('0xe'),'appdata':util[_0xe108('0x6')](_0xe108('0xf'),_0x443a7d[_0xe108('0x10')]),'priority':_0x15f9f6++},_0x38f03f));}if(_0x443a7d[_0xe108('0x11')]){_0x76e9ea[_0xe108('0x9')](_[_0xe108('0xa')]({'app':_0xe108('0x12'),'appdata':_0x443a7d[_0xe108('0x13')],'priority':_0x15f9f6++},_0x38f03f));}_0x76e9ea[_0xe108('0x9')](_[_0xe108('0xa')]({'app':_0xe108('0x14'),'appdata':util['format'](_0xe108('0x15'),_0x28e4d4[_0xe108('0x16')],_0x443a7d[_0xe108('0x17')]?_0x443a7d['options']['join'](''):''),'priority':_0x15f9f6++},_0x38f03f));if(_0x443a7d['record']){_0x76e9ea[_0xe108('0x9')](_[_0xe108('0xa')]({'app':_0xe108('0x18'),'priority':_0x15f9f6++},_0x38f03f));}return _0x76e9ea;};var getChanSpyApplications=function(_0x44a317,_0x326381){var _0x309bdd=[];for(var _0x390e0f=0x0,_0x3aa8a7=0x1;_0x390e0f<_0x326381['length'];_0x390e0f++,_0x3aa8a7=0x1){_0x309bdd=_0x309bdd[_0xe108('0x19')](getUserApplications(_0x44a317,_0x326381[_0x390e0f],_0x326381[_0x390e0f]['internal']));if(_0x326381[_0x390e0f]['internal']!=_0x326381[_0x390e0f][_0xe108('0x16')]){_0x309bdd=_0x309bdd[_0xe108('0x19')](getUserApplications(_0x44a317,_0x326381[_0x390e0f],_0x326381[_0x390e0f][_0xe108('0x16')]));}}return _0x309bdd;};var getChanSpyPromise=function(_0x538ed8,_0x291046){return new BPromise(function(_0x1ffeac,_0x57abc6){return _0x538ed8[_0xe108('0x1a')][_0xe108('0x1b')]({'attributes':['id',_0xe108('0x16'),_0xe108('0x1c')],'where':{'role':_0xe108('0x1d'),'chanspy':!![]},'raw':!![]})[_0xe108('0x1e')](function(_0x32a609){if(_0x32a609){return _0x1ffeac(getChanSpyApplications(_0x291046,_0x32a609));}return _0x1ffeac([]);})[_0xe108('0x1f')](function(_0x5d99ac){_0x57abc6(_0x5d99ac);});});};module[_0xe108('0x20')]=function(_0x57ce88,_0x5801bc){var _0x731b15=_0x57ce88[_0xe108('0x21')];return _0x57ce88[_0xe108('0x22')](_0xe108('0x23'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a769a,_0x3fed5d,_0xc66524){return getChanSpyPromise(_0x731b15,_0x2a769a)[_0xe108('0x1e')](function(_0x205faa){if(_0x205faa&&_0x205faa[_0xe108('0x24')]){return _0x731b15['VoiceExtension'][_0xe108('0x25')](_0x205faa);}})['then'](function(){_0xc66524();})[_0xe108('0x1f')](function(_0x1f437f){_0xc66524(_0x1f437f);});},'afterUpdate':function(_0x57986e,_0x566b11,_0x26f400){return _0x731b15[_0xe108('0x26')][_0xe108('0x27')]({'where':{'ChanSpyId':_0x57986e['id']}})[_0xe108('0x1e')](function(){return getChanSpyPromise(_0x731b15,_0x57986e);})[_0xe108('0x1e')](function(_0x146fb3){if(_0x146fb3&&_0x146fb3[_0xe108('0x24')]){return _0x731b15['VoiceExtension'][_0xe108('0x25')](_0x146fb3);}})['then'](function(){_0x26f400();})[_0xe108('0x1f')](function(_0x30faf2){_0x26f400(_0x30faf2);});},'afterDestroy':function(_0x131d0c,_0x32b0f7,_0x528324){return _0x731b15[_0xe108('0x26')]['destroy']({'where':{'ChanSpyId':_0x131d0c['id']}})[_0xe108('0x1e')](function(){_0x528324();})[_0xe108('0x1f')](function(_0x1c3342){_0x528324(_0x1c3342);});}}});};
\ No newline at end of file