Built motion from commit b5b971d.|0.0.97
[motion.git] / server / config / ami / acw.js
index f9d855b..eb22a03 100644 (file)
@@ -1 +1 @@
-var _0x8aac=["\x6D\x6F\x6D\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","\x61\x67\x65\x6E\x74\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x69\x73\x43\x6F\x6E\x6E\x65\x63\x74\x65\x64","\x69\x6E\x74\x65\x72\x66\x61\x63\x65","\x53\x49\x50\x2F\x6D\x61\x73\x73\x69\x6D\x69\x6C\x69\x61\x6E\x6F\x2E\x62\x75\x6E\x67\x61\x72\x6F","\x51\x75\x65\x75\x65\x50\x61\x75\x73\x65","\x55\x4E\x41\x56\x41\x49\x4C\x41\x42\x4C\x45\x20\x42\x59\x20\x41\x43\x57","\x65\x72\x72\x6F\x72","\x50\x41\x55\x53\x45\x20\x41\x43\x57\x20\x69\x6E\x20\x61\x6C\x6C\x20\x71\x75\x65\x75\x65\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x61\x67\x65\x6E\x74\x20","\x71\x75\x65\x75\x65","\x41\x43\x57","\x53\x49\x4E\x47\x4C\x45\x20\x50\x41\x55\x53\x45\x20\x41\x43\x57\x20\x69\x6E\x20","\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x61\x67\x65\x6E\x74\x20","\x55\x4E\x50\x41\x55\x53\x45\x20\x41\x43\x57\x20\x69\x6E\x20\x61\x6C\x6C\x20\x71\x75\x65\x75\x65\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x61\x67\x65\x6E\x74\x20","\x61\x63\x74\x69\x6F\x6E","\x61\x67\x65\x6E\x74\x70\x61\x75\x73\x65","\x72\x65\x61\x73\x6F\x6E","\x70\x61\x75\x73\x65\x64","\x31","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x5B\x61\x63\x77\x5D\x20\x61\x67\x65\x6E\x74\x20\x61\x63\x77\x20\x20","\x63\x61\x74\x63\x68","\x6C\x65\x6E\x67\x74\x68","\x61\x67\x65\x6E\x74\x63\x6F\x6D\x70\x6C\x65\x74\x65\x41\x74","\x73\x65\x63\x6F\x6E\x64\x73","\x64\x69\x66\x66","\x5B\x61\x63\x77\x5D\x20\x61\x67\x65\x6E\x74\x20\x61\x63\x77\x20","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x20\x75\x70\x64\x61\x74\x65\x64\x20\x73\x65\x63\x6F\x6E\x64\x73\x20","\x20\x41\x43\x57\x20\x69\x6E\x20\x71\x75\x65\x75\x65\x20","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x5B\x61\x63\x77\x5D\x20\x61\x67\x65\x6E\x74\x20\x61\x63\x77\x20\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x21","\x66\x69\x6E\x64\x41\x6C\x6C","\x5B\x61\x63\x77\x5D\x20\x61\x67\x65\x6E\x74\x20\x61\x63\x77\x20\x75\x70\x64\x61\x74\x65\x20\x65\x72\x72\x6F\x72\x3A\x20\x20","\x5B\x61\x63\x77\x5D\x20\x61\x67\x65\x6E\x74\x20\x61\x63\x77\x20\x75\x70\x64\x61\x74\x65\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x64\x65\x73\x74\x75\x6E\x69\x71\x75\x65\x69\x64","\x75\x70\x64\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];var moment=require(_0x8aac[0]);var asteriskManager=null;function ACW(_0xc59ax4){console[_0x8aac[2]](_0x8aac[1]);asteriskManager=_0xc59ax4;}ACW[_0x8aac[4]][_0x8aac[3]]=function(_0xc59ax5){if(asteriskManager&&asteriskManager[_0x8aac[5]]()){if(_0xc59ax5[_0x8aac[6]]===_0x8aac[7]){asteriskManager[_0x8aac[17]]({action:_0x8aac[8],interface:_0xc59ax5[_0x8aac[6]],paused:true,reason:_0x8aac[9]},function(_0xc59ax6,_0xc59ax7){if(_0xc59ax6){console[_0x8aac[10]](_0xc59ax6);return ;};console[_0x8aac[2]](_0x8aac[11]+_0xc59ax5[_0x8aac[6]]);asteriskManager[_0x8aac[17]]({action:_0x8aac[8],interface:_0xc59ax5[_0x8aac[6]],queue:_0xc59ax5[_0x8aac[12]],paused:true,reason:_0x8aac[13]},function(_0xc59ax6,_0xc59ax7){if(_0xc59ax6){console[_0x8aac[10]](_0xc59ax6);return ;};console[_0x8aac[2]](_0x8aac[14]+_0xc59ax5[_0x8aac[12]]+_0x8aac[15]+_0xc59ax5[_0x8aac[6]]);findAndUpdateFlag(_0xc59ax5);setTimeout(function(){asteriskManager[_0x8aac[17]]({action:_0x8aac[8],interface:_0xc59ax5[_0x8aac[6]],paused:false},function(_0xc59ax6,_0xc59ax7){if(_0xc59ax6){console[_0x8aac[10]](_0xc59ax6)};console[_0x8aac[2]](_0x8aac[16]+_0xc59ax5[_0x8aac[6]]);})},5000);});})}}};ACW[_0x8aac[4]][_0x8aac[18]]=function(_0xc59ax5){if((_0xc59ax5[_0x8aac[19]]===_0x8aac[13]||_0xc59ax5[_0x8aac[19]]===_0x8aac[9])&&_0xc59ax5[_0x8aac[20]]===_0x8aac[21]){return }};function findAndUpdateTime(_0xc59ax5){var _0xc59ax9=require(_0x8aac[23])[_0x8aac[22]];_0xc59ax9[_0x8aac[37]]({where:{agentcomplete:true,agentacw:true,acwtime:null,queue:_0xc59ax5[_0x8aac[12]],interface:_0xc59ax5[_0x8aac[6]]}})[_0x8aac[34]](function(_0xc59axa){if(_0xc59axa[_0x8aac[26]]>0){var _0xc59ax9=_0xc59axa[_0xc59axa[_0x8aac[26]]-1];var _0xc59axb=moment()[_0x8aac[29]](_0xc59ax9[_0x8aac[27]],_0x8aac[28]);_0xc59ax9[_0x8aac[35]]({acwtime:_0xc59axb})[_0x8aac[34]](function(_0xc59ax7){console[_0x8aac[2]](_0x8aac[30]+_0xc59ax7[_0x8aac[31]]+_0x8aac[32]+_0xc59axb+_0x8aac[33]+_0xc59ax7[_0x8aac[12]])})[_0x8aac[25]](function(_0xc59ax6){console[_0x8aac[10]](_0x8aac[24]+_0xc59ax6)});}else {console[_0x8aac[10]]( new Error(_0x8aac[36]))}})[_0x8aac[25]](function(_0xc59ax6){console[_0x8aac[10]](_0x8aac[24]+_0xc59ax6)});}function findAndUpdateFlag(_0xc59ax5){var _0xc59ax9=require(_0x8aac[23])[_0x8aac[22]];_0xc59ax9[_0x8aac[42]]({agentacw:true},{where:{uniqueid:_0xc59ax5[_0x8aac[40]],destuniqueid:_0xc59ax5[_0x8aac[41]]}})[_0x8aac[34]](function(_0xc59ax9){console[_0x8aac[2]](_0x8aac[39])})[_0x8aac[25]](function(_0xc59ax6){console[_0x8aac[10]](_0x8aac[38]+_0xc59ax6)});}module[_0x8aac[43]]=ACW;
\ No newline at end of file
+var _0x8311=["\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(_0x8311[0]);var _=require(_0x8311[1]);var VoiceQueue=require(_0x8311[3])[_0x8311[2]];var Agent=require(_0x8311[3])[_0x8311[4]];var Action=require(_0x8311[3])[_0x8311[5]];var ReportAgent=require(_0x8311[3])[_0x8311[6]];var _voiceQueues;var _agents;var activeAcw={};function ACW(_0xaadexb){console[_0x8311[8]](_0x8311[7]);VoiceQueue[_0x8311[14]]()[_0x8311[12]](function(_0xaadex10){_voiceQueues=_0xaadex10;synchCollection(VoiceQueue,_voiceQueues,_0x8311[13]);return Agent[_0x8311[16]](_0x8311[15])[_0x8311[14]]()})[_0x8311[12]](function(_0xaadexd){_agents=_0xaadexd;synchCollection(Agent,_agents,_0x8311[10]);Action[_0x8311[11]](function(_0xaadexe,_0xaadexf){return onSave(_0xaadexe,_0xaadexf)})})[_0x8311[9]](function(_0xaadexc){console[_0x8311[8]](_0xaadexc)})}function onSave(_0xaadexe,_0xaadexf){if(_0xaadexe[_0x8311[13]]===_0x8311[17]&&activeAcw[_0xaadexf[_0x8311[18]][_0x8311[15]]]){var _0xaadex12;if(activeAcw[_0xaadexf[_0x8311[18]][_0x8311[15]]][_0x8311[17]]){_0xaadex12=activeAcw[_0xaadexf[_0x8311[18]][_0x8311[15]]][_0x8311[19]]}else {clearTimeout(activeAcw[_0xaadexf[_0x8311[18]][_0x8311[15]]][_0x8311[20]]);_0xaadex12=moment[_0x8311[23]](moment()-activeAcw[_0xaadexf[_0x8311[18]][_0x8311[15]]][_0x8311[22]])[_0x8311[21]]()};return ReportAgent[_0x8311[27]]({agentacw:true,acwtime:_0xaadex12},{where:{uniqueid:activeAcw[_0xaadexf[_0x8311[18]][_0x8311[15]]][_0x8311[24]],destuniqueid:activeAcw[_0xaadexf[_0x8311[18]][_0x8311[15]]][_0x8311[25]]},transaction:_0xaadexf[_0x8311[26]],individualHooks:true})[_0x8311[12]](function(){delete activeAcw[_0xaadexf[_0x8311[18]][_0x8311[15]]]})[_0x8311[9]](function(_0xaadexc){console[_0x8311[8]](_0xaadexc)})}}ACW[_0x8311[29]][_0x8311[28]]=function(_0xaadex13){var _0xaadex14=_[_0x8311[31]](_voiceQueues,{name:_0xaadex13[_0x8311[30]],acw:true});if(_0xaadex14){var _0xaadex15=_[_0x8311[31]](_agents,{name:_0xaadex13[_0x8311[32]]});Action[_0x8311[37]]({name:_0x8311[38],data1:_0x8311[36],data2:_0xaadex14[_0x8311[34]],data3:_0xaadex13[_0x8311[24]],data4:_0xaadex13[_0x8311[30]]},{body:{agent:_0xaadex15[_0x8311[10]],type:_0x8311[36]}})[_0x8311[12]](function(){console[_0x8311[8]](_0x8311[33]);activeAcw[_0xaadex15[_0x8311[10]]]={uniqueid:_0xaadex13[_0x8311[24]],destuniqueid:_0xaadex13[_0x8311[25]],acwTime:_0xaadex14[_0x8311[34]],acwAt:moment(),unpause:false};activeAcw[_0xaadex15[_0x8311[10]]][_0x8311[20]]=setTimeout(function(){console[_0x8311[8]](_0x8311[35]);activeAcw[_0xaadex15[_0x8311[10]]][_0x8311[17]]=true;return Action[_0x8311[37]]({name:_0x8311[17],data1:_0x8311[36],data2:_0xaadex14[_0x8311[34]],data3:_0xaadex13[_0x8311[24]],data4:_0xaadex13[_0x8311[30]]},{body:{agent:_0xaadex15[_0x8311[10]],type:_0x8311[36]}})[_0x8311[9]](function(_0xaadexc){console[_0x8311[8]](_0xaadexc)})},_0xaadex14[_0x8311[34]]*1000)})[_0x8311[9]](function(_0xaadexc){console[_0x8311[8]](_0xaadexc)})}};function synchCollection(_0xaadex17,_0xaadex18,_0xaadex19){var _0xaadex1a={};_0xaadex17[_0x8311[11]](function(_0xaadexe){_0xaadex1a[_0xaadex19]=_0xaadexe[_0xaadex19];updateCollection(_0xaadex18,_0xaadexe,_0xaadex1a)});_0xaadex17[_0x8311[39]](function(_0xaadexe){_0xaadex1a[_0xaadex19]=_0xaadexe[_0xaadex19];updateCollection(_0xaadex18,_0xaadexe,_0xaadex1a)});_0xaadex17[_0x8311[41]](function(_0xaadexe){_0xaadex1a[_0xaadex19]=_0xaadexe[_0xaadex19];_[_0x8311[40]](_0xaadex18,_0xaadex1a)})}function updateCollection(_0xaadex1c,_0xaadexe,_0xaadex1a){var _0xaadex1d=_[_0x8311[31]](_0xaadex1c,_0xaadex1a);var _0xaadex1e=_0xaadex1c[_0x8311[42]](_0xaadex1d);if(_0xaadex1d){_[_0x8311[43]](_0xaadex1c[_0xaadex1e],_0xaadexe)}else {_0xaadex1c[_0x8311[44]](_0xaadexe)}}module[_0x8311[45]]=ACW
\ No newline at end of file