Built motion from commit ec3ecc5.|1.0.2
[motion.git] / server / config / tools / user.js
index 16b67e7..fb5e327 100644 (file)
@@ -1 +1 @@
-var _0xac27=["\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","\x73\x74\x61\x74\x75\x73","\x63\x68\x61\x6E\x67\x65\x64","\x71\x75\x65\x75\x65\x53\x74\x61\x74\x75\x73","\x6E\x61\x6D\x65","\x6D\x61\x73\x73\x69\x6D\x69\x6C\x69\x61\x6E\x6F\x2E\x62\x75\x6E\x67\x61\x72\x6F","\x6C\x6F\x67","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\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","\x53\x65\x74","\x43\x44\x52\x28\x74\x79\x70\x65\x29\x3D\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x44\x69\x61\x6C","\x48\x61\x6E\x67\x75\x70","","\x65\x78\x70\x6F\x72\x74\x73"];_0xac27[0];var fs=require(_0xac27[1]);var util=require(_0xac27[2]);var path=require(_0xac27[3]);var config=require(_0xac27[4]);var UserModel=require(_0xac27[6])[_0xac27[5]];var VoiceExtension=require(_0xac27[6])[_0xac27[7]];var ChanSpy=require(_0xac27[6])[_0xac27[8]];var sequelize=require(_0xac27[6])[_0xac27[9]];function User(){UserModel[_0xac27[11]](function(_0xf991xa){createCallerID(_0xf991xa);createExtension(_0xf991xa);if(_0xf991xa[_0xac27[10]]){createChanspy(_0xf991xa)}});UserModel[_0xac27[18]](function(_0xf991xa){if(!_0xf991xa[_0xac27[13]](_0xac27[12])&&!_0xf991xa[_0xac27[13]](_0xac27[14])){updateExtension(_0xf991xa);if(_0xf991xa[_0xac27[15]]===_0xac27[16]){console[_0xac27[17]](_0xf991xa[_0xac27[12]])};createCallerID(_0xf991xa);if((_0xf991xa[_0xac27[10]]&&_0xf991xa[_0xac27[13]](_0xac27[10]))){createChanspy(_0xf991xa)}else {if(_0xf991xa[_0xac27[10]]&&!_0xf991xa[_0xac27[13]](_0xac27[10])&&_0xf991xa[_0xac27[13]](_0xac27[15])){deleteChanSpy(_0xf991xa);createChanspy(_0xf991xa)}else {if(!_0xf991xa[_0xac27[10]]&&_0xf991xa[_0xac27[13]](_0xac27[10])){deleteChanSpy(_0xf991xa)}}}}})}function createChanspy(_0xf991xa){return sequelize[_0xac27[38]](function(_0xf991xd){return ChanSpy[_0xac27[37]]()[_0xac27[36]](function(_0xf991xe){var _0xf991xf=[];_0xf991xe[_0xac27[35]](function(_0xf991x10){var _0xf991x11=[];var _0xf991x12=1;if(_0xf991x10[_0xac27[21]]){_0xf991x11[_0xac27[30]]({context:_0xac27[22],exten:util[_0xac27[25]](_0xac27[23],_0xf991x10[_0xac27[24]],_0xf991xa[_0xac27[15]]),priority:_0xf991x12,app:_0xac27[26],appdata:_0xf991x10[_0xac27[27]],UserId:_0xf991xa[_0xac27[28]],ChanSpyId:_0xf991x10[_0xac27[28]],type:_0xac27[29]});_0xf991x12++};_0xf991x11[_0xac27[30]]({context:_0xac27[22],exten:util[_0xac27[25]](_0xac27[23],_0xf991x10[_0xac27[24]],_0xf991xa[_0xac27[15]]),priority:_0xf991x12,app:_0xac27[8],appdata:util[_0xac27[25]](_0xac27[31],_0xf991xa[_0xac27[15]],_0xf991x10[_0xac27[32]]),UserId:_0xf991xa[_0xac27[28]],ChanSpyId:_0xf991x10[_0xac27[28]],type:_0xac27[29]});_0xf991x12=1;if(_0xf991x10[_0xac27[21]]){_0xf991x11[_0xac27[30]]({context:_0xac27[22],exten:util[_0xac27[25]](_0xac27[23],_0xf991x10[_0xac27[24]],_0xf991xa[_0xac27[33]]),priority:_0xf991x12,app:_0xac27[26],appdata:_0xf991x10[_0xac27[27]],UserId:_0xf991xa[_0xac27[28]],ChanSpyId:_0xf991x10[_0xac27[28]],type:_0xac27[29]});_0xf991x12++};_0xf991x11[_0xac27[30]]({context:_0xac27[22],exten:util[_0xac27[25]](_0xac27[23],_0xf991x10[_0xac27[24]],_0xf991xa[_0xac27[33]]),priority:_0xf991x12,app:_0xac27[8],appdata:util[_0xac27[25]](_0xac27[31],_0xf991xa[_0xac27[15]],_0xf991x10[_0xac27[32]]),UserId:_0xf991xa[_0xac27[28]],ChanSpyId:_0xf991x10[_0xac27[28]],type:_0xac27[29]});_0xf991xf[_0xac27[30]](VoiceExtension[_0xac27[34]](_0xf991x11,{transaction:_0xf991xd}))});return _0xf991xf})[_0xac27[20]]()})[_0xac27[19]](function(_0xf991xc){console[_0xac27[17]](_0xf991xc)})}function deleteChanSpy(_0xf991xa){return sequelize[_0xac27[38]](function(_0xf991xd){return VoiceExtension[_0xac27[39]]({where:{UserId:_0xf991xa[_0xac27[28]],ChanSpyId:{$ne:null}},transaction:_0xf991xd})})[_0xac27[19]](function(_0xf991xc){console[_0xac27[17]](_0xf991xc)})}function createCallerID(_0xf991xa){if(_0xf991xa[_0xac27[40]]&&_0xf991xa[_0xac27[33]]){_0xf991xa[_0xac27[41]]=util[_0xac27[25]](_0xac27[42],_0xf991xa[_0xac27[40]],_0xf991xa[_0xac27[33]]);_0xf991xa[_0xac27[43]]()};return}function updateExtension(_0xf991xa){if(_0xf991xa[_0xac27[13]](_0xac27[15])){_0xf991xa[_0xac27[48]]()[_0xac27[36]](function(_0xf991x16){_0xf991x16[_0xac27[35]](function(_0xf991x10){_0xf991x10[_0xac27[44]]=(_0xf991x10[_0xac27[44]]===_0xf991xa[_0xac27[45]][_0xac27[33]])?_0xf991xa[_0xac27[33]]:_0xf991xa[_0xac27[15]];_0xf991x10[_0xac27[46]]=_0xac27[47]+_0xf991xa[_0xac27[15]];_0xf991x10[_0xac27[43]]()})})[_0xac27[19]](function(_0xf991xc){console[_0xac27[17]](_0xf991xc)})}}function createExtension(_0xf991xa){if(_0xf991xa[_0xac27[33]]){var _0xf991x18=[{context:_0xac27[22],exten:_0xf991xa[_0xac27[33]],priority:1,app:_0xac27[49],appdata:_0xac27[50],UserId:_0xf991xa[_0xac27[28]],type:_0xac27[29]},{context:_0xac27[22],exten:_0xf991xa[_0xac27[33]],priority:2,app:_0xac27[51],appdata:_0xac27[47]+_0xf991xa[_0xac27[15]],UserId:_0xf991xa[_0xac27[28]],type:_0xac27[29]},{context:_0xac27[22],exten:_0xf991xa[_0xac27[33]],priority:3,app:_0xac27[52],appdata:_0xac27[53],UserId:_0xf991xa[_0xac27[28]],type:_0xac27[29]},{context:_0xac27[22],exten:_0xf991xa[_0xac27[33]],priority:1,app:_0xac27[49],appdata:_0xac27[50],UserId:_0xf991xa[_0xac27[28]],type:_0xac27[29]},{context:_0xac27[22],exten:_0xf991xa[_0xac27[15]],priority:2,app:_0xac27[51],appdata:_0xac27[47]+_0xf991xa[_0xac27[15]],UserId:_0xf991xa[_0xac27[28]],type:_0xac27[29]},{context:_0xac27[22],exten:_0xf991xa[_0xac27[15]],priority:3,app:_0xac27[52],appdata:_0xac27[53],UserId:_0xf991xa[_0xac27[28]],type:_0xac27[29]}];return VoiceExtension[_0xac27[34]](_0xf991x18)[_0xac27[19]](function(_0xf991xc){console[_0xac27[17]](_0xf991xc)})}}module[_0xac27[54]]=User
\ No newline at end of file
+var _0xbd37=["\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","\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","\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","\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","\x53\x65\x74","\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","\x63\x68\x61\x6E\x73\x70\x79","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65"];_0xbd37[0];var fs=require(_0xbd37[1]);var util=require(_0xbd37[2]);var path=require(_0xbd37[3]);var config=require(_0xbd37[4]);var UserModel=require(_0xbd37[6])[_0xbd37[5]];var VoiceExtension=require(_0xbd37[6])[_0xbd37[7]];var ChanSpy=require(_0xbd37[6])[_0xbd37[8]];var sequelize=require(_0xbd37[6])[_0xbd37[9]];var BPromise=require(_0xbd37[10]);function createChanspy(_0xffc3xb,_0xffc3xc){console[_0xbd37[12]](_0xbd37[11]);return ChanSpy[_0xbd37[32]]()[_0xbd37[31]](function(_0xffc3xd){var _0xffc3xe=[];_0xffc3xd[_0xbd37[30]](function(_0xffc3xf){var _0xffc3x10=[];var _0xffc3x11=1;if(_0xffc3xf[_0xbd37[14]]){_0xffc3x10[_0xbd37[24]]({context:_0xbd37[15],exten:util[_0xbd37[19]](_0xbd37[16],_0xffc3xf[_0xbd37[17]],_0xffc3xb[_0xbd37[18]]),priority:_0xffc3x11,app:_0xbd37[20],appdata:_0xffc3xf[_0xbd37[21]],UserId:_0xffc3xb[_0xbd37[22]],ChanSpyId:_0xffc3xf[_0xbd37[22]],type:_0xbd37[23]});_0xffc3x11++};_0xffc3x10[_0xbd37[24]]({context:_0xbd37[15],exten:util[_0xbd37[19]](_0xbd37[16],_0xffc3xf[_0xbd37[17]],_0xffc3xb[_0xbd37[18]]),priority:_0xffc3x11,app:_0xbd37[8],appdata:util[_0xbd37[19]](_0xbd37[25],_0xffc3xb[_0xbd37[18]],_0xffc3xf[_0xbd37[26]]),UserId:_0xffc3xb[_0xbd37[22]],ChanSpyId:_0xffc3xf[_0xbd37[22]],type:_0xbd37[23]});_0xffc3x11= 1;if(_0xffc3xf[_0xbd37[14]]){_0xffc3x10[_0xbd37[24]]({context:_0xbd37[15],exten:util[_0xbd37[19]](_0xbd37[16],_0xffc3xf[_0xbd37[17]],_0xffc3xb[_0xbd37[27]]),priority:_0xffc3x11,app:_0xbd37[20],appdata:_0xffc3xf[_0xbd37[21]],UserId:_0xffc3xb[_0xbd37[22]],ChanSpyId:_0xffc3xf[_0xbd37[22]],type:_0xbd37[23]});_0xffc3x11++};_0xffc3x10[_0xbd37[24]]({context:_0xbd37[15],exten:util[_0xbd37[19]](_0xbd37[16],_0xffc3xf[_0xbd37[17]],_0xffc3xb[_0xbd37[27]]),priority:_0xffc3x11,app:_0xbd37[8],appdata:util[_0xbd37[19]](_0xbd37[25],_0xffc3xb[_0xbd37[18]],_0xffc3xf[_0xbd37[26]]),UserId:_0xffc3xb[_0xbd37[22]],ChanSpyId:_0xffc3xf[_0xbd37[22]],type:_0xbd37[23]});_0xffc3xe[_0xbd37[24]](VoiceExtension[_0xbd37[29]](_0xffc3x10,{transaction:_0xffc3xc[_0xbd37[28]]|| null}))});return _0xffc3xe})[_0xbd37[13]]()}function deleteChanSpy(_0xffc3xb,_0xffc3xc){console[_0xbd37[12]](_0xbd37[33]);return VoiceExtension[_0xbd37[34]]({where:{UserId:_0xffc3xb[_0xbd37[22]],ChanSpyId:{$ne:null}},transaction:_0xffc3xc[_0xbd37[28]]|| null})}function createCallerID(_0xffc3xb,_0xffc3xc){return function(){if(_0xffc3xb[_0xbd37[35]]&& _0xffc3xb[_0xbd37[27]]&& _0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[35])){console[_0xbd37[12]](_0xbd37[38]);_0xffc3xb[_0xbd37[39]]= util[_0xbd37[19]](_0xbd37[40],_0xffc3xb[_0xbd37[35]],_0xffc3xb[_0xbd37[27]]);return _0xffc3xb[_0xbd37[41]]({transaction:_0xffc3xc[_0xbd37[28]]|| null})}else {return BPromise[_0xbd37[42]]()}}}function createExtension(_0xffc3xb,_0xffc3xc){console[_0xbd37[12]](_0xbd37[43]);return function(){var _0xffc3x15=[{context:_0xbd37[15],exten:_0xbd37[44]+ _0xffc3xb[_0xbd37[27]],priority:1,app:_0xbd37[45],appdata:_0xbd37[46],UserId:_0xffc3xb[_0xbd37[22]],type:_0xbd37[23]},{context:_0xbd37[15],exten:_0xbd37[44]+ _0xffc3xb[_0xbd37[27]],priority:2,app:_0xbd37[47],appdata:_0xbd37[48]+ _0xffc3xb[_0xbd37[18]]+ _0xbd37[49],UserId:_0xffc3xb[_0xbd37[22]],type:_0xbd37[23]},{context:_0xbd37[15],exten:_0xbd37[44]+ _0xffc3xb[_0xbd37[27]],priority:3,app:_0xbd37[50],appdata:_0xbd37[51],UserId:_0xffc3xb[_0xbd37[22]],type:_0xbd37[23]},{context:_0xbd37[15],exten:_0xffc3xb[_0xbd37[18]],priority:1,app:_0xbd37[45],appdata:_0xbd37[46],UserId:_0xffc3xb[_0xbd37[22]],type:_0xbd37[23]},{context:_0xbd37[15],exten:_0xffc3xb[_0xbd37[18]],priority:2,app:_0xbd37[47],appdata:_0xbd37[48]+ _0xffc3xb[_0xbd37[18]]+ _0xbd37[49],UserId:_0xffc3xb[_0xbd37[22]],type:_0xbd37[23]},{context:_0xbd37[15],exten:_0xffc3xb[_0xbd37[18]],priority:3,app:_0xbd37[50],appdata:_0xbd37[51],UserId:_0xffc3xb[_0xbd37[22]],type:_0xbd37[23]}];return VoiceExtension[_0xbd37[29]](_0xffc3x15,{transaction:_0xffc3xc[_0xbd37[28]]|| null})}}exports[_0xbd37[52]]= function(_0xffc3xc){return function(_0xffc3xb){if(!_0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[53])&& !_0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[54])&& !_0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[39])&& !_0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[55])&& !_0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[56])){return BPromise[_0xbd37[42]]()[_0xbd37[31]](createCallerID(_0xffc3xb,_0xffc3xc))[_0xbd37[31]](function(){if((_0xffc3xb[_0xbd37[60]]&& _0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[60]))){return createChanspy(_0xffc3xb,_0xffc3xc)}})[_0xbd37[31]](function(){if(_0xffc3xb[_0xbd37[60]]&& !_0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[60])&& _0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[18])){return deleteChanSpy(_0xffc3xb,_0xffc3xc)}})[_0xbd37[31]](function(){if(_0xffc3xb[_0xbd37[60]]&& !_0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[60])&& _0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[18])){return createChanspy(_0xffc3xb,_0xffc3xc)}})[_0xbd37[31]](function(){if(!_0xffc3xb[_0xbd37[60]]&& _0xffc3xb[_0xbd37[37]][_0xbd37[36]](_0xbd37[60])){return deleteChanSpy(_0xffc3xb,_0xffc3xc)}})[_0xbd37[59]](function(_0xffc3x16){console[_0xbd37[12]](_0xbd37[57],_0xffc3x16[_0xbd37[58]])})[_0xbd37[31]](function(){return _0xffc3xb})}else {return BPromise[_0xbd37[42]]()[_0xbd37[31]](function(){return _0xffc3xb})}}};exports[_0xbd37[61]]= function(_0xffc3xc){return function(_0xffc3xb){delete _0xffc3xb[_0xbd37[37]][_0xbd37[27]];return Promise[_0xbd37[13]]([])[_0xbd37[31]](createCallerID(_0xffc3xb,_0xffc3xc))[_0xbd37[31]](createExtension(_0xffc3xb,_0xffc3xc))[_0xbd37[31]](function(){if(_0xffc3xb[_0xbd37[60]]){return createChanspy(_0xffc3xb,_0xffc3xc)}})[_0xbd37[31]](function(){return _0xffc3xb})}}
\ No newline at end of file