8cd613275dac29fe74b7739e3adcfee3f1fbf071
[motion.git] / server / config / tools / channelSpy.js
1 var _0xd9da=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x43\x68\x61\x6E\x53\x70\x79","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x62\x6C\x75\x65\x62\x69\x72\x64","\x74\x68\x65\x6E","\x61\x6C\x6C","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x69\x64","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x64\x65\x73\x74\x72\x6F\x79","\x61\x75\x74\x68","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x25\x73\x25\x73","\x70\x72\x65\x66\x69\x78","\x6E\x61\x6D\x65","\x66\x6F\x72\x6D\x61\x74","\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x73\x79\x73\x74\x65\x6D","\x70\x75\x73\x68","\x53\x49\x50\x2F\x25\x73\x2C\x25\x73","\x6F\x70\x74\x69\x6F\x6E\x73","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x66\x6F\x72\x45\x61\x63\x68","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x67\x65\x6E\x74","\x73\x63\x6F\x70\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xd9da[0];var fs=require(_0xd9da[1]);var util=require(_0xd9da[2]);var path=require(_0xd9da[3]);var config=require(_0xd9da[4]);var ChanSpyModel=require(_0xd9da[6])[_0xd9da[5]];var User=require(_0xd9da[6])[_0xd9da[7]];var VoiceExtension=require(_0xd9da[6])[_0xd9da[8]];var sequelize=require(_0xd9da[6])[_0xd9da[9]];var Promise=require(_0xd9da[10]);function ChanSpy(){ChanSpyModel[_0xd9da[13]](function(_0x73a4xb,_0x73a4xc){return Promise[_0xd9da[12]]([])[_0xd9da[11]](createSpyExtensions(_0x73a4xb,_0x73a4xc))});ChanSpyModel[_0xd9da[14]](function(_0x73a4xb,_0x73a4xc){return Promise[_0xd9da[12]]([])[_0xd9da[11]](deleteSpyExtensions(_0x73a4xb,_0x73a4xc))[_0xd9da[11]](createSpyExtensions(_0x73a4xb,_0x73a4xc))});ChanSpyModel[_0xd9da[15]](function(_0x73a4xb,_0x73a4xc){return deleteSpyExtensions(_0x73a4xb,_0x73a4xc)})}function deleteSpyExtensions(_0x73a4xb,_0x73a4xc){return VoiceExtension[_0xd9da[18]]({where:{ChanSpyId:_0x73a4xb[_0xd9da[16]]},transaction:_0x73a4xc[_0xd9da[17]]})}function createSpyExtensions(_0x73a4xb,_0x73a4xc){return User[_0xd9da[36]](_0xd9da[35])[_0xd9da[34]]({where:{chanspy:true}})[_0xd9da[11]](function(_0x73a4xf){var _0x73a4x10=[];_0x73a4xf[_0xd9da[33]](function(_0x73a4x11){var _0x73a4x12=[];var _0x73a4x13=1;if(_0x73a4xb[_0xd9da[19]]){_0x73a4x12[_0xd9da[28]]({context:_0xd9da[20],exten:util[_0xd9da[24]](_0xd9da[21],_0x73a4xb[_0xd9da[22]],_0x73a4x11[_0xd9da[23]]),priority:_0x73a4x13,app:_0xd9da[25],appdata:_0x73a4xb[_0xd9da[26]],UserId:_0x73a4x11[_0xd9da[16]],ChanSpyId:_0x73a4xb[_0xd9da[16]],type:_0xd9da[27]});_0x73a4x13++};_0x73a4x12[_0xd9da[28]]({context:_0xd9da[20],exten:util[_0xd9da[24]](_0xd9da[21],_0x73a4xb[_0xd9da[22]],_0x73a4x11[_0xd9da[23]]),priority:_0x73a4x13,app:_0xd9da[5],appdata:util[_0xd9da[24]](_0xd9da[29],_0x73a4x11[_0xd9da[23]],_0x73a4xb[_0xd9da[30]]),UserId:_0x73a4x11[_0xd9da[16]],ChanSpyId:_0x73a4xb[_0xd9da[16]],type:_0xd9da[27]});_0x73a4x13= 1;if(_0x73a4xb[_0xd9da[19]]){_0x73a4x12[_0xd9da[28]]({context:_0xd9da[20],exten:util[_0xd9da[24]](_0xd9da[21],_0x73a4xb[_0xd9da[22]],_0x73a4x11[_0xd9da[31]]),priority:_0x73a4x13,app:_0xd9da[25],appdata:_0x73a4xb[_0xd9da[26]],UserId:_0x73a4x11[_0xd9da[16]],ChanSpyId:_0x73a4xb[_0xd9da[16]],type:_0xd9da[27]});_0x73a4x13++};_0x73a4x12[_0xd9da[28]]({context:_0xd9da[20],exten:util[_0xd9da[24]](_0xd9da[21],_0x73a4xb[_0xd9da[22]],_0x73a4x11[_0xd9da[31]]),priority:_0x73a4x13,app:_0xd9da[5],appdata:util[_0xd9da[24]](_0xd9da[29],_0x73a4x11[_0xd9da[23]],_0x73a4xb[_0xd9da[30]]),UserId:_0x73a4x11[_0xd9da[16]],ChanSpyId:_0x73a4xb[_0xd9da[16]],type:_0xd9da[27]});_0x73a4x10[_0xd9da[28]](VoiceExtension[_0xd9da[32]](_0x73a4x12,{transaction:_0x73a4xc[_0xd9da[17]]}))});return _0x73a4x10})[_0xd9da[12]]()}module[_0xd9da[37]]= ChanSpy