Built motion from commit 1020cd7.|0.0.107
[motion.git] / server / config / tools / user.js
index 28951e7..d1c2b40 100644 (file)
@@ -1 +1 @@
-var _0x5650=["\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","\x63\x68\x61\x6E\x73\x70\x79","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x63\x68\x61\x6E\x67\x65\x64","\x6E\x61\x6D\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x61\x6C\x6C","\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","\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","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x64\x65\x73\x74\x72\x6F\x79","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x63\x61\x6C\x6C\x65\x72\x69\x64","\x22\x25\x73\x22\x20\x3C\x25\x73\x3E","\x73\x61\x76\x65","\x65\x78\x74\x65\x6E","\x5F\x70\x72\x65\x76\x69\x6F\x75\x73\x44\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x61\x70\x70\x64\x61\x74\x61","\x53\x49\x50\x2F","\x67\x65\x74\x55\x73\x65\x72\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x44\x69\x61\x6C","\x65\x78\x70\x6F\x72\x74\x73"];_0x5650[0];var fs=require(_0x5650[1]);var util=require(_0x5650[2]);var path=require(_0x5650[3]);var config=require(_0x5650[4]);var UserModel=require(_0x5650[6])[_0x5650[5]];var VoiceExtension=require(_0x5650[6])[_0x5650[7]];var ChanSpy=require(_0x5650[6])[_0x5650[8]];var sequelize=require(_0x5650[6])[_0x5650[9]];function User(){UserModel[_0x5650[11]](function(_0xf986xa){createCallerID(_0xf986xa);createExtension(_0xf986xa);if(_0xf986xa[_0x5650[10]]){createChanspy(_0xf986xa)}});UserModel[_0x5650[14]](function(_0xf986xa){updateExtension(_0xf986xa);createCallerID(_0xf986xa);if((_0xf986xa[_0x5650[10]]&&_0xf986xa[_0x5650[12]](_0x5650[10]))){createChanspy(_0xf986xa)}else {if(_0xf986xa[_0x5650[10]]&&!_0xf986xa[_0x5650[12]](_0x5650[10])&&_0xf986xa[_0x5650[12]](_0x5650[13])){deleteChanSpy(_0xf986xa);createChanspy(_0xf986xa)}else {if(!_0xf986xa[_0x5650[10]]&&_0xf986xa[_0x5650[12]](_0x5650[10])){deleteChanSpy(_0xf986xa)}}}})}function createChanspy(_0xf986xa){return sequelize[_0x5650[35]](function(_0xf986xd){return ChanSpy[_0x5650[34]]()[_0x5650[33]](function(_0xf986xe){var _0xf986xf=[];_0xf986xe[_0x5650[32]](function(_0xf986x10){var _0xf986x11=[];var _0xf986x12=1;if(_0xf986x10[_0x5650[18]]){_0xf986x11[_0x5650[27]]({context:_0x5650[19],exten:util[_0x5650[22]](_0x5650[20],_0xf986x10[_0x5650[21]],_0xf986xa[_0x5650[13]]),priority:_0xf986x12,app:_0x5650[23],appdata:_0xf986x10[_0x5650[24]],UserId:_0xf986xa[_0x5650[25]],ChanSpyId:_0xf986x10[_0x5650[25]],type:_0x5650[26]});_0xf986x12++};_0xf986x11[_0x5650[27]]({context:_0x5650[19],exten:util[_0x5650[22]](_0x5650[20],_0xf986x10[_0x5650[21]],_0xf986xa[_0x5650[13]]),priority:_0xf986x12,app:_0x5650[8],appdata:util[_0x5650[22]](_0x5650[28],_0xf986xa[_0x5650[13]],_0xf986x10[_0x5650[29]]),UserId:_0xf986xa[_0x5650[25]],ChanSpyId:_0xf986x10[_0x5650[25]],type:_0x5650[26]});_0xf986x12=1;if(_0xf986x10[_0x5650[18]]){_0xf986x11[_0x5650[27]]({context:_0x5650[19],exten:util[_0x5650[22]](_0x5650[20],_0xf986x10[_0x5650[21]],_0xf986xa[_0x5650[30]]),priority:_0xf986x12,app:_0x5650[23],appdata:_0xf986x10[_0x5650[24]],UserId:_0xf986xa[_0x5650[25]],ChanSpyId:_0xf986x10[_0x5650[25]],type:_0x5650[26]});_0xf986x12++};_0xf986x11[_0x5650[27]]({context:_0x5650[19],exten:util[_0x5650[22]](_0x5650[20],_0xf986x10[_0x5650[21]],_0xf986xa[_0x5650[30]]),priority:_0xf986x12,app:_0x5650[8],appdata:util[_0x5650[22]](_0x5650[28],_0xf986xa[_0x5650[13]],_0xf986x10[_0x5650[29]]),UserId:_0xf986xa[_0x5650[25]],ChanSpyId:_0xf986x10[_0x5650[25]],type:_0x5650[26]});_0xf986xf[_0x5650[27]](VoiceExtension[_0x5650[31]](_0xf986x11,{transaction:_0xf986xd}))});return _0xf986xf})[_0x5650[17]]()})[_0x5650[16]](function(_0xf986xc){console[_0x5650[15]](_0xf986xc)})}function deleteChanSpy(_0xf986xa){return sequelize[_0x5650[35]](function(_0xf986xd){return VoiceExtension[_0x5650[36]]({where:{UserId:_0xf986xa[_0x5650[25]],ChanSpyId:{$ne:null}},transaction:_0xf986xd})})[_0x5650[16]](function(_0xf986xc){console[_0x5650[15]](_0xf986xc)})}function createCallerID(_0xf986xa){if(_0xf986xa[_0x5650[37]]&&_0xf986xa[_0x5650[30]]){_0xf986xa[_0x5650[38]]=util[_0x5650[22]](_0x5650[39],_0xf986xa[_0x5650[37]],_0xf986xa[_0x5650[30]]);_0xf986xa[_0x5650[40]]()};return}function updateExtension(_0xf986xa){if(_0xf986xa[_0x5650[12]](_0x5650[13])){_0xf986xa[_0x5650[45]]()[_0x5650[33]](function(_0xf986x16){_0xf986x16[_0x5650[32]](function(_0xf986x10){_0xf986x10[_0x5650[41]]=(_0xf986x10[_0x5650[41]]===_0xf986xa[_0x5650[42]][_0x5650[30]])?_0xf986xa[_0x5650[30]]:_0xf986xa[_0x5650[13]];_0xf986x10[_0x5650[43]]=_0x5650[44]+_0xf986xa[_0x5650[13]];_0xf986x10[_0x5650[40]]()})})[_0x5650[16]](function(_0xf986xc){console[_0x5650[15]](_0xf986xc)})}}function createExtension(_0xf986xa){if(_0xf986xa[_0x5650[30]]){var _0xf986x18=[{context:_0x5650[19],exten:_0xf986xa[_0x5650[30]],priority:1,app:_0x5650[46],appdata:_0x5650[44]+_0xf986xa[_0x5650[13]],UserId:_0xf986xa[_0x5650[25]],type:_0x5650[26]},{context:_0x5650[19],exten:_0xf986xa[_0x5650[13]],priority:1,app:_0x5650[46],appdata:_0x5650[44]+_0xf986xa[_0x5650[13]],UserId:_0xf986xa[_0x5650[25]],type:_0x5650[26]}];return VoiceExtension[_0x5650[31]](_0xf986x18)[_0x5650[16]](function(_0xf986xc){console[_0x5650[15]](_0xf986xc)})}}module[_0x5650[47]]=User
\ No newline at end of file
+var _0x5992=["\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"];_0x5992[0];var fs=require(_0x5992[1]);var util=require(_0x5992[2]);var path=require(_0x5992[3]);var config=require(_0x5992[4]);var UserModel=require(_0x5992[6])[_0x5992[5]];var VoiceExtension=require(_0x5992[6])[_0x5992[7]];var ChanSpy=require(_0x5992[6])[_0x5992[8]];var sequelize=require(_0x5992[6])[_0x5992[9]];var Promise=require(_0x5992[10]);function User(){UserModel[_0x5992[16]](function(_0x383exb,_0x383exc){delete _0x383exb[_0x5992[12]][_0x5992[11]];return Promise[_0x5992[15]]([])[_0x5992[14]](createCallerID(_0x383exb,_0x383exc))[_0x5992[14]](createExtension(_0x383exb,_0x383exc))[_0x5992[14]](function(){if(_0x383exb[_0x5992[13]]){createChanspy(_0x383exb,_0x383exc)}})});UserModel[_0x5992[19]](function(_0x383exb,_0x383exc){if(_0x383exb[_0x5992[17]](_0x5992[11])){throw  new sequelize.Error(_0x5992[18])}});UserModel[_0x5992[26]](function(_0x383exb,_0x383exc){if(!_0x383exb[_0x5992[17]](_0x5992[20])&&!_0x383exb[_0x5992[17]](_0x5992[21])&&!_0x383exb[_0x5992[17]](_0x5992[22])&&!_0x383exb[_0x5992[17]](_0x5992[23])&&!_0x383exb[_0x5992[17]](_0x5992[24])){return Promise[_0x5992[15]]([])[_0x5992[14]](updateExtension(_0x383exb,_0x383exc))[_0x5992[14]](createCallerID(_0x383exb,_0x383exc))[_0x5992[14]](function(){if((_0x383exb[_0x5992[13]]&&_0x383exb[_0x5992[17]](_0x5992[13]))){createChanspy(_0x383exb,_0x383exc)}})[_0x5992[14]](function(){if(_0x383exb[_0x5992[13]]&&!_0x383exb[_0x5992[17]](_0x5992[13])&&_0x383exb[_0x5992[17]](_0x5992[25])){deleteChanSpy(_0x383exb,_0x383exc)}})[_0x5992[14]](function(){if(_0x383exb[_0x5992[13]]&&!_0x383exb[_0x5992[17]](_0x5992[13])&&_0x383exb[_0x5992[17]](_0x5992[25])){createChanspy(_0x383exb,_0x383exc)}})[_0x5992[14]](function(){if(!_0x383exb[_0x5992[13]]&&_0x383exb[_0x5992[17]](_0x5992[13])){deleteChanSpy(_0x383exb,_0x383exc)}})}})}function createChanspy(_0x383exb,_0x383exc){console[_0x5992[28]](_0x5992[27]);return function(){return ChanSpy[_0x5992[44]]()[_0x5992[14]](function(_0x383exe){var _0x383exf=[];_0x383exe[_0x5992[43]](function(_0x383ex10){var _0x383ex11=[];var _0x383ex12=1;if(_0x383ex10[_0x5992[29]]){_0x383ex11[_0x5992[38]]({context:_0x5992[30],exten:util[_0x5992[33]](_0x5992[31],_0x383ex10[_0x5992[32]],_0x383exb[_0x5992[25]]),priority:_0x383ex12,app:_0x5992[34],appdata:_0x383ex10[_0x5992[35]],UserId:_0x383exb[_0x5992[36]],ChanSpyId:_0x383ex10[_0x5992[36]],type:_0x5992[37]});_0x383ex12++};_0x383ex11[_0x5992[38]]({context:_0x5992[30],exten:util[_0x5992[33]](_0x5992[31],_0x383ex10[_0x5992[32]],_0x383exb[_0x5992[25]]),priority:_0x383ex12,app:_0x5992[8],appdata:util[_0x5992[33]](_0x5992[39],_0x383exb[_0x5992[25]],_0x383ex10[_0x5992[40]]),UserId:_0x383exb[_0x5992[36]],ChanSpyId:_0x383ex10[_0x5992[36]],type:_0x5992[37]});_0x383ex12=1;if(_0x383ex10[_0x5992[29]]){_0x383ex11[_0x5992[38]]({context:_0x5992[30],exten:util[_0x5992[33]](_0x5992[31],_0x383ex10[_0x5992[32]],_0x383exb[_0x5992[11]]),priority:_0x383ex12,app:_0x5992[34],appdata:_0x383ex10[_0x5992[35]],UserId:_0x383exb[_0x5992[36]],ChanSpyId:_0x383ex10[_0x5992[36]],type:_0x5992[37]});_0x383ex12++};_0x383ex11[_0x5992[38]]({context:_0x5992[30],exten:util[_0x5992[33]](_0x5992[31],_0x383ex10[_0x5992[32]],_0x383exb[_0x5992[11]]),priority:_0x383ex12,app:_0x5992[8],appdata:util[_0x5992[33]](_0x5992[39],_0x383exb[_0x5992[25]],_0x383ex10[_0x5992[40]]),UserId:_0x383exb[_0x5992[36]],ChanSpyId:_0x383ex10[_0x5992[36]],type:_0x5992[37]});_0x383exf[_0x5992[38]](VoiceExtension[_0x5992[42]](_0x383ex11,{transaction:_0x383exc[_0x5992[41]]}))});return _0x383exf})[_0x5992[15]]()}}function deleteChanSpy(_0x383exb,_0x383exc){console[_0x5992[28]](_0x5992[45]);return function(){return VoiceExtension[_0x5992[46]]({where:{UserId:_0x383exb[_0x5992[36]],ChanSpyId:{$ne:null}},transaction:_0x383exc[_0x5992[41]]})}}function createCallerID(_0x383exb,_0x383exc){return function(){if(_0x383exb[_0x5992[47]]&&_0x383exb[_0x5992[11]]&&_0x383exb[_0x5992[17]](_0x5992[47])){console[_0x5992[28]](_0x5992[48]);_0x383exb[_0x5992[22]]=util[_0x5992[33]](_0x5992[49],_0x383exb[_0x5992[47]],_0x383exb[_0x5992[11]]);return _0x383exb[_0x5992[50]]({transaction:_0x383exc[_0x5992[41]]})};return}}function updateExtension(_0x383exb,_0x383exc){return function(){if(_0x383exb[_0x5992[17]](_0x5992[25])){console[_0x5992[28]](_0x5992[51]);return _0x383exb[_0x5992[59]]()[_0x5992[14]](function(_0x383ex16){var _0x383ex17,_0x383ex18=[];_0x383ex16[_0x5992[43]](function(_0x383ex10){_0x383ex17=false;if(_0x383ex10[_0x5992[52]]!==_0x5992[53]+_0x383exb[_0x5992[11]]){_0x383ex10[_0x5992[52]]=_0x383exb[_0x5992[25]];_0x383ex17=true};if(_0x383ex10[_0x5992[54]]===_0x5992[55]){_0x383ex10[_0x5992[56]]=_0x5992[57]+_0x383exb[_0x5992[25]]+_0x5992[58];_0x383ex17=true};if(_0x383ex17){_0x383ex18[_0x5992[38]](_0x383ex10[_0x5992[50]]({transaction:_0x383exc[_0x5992[41]]}))}});return _0x383ex18})[_0x5992[15]]()}}}function createExtension(_0x383exb,_0x383exc){console[_0x5992[28]](_0x5992[60]);return function(){var _0x383ex1a=[{context:_0x5992[30],exten:_0x5992[53]+_0x383exb[_0x5992[11]],priority:1,app:_0x5992[61],appdata:_0x5992[62],UserId:_0x383exb[_0x5992[36]],type:_0x5992[37]},{context:_0x5992[30],exten:_0x5992[53]+_0x383exb[_0x5992[11]],priority:2,app:_0x5992[55],appdata:_0x5992[57]+_0x383exb[_0x5992[25]]+_0x5992[58],UserId:_0x383exb[_0x5992[36]],type:_0x5992[37]},{context:_0x5992[30],exten:_0x5992[53]+_0x383exb[_0x5992[11]],priority:3,app:_0x5992[63],appdata:_0x5992[64],UserId:_0x383exb[_0x5992[36]],type:_0x5992[37]},{context:_0x5992[30],exten:_0x383exb[_0x5992[25]],priority:1,app:_0x5992[61],appdata:_0x5992[62],UserId:_0x383exb[_0x5992[36]],type:_0x5992[37]},{context:_0x5992[30],exten:_0x383exb[_0x5992[25]],priority:2,app:_0x5992[55],appdata:_0x5992[57]+_0x383exb[_0x5992[25]]+_0x5992[58],UserId:_0x383exb[_0x5992[36]],type:_0x5992[37]},{context:_0x5992[30],exten:_0x383exb[_0x5992[25]],priority:3,app:_0x5992[63],appdata:_0x5992[64],UserId:_0x383exb[_0x5992[36]],type:_0x5992[37]}];return VoiceExtension[_0x5992[42]](_0x383ex1a,{transaction:_0x383exc[_0x5992[41]]})}}module[_0x5992[65]]=User
\ No newline at end of file