30b61c0531e101911080cbfd9fd307d947bb8bf2
[motion.git] / server / config / ami / acw.js
1 var _0x6bfb=["\x6D\x6F\x6D\x65\x6E\x74","\x6C\x6F\x64\x61\x73\x68","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x41\x63\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x41\x43\x57\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x69\x64","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x74\x68\x65\x6E","\x6E\x61\x6D\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x67\x65\x6E\x74","\x73\x63\x6F\x70\x65","\x75\x6E\x70\x61\x75\x73\x65","\x62\x6F\x64\x79","\x61\x63\x77\x54\x69\x6D\x65","\x74\x69\x6D\x65\x6F\x75\x74","\x61\x73\x53\x65\x63\x6F\x6E\x64\x73","\x61\x63\x77\x41\x74","\x64\x75\x72\x61\x74\x69\x6F\x6E","\x75\x6E\x69\x71\x75\x65\x69\x64","\x64\x65\x73\x74\x75\x6E\x69\x71\x75\x65\x69\x64","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x75\x70\x64\x61\x74\x65","\x61\x67\x65\x6E\x74\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x71\x75\x65\x75\x65","\x66\x69\x6E\x64","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x50\x41\x55\x53\x45\x44\x20\x42\x59\x20\x41\x43\x57","\x61\x63\x77\x54\x69\x6D\x65\x6F\x75\x74","\x55\x4E\x50\x41\x55\x53\x45\x44\x20\x42\x59\x20\x41\x43\x57","\x41\x43\x57","\x63\x72\x65\x61\x74\x65","\x70\x61\x75\x73\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x72\x65\x6D\x6F\x76\x65","\x61\x66\x74\x65\x72\x44\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78\x4F\x66","\x6D\x65\x72\x67\x65","\x75\x6E\x73\x68\x69\x66\x74","\x65\x78\x70\x6F\x72\x74\x73"];var moment=require(_0x6bfb[0]);var _=require(_0x6bfb[1]);var VoiceQueue=require(_0x6bfb[3])[_0x6bfb[2]];var Agent=require(_0x6bfb[3])[_0x6bfb[4]];var Action=require(_0x6bfb[3])[_0x6bfb[5]];var ReportAgent=require(_0x6bfb[3])[_0x6bfb[6]];var _voiceQueues;var _agents;var activeAcw={};function ACW(_0x1ae7xb){console[_0x6bfb[8]](_0x6bfb[7]);VoiceQueue[_0x6bfb[14]]()[_0x6bfb[12]](function(_0x1ae7x10){_voiceQueues=_0x1ae7x10;synchCollection(VoiceQueue,_voiceQueues,_0x6bfb[13]);return Agent[_0x6bfb[16]](_0x6bfb[15])[_0x6bfb[14]]()})[_0x6bfb[12]](function(_0x1ae7xd){_agents=_0x1ae7xd;synchCollection(Agent,_agents,_0x6bfb[10]);Action[_0x6bfb[11]](function(_0x1ae7xe,_0x1ae7xf){return onSave(_0x1ae7xe,_0x1ae7xf)})})[_0x6bfb[9]](function(_0x1ae7xc){console[_0x6bfb[8]](_0x1ae7xc)})}function onSave(_0x1ae7xe,_0x1ae7xf){if(_0x1ae7xe[_0x6bfb[13]]===_0x6bfb[17]&&activeAcw[_0x1ae7xf[_0x6bfb[18]][_0x6bfb[15]]]){var _0x1ae7x12;if(activeAcw[_0x1ae7xf[_0x6bfb[18]][_0x6bfb[15]]][_0x6bfb[17]]){_0x1ae7x12=activeAcw[_0x1ae7xf[_0x6bfb[18]][_0x6bfb[15]]][_0x6bfb[19]]}else {clearTimeout(activeAcw[_0x1ae7xf[_0x6bfb[18]][_0x6bfb[15]]][_0x6bfb[20]]);_0x1ae7x12=moment[_0x6bfb[23]](moment()-activeAcw[_0x1ae7xf[_0x6bfb[18]][_0x6bfb[15]]][_0x6bfb[22]])[_0x6bfb[21]]()};return ReportAgent[_0x6bfb[27]]({agentacw:true,acwtime:_0x1ae7x12},{where:{uniqueid:activeAcw[_0x1ae7xf[_0x6bfb[18]][_0x6bfb[15]]][_0x6bfb[24]],destuniqueid:activeAcw[_0x1ae7xf[_0x6bfb[18]][_0x6bfb[15]]][_0x6bfb[25]]},transaction:_0x1ae7xf[_0x6bfb[26]],individualHooks:true})[_0x6bfb[12]](function(){delete activeAcw[_0x1ae7xf[_0x6bfb[18]][_0x6bfb[15]]]})[_0x6bfb[9]](function(_0x1ae7xc){console[_0x6bfb[8]](_0x1ae7xc)})}}ACW[_0x6bfb[29]][_0x6bfb[28]]=function(_0x1ae7x13){var _0x1ae7x14=_[_0x6bfb[31]](_voiceQueues,{name:_0x1ae7x13[_0x6bfb[30]],acw:true});if(_0x1ae7x14){var _0x1ae7x15=_[_0x6bfb[31]](_agents,{name:_0x1ae7x13[_0x6bfb[32]]});Action[_0x6bfb[37]]({name:_0x6bfb[38],data1:_0x1ae7x13[_0x6bfb[30]],data2:_0x1ae7x14[_0x6bfb[34]],data3:_0x1ae7x13[_0x6bfb[24]],data4:_0x6bfb[36]},{body:{agent:_0x1ae7x15[_0x6bfb[10]],type:_0x6bfb[36]}})[_0x6bfb[12]](function(){console[_0x6bfb[8]](_0x6bfb[33]);activeAcw[_0x1ae7x15[_0x6bfb[10]]]={uniqueid:_0x1ae7x13[_0x6bfb[24]],destuniqueid:_0x1ae7x13[_0x6bfb[25]],acwTime:_0x1ae7x14[_0x6bfb[34]],acwAt:moment(),unpause:false};activeAcw[_0x1ae7x15[_0x6bfb[10]]][_0x6bfb[20]]=setTimeout(function(){console[_0x6bfb[8]](_0x6bfb[35]);activeAcw[_0x1ae7x15[_0x6bfb[10]]][_0x6bfb[17]]=true;return Action[_0x6bfb[37]]({name:_0x6bfb[17],data1:_0x1ae7x13[_0x6bfb[30]],data2:_0x1ae7x14[_0x6bfb[34]],data3:_0x1ae7x13[_0x6bfb[24]],data4:_0x6bfb[36]},{body:{agent:_0x1ae7x15[_0x6bfb[10]],type:_0x6bfb[36]}})[_0x6bfb[9]](function(_0x1ae7xc){console[_0x6bfb[8]](_0x1ae7xc)})},_0x1ae7x14[_0x6bfb[34]]*1000)})[_0x6bfb[9]](function(_0x1ae7xc){console[_0x6bfb[8]](_0x1ae7xc)})}};function synchCollection(_0x1ae7x17,_0x1ae7x18,_0x1ae7x19){var _0x1ae7x1a={};_0x1ae7x17[_0x6bfb[11]](function(_0x1ae7xe){_0x1ae7x1a[_0x1ae7x19]=_0x1ae7xe[_0x1ae7x19];updateCollection(_0x1ae7x18,_0x1ae7xe,_0x1ae7x1a)});_0x1ae7x17[_0x6bfb[39]](function(_0x1ae7xe){_0x1ae7x1a[_0x1ae7x19]=_0x1ae7xe[_0x1ae7x19];updateCollection(_0x1ae7x18,_0x1ae7xe,_0x1ae7x1a)});_0x1ae7x17[_0x6bfb[41]](function(_0x1ae7xe){_0x1ae7x1a[_0x1ae7x19]=_0x1ae7xe[_0x1ae7x19];_[_0x6bfb[40]](_0x1ae7x18,_0x1ae7x1a)})}function updateCollection(_0x1ae7x1c,_0x1ae7xe,_0x1ae7x1a){var _0x1ae7x1d=_[_0x6bfb[31]](_0x1ae7x1c,_0x1ae7x1a);var _0x1ae7x1e=_0x1ae7x1c[_0x6bfb[42]](_0x1ae7x1d);if(_0x1ae7x1d){_[_0x6bfb[43]](_0x1ae7x1c[_0x1ae7x1e],_0x1ae7xe)}else {_0x1ae7x1c[_0x6bfb[44]](_0x1ae7xe)}}module[_0x6bfb[45]]=ACW