c4cbb3cbca5d69b972c868cc9c90503ca4e1b3c9
[motion.git] / server / config / routing / agent.js
1 var _0xf47d=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x2E\x2F\x73\x74\x72\x75\x63\x74\x75\x72\x65","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x75\x74\x69\x6C","\x6D\x6F\x6D\x65\x6E\x74","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x61\x70\x70","\x64\x61\x74\x61","\x63\x61\x6C\x6C\x65\x64","\x72\x65\x6A\x65\x63\x74\x65\x64","\x6E\x65\x78\x74","\x69\x6E\x69\x74","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x55\x73\x65\x72\x49\x64","\x63\x68\x61\x6E\x6E\x65\x6C","\x70\x61\x75\x73\x65\x73","\x6C\x61\x62\x65\x6C\x73","\x77\x68\x65\x72\x65","\x72\x6F\x6F\x6D\x73","\x6D\x6F\x64\x65\x6C\x73","\x69\x64","\x70\x75\x73\x68","\x69\x6E\x63\x6C\x75\x64\x65","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x41\x47\x45\x4E\x54\x20\x41\x43\x54\x49\x4F\x4E\x20\x53\x54\x41\x52\x54\x45\x44","\x6C\x6F\x67","\x74\x68\x65\x6E","\x72\x6F\x6F\x6D\x69\x64","\x75\x70\x64\x61\x74\x65","\x5F\x61\x67\x65\x6E\x74\x73","\x74\x6F\x55\x70\x70\x65\x72\x43\x61\x73\x65","\x41\x50\x50\x20\x41\x47\x45\x4E\x54\x2C\x20\x49\x4E\x54\x45\x52\x41\x43\x54\x49\x4F\x4E\x3A","\x75\x6E\x69\x71\x75\x65\x69\x64","\x54\x49\x4D\x45\x4F\x55\x54","\x74\x69\x6D\x65\x6F\x75\x74","\x53\x45\x43","\x69\x6E\x66\x6F","\x6C\x65\x6E\x67\x74\x68","\x6F\x6E\x6C\x69\x6E\x65","\x4F\x50\x45\x4E","\x66\x69\x6C\x74\x65\x72","\x63\x61\x70\x61\x63\x69\x74\x69\x65\x73","\x77\x72\x69\x74\x65\x52\x65\x70\x6F\x72\x74","\x41\x50\x50\x20\x46\x49\x44\x45\x4C\x49\x54\x59\x20\x53\x4B\x49\x50\x20\x49\x4E\x54\x45\x52\x41\x43\x54\x49\x4F\x4E\x3A","\x72\x6F\x6F\x6D\x49\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x67\x65\x6E\x74","\x6E\x61\x6D\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x6D\x65\x72\x67\x65","\x6D\x61\x70","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x72\x65\x70\x6F\x72\x74\x73","\x73\x65\x73\x73\x69\x6F\x6E\x73","\x65\x78\x70\x6F\x72\x74\x73"];_0xf47d[0];const _=require(_0xf47d[1]);const config=require(_0xf47d[2]);const structure=require(_0xf47d[3]);const cp=require(_0xf47d[4]);const util=require(_0xf47d[5]);const moment=require(_0xf47d[6]);const User=require(_0xf47d[8])[_0xf47d[7]];function Agent(_0xc132x9,_0xc132xa,_0xc132xb){this[_0xf47d[9]]= _0xc132x9;this[_0xf47d[10]]= _0xc132xa;this[_0xf47d[11]]= [];this[_0xf47d[12]]= [];this[_0xf47d[13]]= _0xc132xb}Agent[_0xf47d[15]][_0xf47d[14]]= function init(){var _0xc132xd=this;var _0xc132xe={where:{id:_0xc132xd[_0xf47d[9]][_0xf47d[16]],online:true},include:[]};_0xc132xe[_0xf47d[20]][structure[_0xf47d[19]][_0xf47d[18]][_0xc132xd[_0xf47d[10]][_0xf47d[17]]]]= false;_0xc132xe[_0xf47d[25]][_0xf47d[24]]({model:structure[_0xf47d[22]][_0xf47d[21]][_0xc132xd[_0xf47d[10]][_0xf47d[17]]],attributes:[_0xf47d[23]]});return User[_0xf47d[49]](_0xc132xe)[_0xf47d[30]](function(_0xc132x10){_0xc132xd[_0xf47d[33]]= _0xc132x10;console[_0xf47d[40]](_0xc132xd[_0xf47d[10]][_0xf47d[17]][_0xf47d[34]](),_0xf47d[35],_0xc132xd[_0xf47d[10]][_0xf47d[36]],_0xf47d[37],_0xc132xd[_0xf47d[9]][_0xf47d[38]],_0xf47d[39]);if(_0xc132xd[_0xf47d[33]][_0xf47d[41]]&& available(_0xc132xd[_0xf47d[33]][0][_0xf47d[42]],_0xc132xd[_0xf47d[33]][0][structure[_0xf47d[19]][_0xf47d[18]][_0xc132xd[_0xf47d[10]][_0xf47d[17]]]],_[_0xf47d[44]](_0xc132xd[_0xf47d[33]][0][structure[_0xf47d[19]][_0xf47d[21]][_0xc132xd[_0xf47d[10]][_0xf47d[17]]]],{status:_0xf47d[43]}),_0xc132xd[_0xf47d[33]][0][structure[_0xf47d[19]][_0xf47d[45]][_0xc132xd[_0xf47d[10]][_0xf47d[17]]]])){_0xc132xd[_0xf47d[46]]();_0xc132xd[_0xf47d[38]]= setTimeout(function(){_0xc132xd[_0xf47d[13]]()},_0xc132xd[_0xf47d[9]][_0xf47d[38]]* 1000)}else {console[_0xf47d[40]](_0xc132xd[_0xf47d[10]][_0xf47d[17]][_0xf47d[34]](),_0xf47d[47],_0xc132xd[_0xf47d[10]][_0xf47d[48]]);_0xc132xd[_0xf47d[13]]()}})[_0xf47d[30]](function(){return structure[_0xf47d[22]][_0xf47d[21]][_0xc132xd[_0xf47d[10]][_0xf47d[17]]][_0xf47d[32]]({waiting:true},{where:{id:_0xc132xd[_0xf47d[10]][_0xf47d[31]]},individualHooks:true})[_0xf47d[30]](function(){console[_0xf47d[29]](_0xf47d[28])})[_0xf47d[27]](function(_0xc132xf){console[_0xf47d[26]]()})})};Agent[_0xf47d[15]][_0xf47d[46]]= function writeReport(){var _0xc132xd=this;var _0xc132x12=_[_0xf47d[55]](_0xc132xd._agents,function(_0xc132x13){return _[_0xf47d[54]](_0xc132xd[_0xf47d[10]],{timeslot:_0xc132xd[_0xf47d[9]][_0xf47d[38]],application:_0xf47d[50],membername:_0xc132x13[_0xf47d[51]],memberid:_0xc132x13[_0xf47d[23]],calledAt:moment()[_0xf47d[53]](_0xf47d[52]),joinAt:moment()[_0xf47d[53]](_0xf47d[52])})});return structure[_0xf47d[22]][_0xf47d[58]][_0xc132xd[_0xf47d[10]][_0xf47d[17]]][_0xf47d[56]](_0xc132x12,{individualHooks:true})[_0xf47d[30]](function(){return structure[_0xf47d[22]][_0xf47d[57]][_0xc132xd[_0xf47d[10]][_0xf47d[17]]][_0xf47d[56]](_0xc132x12,{individualHooks:true})})[_0xf47d[27]](function(_0xc132xf){console[_0xf47d[26]](_0xc132xf)})};function available(_0xc132x15,_0xc132x16,_0xc132x17,_0xc132x18){return _0xc132x15&& !_0xc132x16&& ((_0xc132x17[_0xf47d[41]]< _0xc132x18)|| _0xc132x18=== 0)}module[_0xf47d[59]]= Agent