79454f64f9a8df92dfdc2e3669d2674dd1b5e701
[motion.git] / server / config / tools / queueParameters.js
1 var _0x6239=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x72\x65\x67\x69\x73\x74\x65\x72","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x6C\x65\x61\x76\x65\x41\x74","\x63\x68\x61\x6E\x67\x65\x64","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x61\x62\x61\x6E\x64\x6F\x6E","\x71\x75\x65\x75\x65\x63\x61\x6C\x6C\x65\x72\x63\x6F\x6D\x70\x6C\x65\x74\x65","\x67\x65\x74\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65\x73\x49\x64\x42\x79\x55\x73\x65\x72","\x74\x68\x65\x6E","\x69\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x55\x73\x65\x72","\x75\x73\x65\x72","\x66\x69\x6E\x64\x41\x6C\x6C","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x57\x41\x49\x54\x49\x4E\x47\x20\x45\x52\x52\x4F\x52","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6C\x65\x6E\x67\x74\x68","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x71\x75\x65\x75\x65","\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x3A\x70\x61\x72\x61\x6D\x65\x74\x65\x72\x73","\x65\x6D\x69\x74","\x72\x6F\x77\x73","\x66\x69\x6E\x64","\x6E\x61\x6D\x65","\x43\x4F\x55\x4E\x54","\x63\x6F\x6C","\x66\x6E","\x77\x61\x69\x74\x69\x6E\x67","\x75\x73\x65\x72\x49\x64","\x72\x6F\x6C\x65","\x61\x6C\x6C","\x41\x43\x54\x49\x56\x45\x20\x45\x52\x52\x4F\x52","\x61\x63\x74\x69\x76\x65","\x41\x42\x41\x4E\x44\x4F\x4E\x45\x44\x20\x45\x52\x52\x4F\x52","\x61\x62\x61\x6E\x64\x6F\x6E\x65\x64","\x41\x4E\x53\x57\x45\x52\x45\x44\x20\x45\x52\x52\x4F\x52","\x61\x6E\x73\x77\x65\x72\x65\x64","\x48\x4F\x4C\x44\x54\x49\x4D\x45\x20\x45\x52\x52\x4F\x52","\x30\x30\x3A\x30\x30\x3A\x30\x30","","\x53\x45\x4C\x45\x43\x54\x20\x71\x75\x65\x75\x65\x20\x41\x53\x20\x27\x6E\x61\x6D\x65\x27\x2C\x53\x45\x43\x5F\x54\x4F\x5F\x54\x49\x4D\x45\x28\x52\x4F\x55\x4E\x44\x28\x41\x56\x47\x28\x68\x6F\x6C\x64\x74\x69\x6D\x65\x29\x2C\x20\x30\x29\x29\x20\x61\x73\x20\x68\x6F\x6C\x64\x74\x69\x6D\x65\x20\x46\x52\x4F\x4D\x20\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x20\x57\x48\x45\x52\x45\x20\x61\x67\x65\x6E\x74\x63\x6F\x6D\x70\x6C\x65\x74\x65\x20\x3D\x20\x31\x20\x41\x4E\x44\x20\x71\x75\x65\x75\x65\x20\x3D\x27\x25\x73\x27\x20\x47\x52\x4F\x55\x50\x20\x42\x59\x20\x71\x75\x65\x75\x65","\x66\x6F\x72\x6D\x61\x74","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x71\x75\x65\x72\x79","\x54\x41\x4C\x4B\x54\x49\x4D\x45\x20\x45\x52\x52\x4F\x52","\x53\x45\x4C\x45\x43\x54\x20\x71\x75\x65\x75\x65\x20\x41\x53\x20\x27\x6E\x61\x6D\x65\x27\x2C\x53\x45\x43\x5F\x54\x4F\x5F\x54\x49\x4D\x45\x28\x52\x4F\x55\x4E\x44\x28\x41\x56\x47\x28\x74\x61\x6C\x6B\x74\x69\x6D\x65\x29\x2C\x20\x30\x29\x29\x20\x61\x73\x20\x74\x61\x6C\x6B\x74\x69\x6D\x65\x20\x46\x52\x4F\x4D\x20\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x20\x57\x48\x45\x52\x45\x20\x61\x67\x65\x6E\x74\x63\x6F\x6D\x70\x6C\x65\x74\x65\x20\x3D\x20\x31\x20\x41\x4E\x44\x20\x71\x75\x65\x75\x65\x20\x3D\x27\x25\x73\x27\x20\x47\x52\x4F\x55\x50\x20\x42\x59\x20\x71\x75\x65\x75\x65","\x54\x4F\x54\x41\x4C\x43\x41\x4C\x4C\x53\x20\x45\x52\x52\x4F\x52","\x53\x45\x4C\x45\x43\x54\x20\x71\x75\x65\x75\x65\x20\x41\x53\x20\x27\x6E\x61\x6D\x65\x27\x2C\x43\x4F\x55\x4E\x54\x28\x64\x69\x73\x74\x69\x6E\x63\x74\x20\x75\x6E\x69\x71\x75\x65\x69\x64\x29\x20\x61\x73\x20\x74\x6F\x74\x61\x6C\x63\x61\x6C\x6C\x73\x20\x46\x52\x4F\x4D\x20\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x20\x57\x48\x45\x52\x45\x20\x71\x75\x65\x75\x65\x20\x3D\x27\x25\x73\x27\x20\x47\x52\x4F\x55\x50\x20\x42\x59\x20\x71\x75\x65\x75\x65","\x55\x4E\x4D\x41\x4E\x41\x47\x45\x44\x20\x45\x52\x52\x4F\x52","\x75\x6E\x6D\x61\x6E\x61\x67\x65\x64"];_0x6239[0];var sequelize=require(_0x6239[2])[_0x6239[1]];var models=require(_0x6239[2]);var Util=require(_0x6239[3]);var Promise=require(_0x6239[4]);var _=require(_0x6239[5]);var util=require(_0x6239[6]);exports[_0x6239[7]]= function(_0xf042x7){models[_0x6239[9]][_0x6239[8]](function(_0xf042x8){onWaiting(_0xf042x7,_0xf042x8)});models[_0x6239[9]][_0x6239[12]](function(_0xf042x8){if(_0xf042x8[_0x6239[11]](_0x6239[10])){onWaiting(_0xf042x7,_0xf042x8);onActive(_0xf042x7,_0xf042x8)}});models[_0x6239[9]][_0x6239[12]](function(_0xf042x8){if(_0xf042x8[_0x6239[11]](_0x6239[13])|| _0xf042x8[_0x6239[11]](_0x6239[14])){onAbandon(_0xf042x7,_0xf042x8);onComplete(_0xf042x7,_0xf042x8);onActive(_0xf042x7,_0xf042x8);onAvgAnswerTime(_0xf042x7,_0xf042x8);onAvgTalkTime(_0xf042x7,_0xf042x8);onTotalOffered(_0xf042x7,_0xf042x8);onUnmanaged(_0xf042x7,_0xf042x8)}})};function getQueues(_0xf042xa,_0xf042xb){return function(){switch(_0xf042xb){case _0x6239[20]:return models[_0x6239[19]][_0x6239[18]](_0xf042xa,{attributes:[_0x6239[17]]})[_0x6239[16]](Util[_0x6239[15]]());default:return models[_0x6239[22]][_0x6239[21]]()[_0x6239[16]](function(_0xf042xc){return {rows:_0xf042xc}})}}}function onWaiting(_0xf042x7,_0xf042x8){return Promise[_0x6239[40]]([])[_0x6239[16]](getQueues(_0xf042x7[_0x6239[38]],_0xf042x7[_0x6239[39]]))[_0x6239[16]](function(_0xf042x11){if(_0xf042x11[_0x6239[31]][_0x6239[26]]){return models[_0x6239[9]][_0x6239[21]]({where:{queuecallerleaveAt:null,queue:_[_0x6239[32]](_0xf042x11[_0x6239[31]],{name:_0xf042x8[_0x6239[28]]})?_0xf042x8[_0x6239[28]]:[]},group:_0x6239[28],attributes:[[_0x6239[28],_0x6239[33]],[sequelize[_0x6239[36]](_0x6239[34],sequelize[_0x6239[35]](_0x6239[17])),_0x6239[37]]]})};return null})[_0x6239[16]](function(_0xf042xf){if(_0xf042xf){var _0xf042x10;if(_0xf042xf[_0x6239[26]]){_0xf042x10= _0xf042xf[0][_0x6239[27]]}else {_0xf042x10= {name:_0xf042x8[_0x6239[28]],waiting:0}};_0xf042x7[_0x6239[30]](_0x6239[29],_0xf042x10)}})[_0x6239[25]](function(_0xf042xe){console[_0x6239[24]](_0x6239[23],_0xf042xe)})}function onActive(_0xf042x7,_0xf042x8){return Promise[_0x6239[40]]([])[_0x6239[16]](getQueues(_0xf042x7[_0x6239[38]],_0xf042x7[_0x6239[39]]))[_0x6239[16]](function(_0xf042x11){if(_0xf042x11[_0x6239[31]][_0x6239[26]]){return models[_0x6239[9]][_0x6239[21]]({where:{queuecallerexit:false,queuecallerabandon:false,queuecallercomplete:false,queuecallerleaveAt:{$ne:null},queue:_[_0x6239[32]](_0xf042x11[_0x6239[31]],{name:_0xf042x8[_0x6239[28]]})?_0xf042x8[_0x6239[28]]:[]},group:_0x6239[28],attributes:[[_0x6239[28],_0x6239[33]],[sequelize[_0x6239[36]](_0x6239[34],sequelize[_0x6239[35]](_0x6239[17])),_0x6239[42]]]})};return null})[_0x6239[16]](function(_0xf042x13){if(_0xf042x13){var _0xf042x10;if(_0xf042x13[_0x6239[26]]){_0xf042x10= _0xf042x13[0][_0x6239[27]]}else {_0xf042x10= {name:_0xf042x8[_0x6239[28]],active:0}};_0xf042x7[_0x6239[30]](_0x6239[29],_0xf042x10)}})[_0x6239[25]](function(_0xf042xe){console[_0x6239[24]](_0x6239[41],_0xf042xe)})}function onAbandon(_0xf042x7,_0xf042x8){return Promise[_0x6239[40]]([])[_0x6239[16]](getQueues(_0xf042x7[_0x6239[38]],_0xf042x7[_0x6239[39]]))[_0x6239[16]](function(_0xf042x11){if(_0xf042x11[_0x6239[31]][_0x6239[26]]){return models[_0x6239[9]][_0x6239[21]]({where:{queuecallerabandon:true,queue:_[_0x6239[32]](_0xf042x11[_0x6239[31]],{name:_0xf042x8[_0x6239[28]]})?_0xf042x8[_0x6239[28]]:[]},group:_0x6239[28],attributes:[[_0x6239[28],_0x6239[33]],[sequelize[_0x6239[36]](_0x6239[34],sequelize[_0x6239[35]](_0x6239[17])),_0x6239[44]]]})};return null})[_0x6239[16]](function(_0xf042x15){if(_0xf042x15){var _0xf042x10;if(_0xf042x15[_0x6239[26]]){_0xf042x10= _0xf042x15[0][_0x6239[27]]}else {_0xf042x10= {name:_0xf042x8[_0x6239[28]],abandoned:0}};_0xf042x7[_0x6239[30]](_0x6239[29],_0xf042x10)}})[_0x6239[25]](function(_0xf042xe){console[_0x6239[24]](_0x6239[43],_0xf042xe)})}function onComplete(_0xf042x7,_0xf042x8){return Promise[_0x6239[40]]([])[_0x6239[16]](getQueues(_0xf042x7[_0x6239[38]],_0xf042x7[_0x6239[39]]))[_0x6239[16]](function(_0xf042x11){if(_0xf042x11[_0x6239[31]][_0x6239[26]]){return models[_0x6239[9]][_0x6239[21]]({where:{queuecallercomplete:true,queue:_[_0x6239[32]](_0xf042x11[_0x6239[31]],{name:_0xf042x8[_0x6239[28]]})?_0xf042x8[_0x6239[28]]:[]},group:_0x6239[28],attributes:[[_0x6239[28],_0x6239[33]],[sequelize[_0x6239[36]](_0x6239[34],sequelize[_0x6239[35]](_0x6239[17])),_0x6239[46]]]})};return null})[_0x6239[16]](function(_0xf042x17){if(_0xf042x17){var _0xf042x10;if(_0xf042x17[_0x6239[26]]){_0xf042x10= _0xf042x17[0][_0x6239[27]]}else {_0xf042x10= {name:_0xf042x8[_0x6239[28]],answered:0}};_0xf042x7[_0x6239[30]](_0x6239[29],_0xf042x10)}})[_0x6239[25]](function(_0xf042xe){console[_0x6239[24]](_0x6239[45],_0xf042xe)})}function onAvgAnswerTime(_0xf042x7,_0xf042x8){return Promise[_0x6239[40]]([])[_0x6239[16]](getQueues(_0xf042x7[_0x6239[38]],_0xf042x7[_0x6239[39]]))[_0x6239[16]](function(_0xf042x11){if(_0xf042x11[_0x6239[31]][_0x6239[26]]){var _0xf042x1a=_[_0x6239[32]](_0xf042x11[_0x6239[31]],{name:_0xf042x8[_0x6239[28]]})?_0xf042x8[_0x6239[28]]:_0x6239[49];var _0xf042x1b=util[_0x6239[51]](_0x6239[50],_0xf042x1a);return sequelize[_0x6239[54]](_0xf042x1b,{type:sequelize[_0x6239[53]][_0x6239[52]]})};return null})[_0x6239[16]](function(_0xf042x19){if(_0xf042x19){var _0xf042x10;if(_0xf042x19[_0x6239[26]]){_0xf042x10= _0xf042x19[0]}else {_0xf042x10= {name:_0xf042x8[_0x6239[28]],holdtime:_0x6239[48]}};_0xf042x7[_0x6239[30]](_0x6239[29],_0xf042x10)}})[_0x6239[25]](function(_0xf042xe){console[_0x6239[24]](_0x6239[47],_0xf042xe)})}function onAvgTalkTime(_0xf042x7,_0xf042x8){return Promise[_0x6239[40]]([])[_0x6239[16]](getQueues(_0xf042x7[_0x6239[38]],_0xf042x7[_0x6239[39]]))[_0x6239[16]](function(_0xf042x11){if(_0xf042x11[_0x6239[31]][_0x6239[26]]){var _0xf042x1a=_[_0x6239[32]](_0xf042x11[_0x6239[31]],{name:_0xf042x8[_0x6239[28]]})?_0xf042x8[_0x6239[28]]:_0x6239[49];return sequelize[_0x6239[54]](util[_0x6239[51]](_0x6239[56],_0xf042x1a),{type:sequelize[_0x6239[53]][_0x6239[52]]})};return null})[_0x6239[16]](function(_0xf042x1d){if(_0xf042x1d){var _0xf042x10;if(_0xf042x1d[_0x6239[26]]){_0xf042x10= _0xf042x1d[0]}else {_0xf042x10= {name:_0xf042x8[_0x6239[28]],talktime:_0x6239[48]}};_0xf042x7[_0x6239[30]](_0x6239[29],_0xf042x10)}})[_0x6239[25]](function(_0xf042xe){console[_0x6239[24]](_0x6239[55],_0xf042xe)})}function onTotalOffered(_0xf042x7,_0xf042x8){return Promise[_0x6239[40]]([])[_0x6239[16]](getQueues(_0xf042x7[_0x6239[38]],_0xf042x7[_0x6239[39]]))[_0x6239[16]](function(_0xf042x11){if(_0xf042x11[_0x6239[31]][_0x6239[26]]){var _0xf042x1a=_[_0x6239[32]](_0xf042x11[_0x6239[31]],{name:_0xf042x8[_0x6239[28]]})?_0xf042x8[_0x6239[28]]:_0x6239[49];return sequelize[_0x6239[54]](util[_0x6239[51]](_0x6239[58],_0xf042x1a),{type:sequelize[_0x6239[53]][_0x6239[52]]})};return null})[_0x6239[16]](function(_0xf042x1f){if(_0xf042x1f){var _0xf042x10;if(_0xf042x1f[_0x6239[26]]){_0xf042x10= _0xf042x1f[0]}else {_0xf042x10= {name:_0xf042x8[_0x6239[28]],totalcalls:0}};_0xf042x7[_0x6239[30]](_0x6239[29],_0xf042x10)}})[_0x6239[25]](function(_0xf042xe){console[_0x6239[24]](_0x6239[57],_0xf042xe)})}function onUnmanaged(_0xf042x7,_0xf042x8){return Promise[_0x6239[40]]([])[_0x6239[16]](getQueues(_0xf042x7[_0x6239[38]],_0xf042x7[_0x6239[39]]))[_0x6239[16]](function(_0xf042x11){if(_0xf042x11[_0x6239[31]][_0x6239[26]]){return models[_0x6239[9]][_0x6239[21]]({where:{queuecallerexit:true,queue:_[_0x6239[32]](_0xf042x11[_0x6239[31]],{name:_0xf042x8[_0x6239[28]]})?_0xf042x8[_0x6239[28]]:[]},group:_0x6239[28],attributes:[[_0x6239[28],_0x6239[33]],[sequelize[_0x6239[36]](_0x6239[34],sequelize[_0x6239[35]](_0x6239[17])),_0x6239[60]]]})};return null})[_0x6239[16]](function(_0xf042x21){if(_0xf042x21){var _0xf042x10;if(_0xf042x21[_0x6239[26]]){_0xf042x10= _0xf042x21[0][_0x6239[27]]}else {_0xf042x10= {name:_0xf042x8[_0x6239[28]],_parameters:0}};_0xf042x7[_0x6239[30]](_0x6239[29],_0xf042x10)}})[_0x6239[25]](function(_0xf042xe){console[_0x6239[24]](_0x6239[59],_0xf042xe)})}