Built motion from commit 6f2e1b5.|0.0.58
[motion.git] / server / config / ami / acw.js
1 var _0x99f8=["\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","\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\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","\x55\x4E\x50\x41\x55\x53\x45\x44\x20\x42\x59\x20\x41\x43\x57","\x61\x63\x77\x54\x69\x6D\x65\x6F\x75\x74","\x75\x6E\x69\x71\x75\x65\x69\x64","\x41\x43\x57","\x76\x6F\x69\x63\x65","\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(_0x99f8[0]);var _=require(_0x99f8[1]);var VoiceQueue=require(_0x99f8[3])[_0x99f8[2]];var Agent=require(_0x99f8[3])[_0x99f8[4]];var Action=require(_0x99f8[3])[_0x99f8[5]];var _voiceQueues;var _agents;var activeAcw={};function ACW(_0x83a0xa){console[_0x99f8[7]](_0x99f8[6]);VoiceQueue[_0x99f8[13]]()[_0x99f8[11]](function(_0x83a0xf){_voiceQueues=_0x83a0xf;synchCollection(VoiceQueue,_voiceQueues,_0x99f8[12]);return Agent[_0x99f8[15]](_0x99f8[14])[_0x99f8[13]]()})[_0x99f8[11]](function(_0x83a0xc){_agents=_0x83a0xc;synchCollection(Agent,_agents,_0x99f8[9]);Action[_0x99f8[10]](function(_0x83a0xd,_0x83a0xe){return onSave(_0x83a0xd,_0x83a0xe,activeAcw)})})[_0x99f8[8]](function(_0x83a0xb){console[_0x99f8[7]](_0x83a0xb)})}function onSave(_0x83a0xd,_0x83a0xe,activeAcw){if(_0x83a0xd[_0x99f8[12]]===_0x99f8[16]&&activeAcw[_0x83a0xe[_0x99f8[17]][_0x99f8[14]]]){clearTimeout(activeAcw[_0x83a0xe[_0x99f8[17]][_0x99f8[14]]]);delete activeAcw[_0x83a0xe[_0x99f8[17]][_0x99f8[14]]]}}ACW[_0x99f8[19]][_0x99f8[18]]=function(_0x83a0x11){var _0x83a0x12=_[_0x99f8[21]](_voiceQueues,{name:_0x83a0x11[_0x99f8[20]],acw:true});if(_0x83a0x12){var _0x83a0x13=_[_0x99f8[21]](_agents,{name:_0x83a0x11[_0x99f8[22]]});Action[_0x99f8[29]]({name:_0x99f8[30],data1:_0x83a0x11[_0x99f8[20]],data2:_0x83a0x12[_0x99f8[25]],data3:_0x83a0x11[_0x99f8[26]],data4:_0x99f8[27]},{body:{agent:_0x83a0x13[_0x99f8[9]],type:_0x99f8[27]}})[_0x99f8[11]](function(){console[_0x99f8[7]](_0x99f8[23]);activeAcw[_0x83a0x13[_0x99f8[9]]]=setTimeout(function(){console[_0x99f8[7]](_0x99f8[24]);return Action[_0x99f8[29]]({name:_0x99f8[16],data1:_0x83a0x11[_0x99f8[20]],data2:_0x83a0x12[_0x99f8[25]],data3:_0x83a0x11[_0x99f8[26]],data4:_0x99f8[27]},{body:{agent:_0x83a0x13[_0x99f8[9]],type:_0x99f8[27],channel:_0x99f8[28]}})[_0x99f8[11]](function(){delete activeAcw[_0x83a0x13[_0x99f8[9]]]})[_0x99f8[8]](function(_0x83a0xb){console[_0x99f8[7]](_0x83a0xb)})},_0x83a0x12[_0x99f8[25]]*1000)})[_0x99f8[8]](function(_0x83a0xb){console[_0x99f8[7]](_0x83a0xb)})}};function synchCollection(_0x83a0x15,_0x83a0x16,_0x83a0x17){var _0x83a0x18={};_0x83a0x15[_0x99f8[10]](function(_0x83a0xd){_0x83a0x18[_0x83a0x17]=_0x83a0xd[_0x83a0x17];updateCollection(_0x83a0x16,_0x83a0xd,_0x83a0x18)});_0x83a0x15[_0x99f8[31]](function(_0x83a0xd){_0x83a0x18[_0x83a0x17]=_0x83a0xd[_0x83a0x17];updateCollection(_0x83a0x16,_0x83a0xd,_0x83a0x18)});_0x83a0x15[_0x99f8[33]](function(_0x83a0xd){_0x83a0x18[_0x83a0x17]=_0x83a0xd[_0x83a0x17];_[_0x99f8[32]](_0x83a0x16,_0x83a0x18)})}function updateCollection(_0x83a0x1a,_0x83a0xd,_0x83a0x18){var _0x83a0x1b=_[_0x99f8[21]](_0x83a0x1a,_0x83a0x18);var _0x83a0x1c=_0x83a0x1a[_0x99f8[34]](_0x83a0x1b);if(_0x83a0x1b){_[_0x99f8[35]](_0x83a0x1a[_0x83a0x1c],_0x83a0xd)}else {_0x83a0x1a[_0x99f8[36]](_0x83a0xd)}}module[_0x99f8[37]]=ACW