c6d6574622d4e10413a472590ac886271b669ab6
[motion.git] / server / config / tools / user.js
1 var _0x14dd=["\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","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x43\x68\x61\x6E\x53\x70\x79","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x62\x6C\x75\x65\x62\x69\x72\x64","\x43\x72\x65\x61\x74\x69\x6E\x67\x20\x63\x68\x61\x6E\x73\x70\x79\x2E\x2E\x2E","\x6C\x6F\x67","\x61\x6C\x6C","\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","\x53\x65\x74","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x25\x73","\x63\x68\x61\x6E\x73\x70\x79","\x69\x64","\x73\x79\x73\x74\x65\x6D","\x70\x75\x73\x68","\x61\x75\x74\x68","\x41\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x72\x65\x63\x6F\x72\x64","\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x46\x6F\x72\x6D\x61\x74","\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","\x24\x7B\x55\x4E\x49\x51\x55\x45\x49\x44\x7D\x2E\x25\x73","\x53\x49\x50\x2F\x25\x73\x2C\x25\x73","\x6F\x70\x74\x69\x6F\x6E\x73","\x53\x74\x6F\x70\x4D\x69\x78\x4D\x6F\x6E\x69\x74\x6F\x72","","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x66\x6F\x72\x45\x61\x63\x68","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x44\x65\x6C\x65\x74\x69\x6E\x67\x20\x63\x68\x61\x6E\x73\x70\x79\x2E\x2E\x2E","\x64\x65\x73\x74\x72\x6F\x79","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x5F\x63\x68\x61\x6E\x67\x65\x64","\x43\x72\x65\x61\x74\x69\x6E\x67\x20\x63\x61\x6C\x6C\x65\x72\x49\x44\x2E\x2E\x2E","\x63\x61\x6C\x6C\x65\x72\x69\x64","\x22\x25\x73\x22\x20\x3C\x25\x73\x3E","\x73\x61\x76\x65","\x72\x65\x73\x6F\x6C\x76\x65","\x43\x72\x65\x61\x74\x69\x6E\x67\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x2E\x2E\x2E","\x5F","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x44\x69\x61\x6C","\x53\x49\x50\x2F","\x2C\x2C\x74\x54\x78\x58","\x48\x61\x6E\x67\x75\x70","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x71\x75\x65\x75\x65\x53\x74\x61\x74\x75\x73","\x6C\x61\x73\x74\x4C\x6F\x67\x69\x6E\x41\x74","\x6F\x6E\x6C\x69\x6E\x65","\x65\x72\x72","\x73\x74\x61\x63\x6B","\x63\x61\x74\x63\x68","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65"];_0x14dd[0];var fs=require(_0x14dd[1]);var util=require(_0x14dd[2]);var path=require(_0x14dd[3]);var config=require(_0x14dd[4]);var UserModel=require(_0x14dd[6])[_0x14dd[5]];var VoiceExtension=require(_0x14dd[6])[_0x14dd[7]];var ChanSpy=require(_0x14dd[6])[_0x14dd[8]];var sequelize=require(_0x14dd[6])[_0x14dd[9]];var BPromise=require(_0x14dd[10]);function createChanspy(_0xd0c9xb,_0xd0c9xc){console[_0x14dd[12]](_0x14dd[11]);return ChanSpy[_0x14dd[41]]()[_0x14dd[40]](function(_0xd0c9xd){var _0xd0c9xe=[];_0xd0c9xd[_0x14dd[39]](function(_0xd0c9xf){var _0xd0c9x10=[];var _0xd0c9x11=1;_0xd0c9x10[_0x14dd[24]]({context:_0x14dd[14],exten:util[_0x14dd[18]](_0x14dd[15],_0xd0c9xf[_0x14dd[16]],_0xd0c9xb[_0x14dd[17]]),priority:_0xd0c9x11,app:_0x14dd[19],appdata:util[_0x14dd[18]](_0x14dd[20],_0x14dd[21]),UserId:_0xd0c9xb[_0x14dd[22]],ChanSpyId:_0xd0c9xf[_0x14dd[22]],type:_0x14dd[23]});_0xd0c9x11++;if(_0xd0c9xf[_0x14dd[25]]){_0xd0c9x10[_0x14dd[24]]({context:_0x14dd[14],exten:util[_0x14dd[18]](_0x14dd[15],_0xd0c9xf[_0x14dd[16]],_0xd0c9xb[_0x14dd[17]]),priority:_0xd0c9x11,app:_0x14dd[26],appdata:_0xd0c9xf[_0x14dd[27]],UserId:_0xd0c9xb[_0x14dd[22]],ChanSpyId:_0xd0c9xf[_0x14dd[22]],type:_0x14dd[23]});_0xd0c9x11++};if(_0xd0c9xf[_0x14dd[28]]&& _0xd0c9xf[_0x14dd[29]]){_0xd0c9x10[_0x14dd[24]]({context:_0x14dd[14],exten:util[_0x14dd[18]](_0x14dd[15],_0xd0c9xf[_0x14dd[16]],_0xd0c9xb[_0x14dd[17]]),priority:_0xd0c9x11,app:_0x14dd[30],appdata:util[_0x14dd[18]](_0x14dd[31],_0xd0c9xf[_0x14dd[29]]),UserId:_0xd0c9xb[_0x14dd[22]],ChanSpyId:_0xd0c9xf[_0x14dd[22]],type:_0x14dd[23]});_0xd0c9x11++};_0xd0c9x10[_0x14dd[24]]({context:_0x14dd[14],exten:util[_0x14dd[18]](_0x14dd[15],_0xd0c9xf[_0x14dd[16]],_0xd0c9xb[_0x14dd[17]]),priority:_0xd0c9x11,app:_0x14dd[8],appdata:util[_0x14dd[18]](_0x14dd[32],_0xd0c9xb[_0x14dd[17]],_0xd0c9xf[_0x14dd[33]]),UserId:_0xd0c9xb[_0x14dd[22]],ChanSpyId:_0xd0c9xf[_0x14dd[22]],type:_0x14dd[23]});_0xd0c9x11++;if(_0xd0c9xf[_0x14dd[28]]&& _0xd0c9xf[_0x14dd[29]]){_0xd0c9x10[_0x14dd[24]]({context:_0x14dd[14],exten:util[_0x14dd[18]](_0x14dd[15],_0xd0c9xf[_0x14dd[16]],_0xd0c9xb[_0x14dd[17]]),priority:_0xd0c9x11,app:_0x14dd[34],appdata:_0x14dd[35],UserId:_0xd0c9xb[_0x14dd[22]],ChanSpyId:_0xd0c9xf[_0x14dd[22]],type:_0x14dd[23]})};_0xd0c9x11= 1;_0xd0c9x10[_0x14dd[24]]({context:_0x14dd[14],exten:util[_0x14dd[18]](_0x14dd[15],_0xd0c9xf[_0x14dd[16]],_0xd0c9xb[_0x14dd[36]]),priority:_0xd0c9x11,app:_0x14dd[19],appdata:util[_0x14dd[18]](_0x14dd[20],_0x14dd[21]),UserId:_0xd0c9xb[_0x14dd[22]],ChanSpyId:_0xd0c9xf[_0x14dd[22]],type:_0x14dd[23]});_0xd0c9x11++;if(_0xd0c9xf[_0x14dd[25]]){_0xd0c9x10[_0x14dd[24]]({context:_0x14dd[14],exten:util[_0x14dd[18]](_0x14dd[15],_0xd0c9xf[_0x14dd[16]],_0xd0c9xb[_0x14dd[36]]),priority:_0xd0c9x11,app:_0x14dd[26],appdata:_0xd0c9xf[_0x14dd[27]],UserId:_0xd0c9xb[_0x14dd[22]],ChanSpyId:_0xd0c9xf[_0x14dd[22]],type:_0x14dd[23]});_0xd0c9x11++};if(_0xd0c9xf[_0x14dd[28]]&& _0xd0c9xf[_0x14dd[29]]){_0xd0c9x10[_0x14dd[24]]({context:_0x14dd[14],exten:util[_0x14dd[18]](_0x14dd[15],_0xd0c9xf[_0x14dd[16]],_0xd0c9xb[_0x14dd[36]]),priority:_0xd0c9x11,app:_0x14dd[30],appdata:util[_0x14dd[18]](_0x14dd[31],_0xd0c9xf[_0x14dd[29]]),UserId:_0xd0c9xb[_0x14dd[22]],ChanSpyId:_0xd0c9xf[_0x14dd[22]],type:_0x14dd[23]});_0xd0c9x11++};_0xd0c9x10[_0x14dd[24]]({context:_0x14dd[14],exten:util[_0x14dd[18]](_0x14dd[15],_0xd0c9xf[_0x14dd[16]],_0xd0c9xb[_0x14dd[36]]),priority:_0xd0c9x11,app:_0x14dd[8],appdata:util[_0x14dd[18]](_0x14dd[32],_0xd0c9xb[_0x14dd[17]],_0xd0c9xf[_0x14dd[33]]),UserId:_0xd0c9xb[_0x14dd[22]],ChanSpyId:_0xd0c9xf[_0x14dd[22]],type:_0x14dd[23]});_0xd0c9x11++;if(_0xd0c9xf[_0x14dd[28]]&& _0xd0c9xf[_0x14dd[29]]){_0xd0c9x10[_0x14dd[24]]({context:_0x14dd[14],exten:util[_0x14dd[18]](_0x14dd[15],_0xd0c9xf[_0x14dd[16]],_0xd0c9xb[_0x14dd[36]]),priority:_0xd0c9x11,app:_0x14dd[34],appdata:_0x14dd[35],UserId:_0xd0c9xb[_0x14dd[22]],ChanSpyId:_0xd0c9xf[_0x14dd[22]],type:_0x14dd[23]})};_0xd0c9xe[_0x14dd[24]](VoiceExtension[_0x14dd[38]](_0xd0c9x10,{transaction:_0xd0c9xc[_0x14dd[37]]|| null}))});return _0xd0c9xe})[_0x14dd[13]]()}function deleteChanSpy(_0xd0c9xb,_0xd0c9xc){console[_0x14dd[12]](_0x14dd[42]);return VoiceExtension[_0x14dd[43]]({where:{UserId:_0xd0c9xb[_0x14dd[22]],ChanSpyId:{$ne:null}},transaction:_0xd0c9xc[_0x14dd[37]]|| null})}function createCallerID(_0xd0c9xb,_0xd0c9xc){return function(){if(_0xd0c9xb[_0x14dd[44]]&& _0xd0c9xb[_0x14dd[36]]&& _0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[44])){console[_0x14dd[12]](_0x14dd[47]);_0xd0c9xb[_0x14dd[48]]= util[_0x14dd[18]](_0x14dd[49],_0xd0c9xb[_0x14dd[44]],_0xd0c9xb[_0x14dd[36]]);return _0xd0c9xb[_0x14dd[50]]({transaction:_0xd0c9xc[_0x14dd[37]]|| null})}else {return BPromise[_0x14dd[51]]()}}}function createExtension(_0xd0c9xb,_0xd0c9xc){console[_0x14dd[12]](_0x14dd[52]);return function(){var _0xd0c9x15=[{context:_0x14dd[14],exten:_0x14dd[53]+ _0xd0c9xb[_0x14dd[36]],priority:1,app:_0x14dd[19],appdata:_0x14dd[54],UserId:_0xd0c9xb[_0x14dd[22]],type:_0x14dd[23]},{context:_0x14dd[14],exten:_0x14dd[53]+ _0xd0c9xb[_0x14dd[36]],priority:2,app:_0x14dd[55],appdata:_0x14dd[56]+ _0xd0c9xb[_0x14dd[17]]+ _0x14dd[57],UserId:_0xd0c9xb[_0x14dd[22]],type:_0x14dd[23]},{context:_0x14dd[14],exten:_0x14dd[53]+ _0xd0c9xb[_0x14dd[36]],priority:3,app:_0x14dd[58],appdata:_0x14dd[35],UserId:_0xd0c9xb[_0x14dd[22]],type:_0x14dd[23]},{context:_0x14dd[14],exten:_0xd0c9xb[_0x14dd[17]],priority:1,app:_0x14dd[19],appdata:_0x14dd[54],UserId:_0xd0c9xb[_0x14dd[22]],type:_0x14dd[23]},{context:_0x14dd[14],exten:_0xd0c9xb[_0x14dd[17]],priority:2,app:_0x14dd[55],appdata:_0x14dd[56]+ _0xd0c9xb[_0x14dd[17]]+ _0x14dd[57],UserId:_0xd0c9xb[_0x14dd[22]],type:_0x14dd[23]},{context:_0x14dd[14],exten:_0xd0c9xb[_0x14dd[17]],priority:3,app:_0x14dd[58],appdata:_0x14dd[35],UserId:_0xd0c9xb[_0x14dd[22]],type:_0x14dd[23]}];return VoiceExtension[_0x14dd[38]](_0xd0c9x15,{transaction:_0xd0c9xc[_0x14dd[37]]|| null})}}exports[_0x14dd[59]]= function(_0xd0c9xc){return function(_0xd0c9xb){if(!_0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[60])&&  !_0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[61]) &&  !_0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[48]) &&  !_0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[62]) &&  !_0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[63])){return BPromise[_0x14dd[51]]()[_0x14dd[40]](createCallerID(_0xd0c9xb,_0xd0c9xc))[_0x14dd[40]](function(){if((_0xd0c9xb[_0x14dd[21]]&& _0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[21]))){return createChanspy(_0xd0c9xb,_0xd0c9xc)}})[_0x14dd[40]](function(){if(_0xd0c9xb[_0x14dd[21]]&&  !_0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[21])&& _0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[17])){return deleteChanSpy(_0xd0c9xb,_0xd0c9xc)}})[_0x14dd[40]](function(){if(_0xd0c9xb[_0x14dd[21]]&&  !_0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[21])&& _0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[17])){return createChanspy(_0xd0c9xb,_0xd0c9xc)}})[_0x14dd[40]](function(){if(!_0xd0c9xb[_0x14dd[21]]&& _0xd0c9xb[_0x14dd[46]][_0x14dd[45]](_0x14dd[21])){return deleteChanSpy(_0xd0c9xb,_0xd0c9xc)}})[_0x14dd[66]](function(_0xd0c9x16){console[_0x14dd[12]](_0x14dd[64],_0xd0c9x16[_0x14dd[65]])})[_0x14dd[40]](function(){return _0xd0c9xb})}else {return BPromise[_0x14dd[51]]()[_0x14dd[40]](function(){return _0xd0c9xb})}}};exports[_0x14dd[67]]= function(_0xd0c9xc){return function(_0xd0c9xb){delete _0xd0c9xb[_0x14dd[46]][_0x14dd[36]];return Promise[_0x14dd[13]]([])[_0x14dd[40]](createCallerID(_0xd0c9xb,_0xd0c9xc))[_0x14dd[40]](createExtension(_0xd0c9xb,_0xd0c9xc))[_0x14dd[40]](function(){if(_0xd0c9xb[_0x14dd[21]]){return createChanspy(_0xd0c9xb,_0xd0c9xc)}})[_0x14dd[40]](function(){return _0xd0c9xb})}}