adfdc1a64b7cfe978074d9330e205559e975e0c2
[motion.git] / server / config / tools / user.js
1 var _0xf85a=["\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","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x5F\x63\x68\x61\x6E\x67\x65\x64","\x63\x68\x61\x6E\x73\x70\x79","\x74\x68\x65\x6E","\x61\x6C\x6C","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x63\x68\x61\x6E\x67\x65\x64","\x59\x6F\x75\x20\x63\x61\x6E\x27\x74\x20\x6D\x6F\x64\x69\x66\x79\x20\x74\x68\x65\x20\x69\x6E\x74\x65\x72\x6E\x61\x6C\x20\x6F\x66\x20\x61\x20\x55\x73\x65\x72\x2F\x41\x67\x65\x6E\x74\x2F\x54\x65\x6C\x65\x70\x68\x6F\x6E\x65","\x62\x65\x66\x6F\x72\x65\x55\x70\x64\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x71\x75\x65\x75\x65\x53\x74\x61\x74\x75\x73","\x63\x61\x6C\x6C\x65\x72\x69\x64","\x6C\x61\x73\x74\x4C\x6F\x67\x69\x6E\x41\x74","\x6F\x6E\x6C\x69\x6E\x65","\x6E\x61\x6D\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x43\x72\x65\x61\x74\x69\x6E\x67\x20\x63\x68\x61\x6E\x73\x70\x79\x2E\x2E\x2E","\x6C\x6F\x67","\x61\x75\x74\x68","\x66\x72\x6F\x6D\x2D\x73\x69\x70","\x25\x73\x25\x73","\x70\x72\x65\x66\x69\x78","\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","\x69\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","\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","\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","\x43\x72\x65\x61\x74\x69\x6E\x67\x20\x63\x61\x6C\x6C\x65\x72\x49\x44\x2E\x2E\x2E","\x22\x25\x73\x22\x20\x3C\x25\x73\x3E","\x73\x61\x76\x65","\x55\x70\x64\x61\x74\x69\x6E\x67\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x2E\x2E\x2E","\x65\x78\x74\x65\x6E","\x5F","\x61\x70\x70","\x44\x69\x61\x6C","\x61\x70\x70\x64\x61\x74\x61","\x53\x49\x50\x2F","\x2C\x74\x54\x78\x58","\x67\x65\x74\x55\x73\x65\x72\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x43\x72\x65\x61\x74\x69\x6E\x67\x20\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E\x2E\x2E\x2E","\x53\x65\x74","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x48\x61\x6E\x67\x75\x70","","\x65\x78\x70\x6F\x72\x74\x73"];_0xf85a[0];var fs=require(_0xf85a[1]);var util=require(_0xf85a[2]);var path=require(_0xf85a[3]);var config=require(_0xf85a[4]);var UserModel=require(_0xf85a[6])[_0xf85a[5]];var VoiceExtension=require(_0xf85a[6])[_0xf85a[7]];var ChanSpy=require(_0xf85a[6])[_0xf85a[8]];var sequelize=require(_0xf85a[6])[_0xf85a[9]];var Promise=require(_0xf85a[10]);function User(){UserModel[_0xf85a[16]](function(_0xddd6xb,_0xddd6xc){delete _0xddd6xb[_0xf85a[12]][_0xf85a[11]];return Promise[_0xf85a[15]]([])[_0xf85a[14]](createCallerID(_0xddd6xb,_0xddd6xc))[_0xf85a[14]](createExtension(_0xddd6xb,_0xddd6xc))[_0xf85a[14]](function(){if(_0xddd6xb[_0xf85a[13]]){createChanspy(_0xddd6xb,_0xddd6xc)}})});UserModel[_0xf85a[19]](function(_0xddd6xb,_0xddd6xc){if(_0xddd6xb[_0xf85a[17]](_0xf85a[11])){throw  new sequelize.Error(_0xf85a[18])}});UserModel[_0xf85a[26]](function(_0xddd6xb,_0xddd6xc){if(!_0xddd6xb[_0xf85a[17]](_0xf85a[20])&&!_0xddd6xb[_0xf85a[17]](_0xf85a[21])&&!_0xddd6xb[_0xf85a[17]](_0xf85a[22])&&!_0xddd6xb[_0xf85a[17]](_0xf85a[23])&&!_0xddd6xb[_0xf85a[17]](_0xf85a[24])){return Promise[_0xf85a[15]]([])[_0xf85a[14]](updateExtension(_0xddd6xb,_0xddd6xc))[_0xf85a[14]](createCallerID(_0xddd6xb,_0xddd6xc))[_0xf85a[14]](function(){if((_0xddd6xb[_0xf85a[13]]&&_0xddd6xb[_0xf85a[17]](_0xf85a[13]))){createChanspy(_0xddd6xb,_0xddd6xc)}})[_0xf85a[14]](function(){if(_0xddd6xb[_0xf85a[13]]&&!_0xddd6xb[_0xf85a[17]](_0xf85a[13])&&_0xddd6xb[_0xf85a[17]](_0xf85a[25])){deleteChanSpy(_0xddd6xb,_0xddd6xc)}})[_0xf85a[14]](function(){if(_0xddd6xb[_0xf85a[13]]&&!_0xddd6xb[_0xf85a[17]](_0xf85a[13])&&_0xddd6xb[_0xf85a[17]](_0xf85a[25])){createChanspy(_0xddd6xb,_0xddd6xc)}})[_0xf85a[14]](function(){if(!_0xddd6xb[_0xf85a[13]]&&_0xddd6xb[_0xf85a[17]](_0xf85a[13])){deleteChanSpy(_0xddd6xb,_0xddd6xc)}})}})}function createChanspy(_0xddd6xb,_0xddd6xc){console[_0xf85a[28]](_0xf85a[27]);return function(){return ChanSpy[_0xf85a[44]]()[_0xf85a[14]](function(_0xddd6xe){var _0xddd6xf=[];_0xddd6xe[_0xf85a[43]](function(_0xddd6x10){var _0xddd6x11=[];var _0xddd6x12=1;if(_0xddd6x10[_0xf85a[29]]){_0xddd6x11[_0xf85a[38]]({context:_0xf85a[30],exten:util[_0xf85a[33]](_0xf85a[31],_0xddd6x10[_0xf85a[32]],_0xddd6xb[_0xf85a[25]]),priority:_0xddd6x12,app:_0xf85a[34],appdata:_0xddd6x10[_0xf85a[35]],UserId:_0xddd6xb[_0xf85a[36]],ChanSpyId:_0xddd6x10[_0xf85a[36]],type:_0xf85a[37]});_0xddd6x12++};_0xddd6x11[_0xf85a[38]]({context:_0xf85a[30],exten:util[_0xf85a[33]](_0xf85a[31],_0xddd6x10[_0xf85a[32]],_0xddd6xb[_0xf85a[25]]),priority:_0xddd6x12,app:_0xf85a[8],appdata:util[_0xf85a[33]](_0xf85a[39],_0xddd6xb[_0xf85a[25]],_0xddd6x10[_0xf85a[40]]),UserId:_0xddd6xb[_0xf85a[36]],ChanSpyId:_0xddd6x10[_0xf85a[36]],type:_0xf85a[37]});_0xddd6x12=1;if(_0xddd6x10[_0xf85a[29]]){_0xddd6x11[_0xf85a[38]]({context:_0xf85a[30],exten:util[_0xf85a[33]](_0xf85a[31],_0xddd6x10[_0xf85a[32]],_0xddd6xb[_0xf85a[11]]),priority:_0xddd6x12,app:_0xf85a[34],appdata:_0xddd6x10[_0xf85a[35]],UserId:_0xddd6xb[_0xf85a[36]],ChanSpyId:_0xddd6x10[_0xf85a[36]],type:_0xf85a[37]});_0xddd6x12++};_0xddd6x11[_0xf85a[38]]({context:_0xf85a[30],exten:util[_0xf85a[33]](_0xf85a[31],_0xddd6x10[_0xf85a[32]],_0xddd6xb[_0xf85a[11]]),priority:_0xddd6x12,app:_0xf85a[8],appdata:util[_0xf85a[33]](_0xf85a[39],_0xddd6xb[_0xf85a[25]],_0xddd6x10[_0xf85a[40]]),UserId:_0xddd6xb[_0xf85a[36]],ChanSpyId:_0xddd6x10[_0xf85a[36]],type:_0xf85a[37]});_0xddd6xf[_0xf85a[38]](VoiceExtension[_0xf85a[42]](_0xddd6x11,{transaction:_0xddd6xc[_0xf85a[41]]}))});return _0xddd6xf})[_0xf85a[15]]()}}function deleteChanSpy(_0xddd6xb,_0xddd6xc){console[_0xf85a[28]](_0xf85a[45]);return function(){return VoiceExtension[_0xf85a[46]]({where:{UserId:_0xddd6xb[_0xf85a[36]],ChanSpyId:{$ne:null}},transaction:_0xddd6xc[_0xf85a[41]]})}}function createCallerID(_0xddd6xb,_0xddd6xc){return function(){if(_0xddd6xb[_0xf85a[47]]&&_0xddd6xb[_0xf85a[11]]&&_0xddd6xb[_0xf85a[17]](_0xf85a[47])){console[_0xf85a[28]](_0xf85a[48]);_0xddd6xb[_0xf85a[22]]=util[_0xf85a[33]](_0xf85a[49],_0xddd6xb[_0xf85a[47]],_0xddd6xb[_0xf85a[11]]);return _0xddd6xb[_0xf85a[50]]({transaction:_0xddd6xc[_0xf85a[41]]})};return}}function updateExtension(_0xddd6xb,_0xddd6xc){return function(){if(_0xddd6xb[_0xf85a[17]](_0xf85a[25])){console[_0xf85a[28]](_0xf85a[51]);return _0xddd6xb[_0xf85a[59]]()[_0xf85a[14]](function(_0xddd6x16){var _0xddd6x17,_0xddd6x18=[];_0xddd6x16[_0xf85a[43]](function(_0xddd6x10){_0xddd6x17=false;if(_0xddd6x10[_0xf85a[52]]!==_0xf85a[53]+_0xddd6xb[_0xf85a[11]]){_0xddd6x10[_0xf85a[52]]=_0xddd6xb[_0xf85a[25]];_0xddd6x17=true};if(_0xddd6x10[_0xf85a[54]]===_0xf85a[55]){_0xddd6x10[_0xf85a[56]]=_0xf85a[57]+_0xddd6xb[_0xf85a[25]]+_0xf85a[58];_0xddd6x17=true};if(_0xddd6x17){_0xddd6x18[_0xf85a[38]](_0xddd6x10[_0xf85a[50]]({transaction:_0xddd6xc[_0xf85a[41]]}))}});return _0xddd6x18})[_0xf85a[15]]()}}}function createExtension(_0xddd6xb,_0xddd6xc){console[_0xf85a[28]](_0xf85a[60]);return function(){var _0xddd6x1a=[{context:_0xf85a[30],exten:_0xf85a[53]+_0xddd6xb[_0xf85a[11]],priority:1,app:_0xf85a[61],appdata:_0xf85a[62],UserId:_0xddd6xb[_0xf85a[36]],type:_0xf85a[37]},{context:_0xf85a[30],exten:_0xf85a[53]+_0xddd6xb[_0xf85a[11]],priority:2,app:_0xf85a[55],appdata:_0xf85a[57]+_0xddd6xb[_0xf85a[25]]+_0xf85a[58],UserId:_0xddd6xb[_0xf85a[36]],type:_0xf85a[37]},{context:_0xf85a[30],exten:_0xf85a[53]+_0xddd6xb[_0xf85a[11]],priority:3,app:_0xf85a[63],appdata:_0xf85a[64],UserId:_0xddd6xb[_0xf85a[36]],type:_0xf85a[37]},{context:_0xf85a[30],exten:_0xddd6xb[_0xf85a[25]],priority:1,app:_0xf85a[61],appdata:_0xf85a[62],UserId:_0xddd6xb[_0xf85a[36]],type:_0xf85a[37]},{context:_0xf85a[30],exten:_0xddd6xb[_0xf85a[25]],priority:2,app:_0xf85a[55],appdata:_0xf85a[57]+_0xddd6xb[_0xf85a[25]]+_0xf85a[58],UserId:_0xddd6xb[_0xf85a[36]],type:_0xf85a[37]},{context:_0xf85a[30],exten:_0xddd6xb[_0xf85a[25]],priority:3,app:_0xf85a[63],appdata:_0xf85a[64],UserId:_0xddd6xb[_0xf85a[36]],type:_0xf85a[37]}];return VoiceExtension[_0xf85a[42]](_0xddd6x1a,{transaction:_0xddd6xc[_0xf85a[41]]})}}module[_0xf85a[65]]=User