Built motion from commit f524ee855.|1.0.27
[motion.git] / server / config / forked_routing / chat / queue.js
1 var _0x4e1b=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x6D\x6F\x6D\x65\x6E\x74","\x63\x68\x61\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x72\x70\x63\x2F\x63\x6C\x69\x65\x6E\x74","\x65\x78\x70\x6F\x72\x74\x73","\x6D\x65\x73\x73\x61\x67\x65","\x74\x6F\x55\x70\x70\x65\x72\x43\x61\x73\x65","\x63\x68\x61\x6E\x6E\x65\x6C","\x41\x50\x50\x20\x51\x55\x45\x55\x45\x2C\x20\x51\x55\x45\x55\x45\x3A","\x6E\x61\x6D\x65","\x53\x54\x52\x41\x54\x45\x47\x59\x3A","\x73\x74\x72\x61\x74\x65\x67\x79","\x49\x4E\x54\x45\x52\x41\x43\x54\x49\x4F\x4E\x3A","\x75\x6E\x69\x71\x75\x65\x69\x64","\x41\x47\x45\x4E\x54","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x52\x45\x4A\x45\x43\x54\x45\x44","\x69\x6E\x66\x6F","\x69\x64","\x70\x75\x73\x68","\x72\x65\x6A\x65\x63\x74","\x74\x79\x70\x65","\x6F\x6E","\x66\x69\x6E\x64","\x74\x69\x6D\x65\x6F\x75\x74","\x6C\x65\x6E\x67\x74\x68","\x6D\x61\x70","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x6F\x6E\x6C\x69\x6E\x65","\x63\x68\x61\x74\x50\x61\x75\x73\x65","\x63\x68\x61\x74\x43\x61\x70\x61\x63\x69\x74\x79","\x46\x49\x45\x4C\x44\x28\x55\x73\x65\x72\x2E\x69\x64\x2C\x25\x73\x29","\x6A\x6F\x69\x6E","\x66\x6F\x72\x6D\x61\x74","\x45\x52\x52\x4F\x52","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x3A\x73\x61\x76\x65","\x65\x6D\x69\x74","\x61\x67\x65\x6E\x74\x3A\x25\x64","\x6D\x65\x6D\x62\x65\x72\x69\x64","\x74\x6F","\x63\x61\x70\x61\x63\x69\x74\x79","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x41\x47\x45\x4E\x54\x20\x53\x45\x4C\x45\x43\x54\x45\x44\x3A","\x66\x69\x6E\x64\x49\x6E\x64\x65\x78","\x73\x70\x6C\x69\x63\x65","\x68\x65\x61\x64","\x63\x72\x65\x61\x74\x65","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74","\x71\x75\x65\x75\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x6D\x65\x72\x67\x65","\x72\x65\x71\x75\x65\x73\x74","\x4E\x4F\x20\x41\x56\x41\x49\x4C\x41\x42\x4C\x45\x20\x41\x47\x45\x4E\x54\x53","\x6B\x65\x79\x42\x79","\x69\x6E\x64\x65\x78","\x55\x73\x65\x72","\x71\x75\x65\x72\x79","\x53\x45\x4C\x45\x43\x54\x20\x6D\x65\x6D\x62\x65\x72\x69\x64\x20\x61\x73\x20\x69\x64\x2C\x20\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65\x2C\x20\x63\x6F\x75\x6E\x74\x28\x2A\x29\x20\x41\x53\x20\x63\x61\x70\x61\x63\x69\x74\x79\x20\x46\x52\x4F\x4D\x20\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x5F\x73\x65\x73\x73\x69\x6F\x6E\x20\x57\x48\x45\x52\x45\x20\x63\x6F\x6D\x70\x6C\x65\x74\x65\x3D\x30\x20\x41\x4E\x44\x20\x74\x69\x6D\x65\x6F\x75\x74\x3D\x30\x20\x41\x4E\x44\x20\x61\x62\x61\x6E\x64\x6F\x6E\x3D\x30\x20\x41\x4E\x44\x20\x6D\x65\x6D\x62\x65\x72\x69\x64\x20\x49\x53\x20\x4E\x4F\x54\x20\x4E\x55\x4C\x4C\x20\x47\x52\x4F\x55\x50\x20\x42\x59\x20\x6D\x65\x6D\x62\x65\x72\x69\x64\x2C\x20\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x45\x4E\x44\x20\x28\x4E\x4F\x20\x41\x4E\x53\x57\x45\x52\x20\x42\x59\x20\x41\x47\x45\x4E\x54\x53\x29","\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x5F\x73\x65\x73\x73\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x61\x64\x6D\x69\x6E\x73","\x75\x73\x65\x72\x73","\x75\x70\x64\x61\x74\x65","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x51\x75\x65\x75\x65\x2E\x70\x65\x6E\x61\x6C\x74\x79","\x67\x72\x6F\x75\x70\x42\x79","\x76\x61\x6C\x75\x65\x73","\x72\x65\x6D\x6F\x76\x65","\x63\x6C\x6F\x6E\x65","\x61\x6C\x6C","\x73\x68\x6F\x77","\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x43\x68\x61\x74\x51\x75\x65\x75\x65\x49\x64","\x6C\x61\x73\x74\x41\x67\x65\x6E\x74","\x72\x65\x73\x6F\x6C\x76\x65","\x62\x65\x65\x70\x61\x6C\x6C","\x70\x65\x6E\x61\x6C\x74\x79","\x55\x73\x65\x72\x48\x61\x73\x43\x68\x61\x74\x51\x75\x65\x75\x65","\x73\x6F\x72\x74\x42\x79","\x72\x6F\x75\x6E\x64\x72\x6F\x62\x69\x6E","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x63\x68\x61\x74\x5F\x72\x6F\x6F\x6D\x3A\x73\x61\x76\x65","\x72\x6F\x6F\x6D\x69\x64","\x54\x49\x4D\x45\x4F\x55\x54","\x53\x45\x43"];_0x4e1b[0];var _=require(_0x4e1b[1]);var util=require(_0x4e1b[2]);var moment=require(_0x4e1b[3]);var logger=require(_0x4e1b[5])(_0x4e1b[4]);var rpcClient=require(_0x4e1b[6]);module[_0x4e1b[7]]= function(_0x9d57x6,_0x9d57x7,_0x9d57x8,_0x9d57x9){var _0x9d57xa=[];var _0x9d57xb;var _0x9d57xc;var _0x9d57xd;var _0x9d57xe=0;process[_0x4e1b[25]](_0x4e1b[8],function(_0x9d57xf){switch(_0x9d57xf[_0x4e1b[24]]){case _0x4e1b[23]:logger[_0x4e1b[20]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[17],_0x9d57xf[_0x4e1b[18]],_0x4e1b[19]);_0x9d57xa[_0x4e1b[22]]({id:_0x9d57xf[_0x4e1b[21]]});break;default:}});function _0x9d57x10(_0x9d57x11){var _0x9d57x12=_[_0x4e1b[26]](_0x9d57xa,{id:_0x9d57x11[_0x4e1b[21]]});return _0x9d57x12?true:false}function _0x9d57x13(){var _0x9d57x14=((_0x9d57x6[_0x4e1b[27]]- _0x9d57xe)> _0x9d57xd[_0x4e1b[27]])?_0x9d57xd[_0x4e1b[27]]:(_0x9d57x6[_0x4e1b[27]]- _0x9d57xe);var _0x9d57x15;if(_0x9d57x14> 0){if(_0x9d57xc[_0x4e1b[28]]){var _0x9d57x16={where:{id:{$in:_[_0x4e1b[29]](_0x9d57xc,_0x4e1b[21])},online:true,chatPause:false},include:[{model:_0x4e1b[30],attributes:[_0x4e1b[21]],raw:true}],attributes:[_0x4e1b[21],_0x4e1b[12],_0x4e1b[31],_0x4e1b[32],_0x4e1b[33],_0x4e1b[34]],order:[[{raw:util[_0x4e1b[37]](_0x4e1b[35],_[_0x4e1b[29]](_0x9d57xc,_0x4e1b[21])[_0x4e1b[36]]())}]]};return rpcClient[_0x4e1b[58]](_0x4e1b[63],[_0x4e1b[64]])[_0x4e1b[41]](function(_0x9d57x7){_0x9d57x15= _[_0x4e1b[60]](_0x9d57x7,_0x4e1b[21]);return rpcClient[_0x4e1b[58]](_0x4e1b[61],[_0x4e1b[62],_0x9d57x16])})[_0x4e1b[41]](function(_0x9d57x19){if(_0x9d57x19[_0x4e1b[28]]){var _0x9d57x1a;for(var _0x9d57x1b=0;_0x9d57x1b< _0x9d57x19[_0x4e1b[28]];_0x9d57x1b++){var _0x9d57x11=_0x9d57x19[_0x9d57x1b];var _0x9d57x1c=false;if(_0x9d57x11[_0x4e1b[34]]> 0){if(_0x9d57x15[_0x9d57x11[_0x4e1b[21]]]&& _0x9d57x15[_0x9d57x11[_0x4e1b[21]]][_0x4e1b[48]](_0x4e1b[47])&& _0x9d57x15[_0x9d57x11[_0x4e1b[21]]][_0x4e1b[47]]>= _0x9d57x11[_0x4e1b[34]]){_0x9d57x1c= true}};if(!_0x9d57x10(_0x9d57x11)&&  !_0x9d57x1c){_0x9d57x1a= _0x9d57x11;break}};if(_0x9d57x1a){logger[_0x4e1b[20]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[49],_0x9d57x1a[_0x4e1b[21]],_0x9d57x1a[_0x4e1b[12]]);var _0x9d57x1d=_[_0x4e1b[50]](_0x9d57xc,{"\x69\x64":_0x9d57x1a[_0x4e1b[21]]});if(_0x9d57x1d>= 0){var _0x9d57x1e=_0x9d57xc[_0x4e1b[51]](_0x9d57x1d,1);if(_0x9d57x1e&& _0x9d57x1e[_0x4e1b[28]]){_0x9d57xc[_0x4e1b[22]](_[_0x4e1b[52]](_0x9d57x1e))}};return rpcClient[_0x4e1b[58]](_0x4e1b[53],[_0x4e1b[54],_[_0x4e1b[57]](_0x9d57x7,{timeslot:_0x9d57x14,application:_0x4e1b[55],membername:_0x9d57x1a[_0x4e1b[12]],memberid:_0x9d57x1a[_0x4e1b[21]],queue:_0x9d57xd[_0x4e1b[21]],queuename:_0x9d57xd[_0x4e1b[12]],calledAt:moment()[_0x4e1b[37]](_0x4e1b[56])})])};logger[_0x4e1b[20]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[59]);return}else {logger[_0x4e1b[20]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[59]);return}})[_0x4e1b[41]](function(_0x9d57x18){if(_0x9d57x18){_0x9d57x8[_0x4e1b[46]](util[_0x4e1b[37]](_0x4e1b[44],_0x9d57x18[_0x4e1b[45]]))[_0x4e1b[43]](_0x4e1b[42],_0x9d57x18)}})[_0x4e1b[41]](function(){_0x9d57xb= setTimeout(function(){_0x9d57xe+= _0x9d57xd[_0x4e1b[27]];_0x9d57x13()},_0x9d57x14* 1000)})[_0x4e1b[40]](function(_0x9d57x17){logger[_0x4e1b[39]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[38]);_0x9d57x9(_0x9d57x17)})}else {logger[_0x4e1b[20]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[59]);_0x9d57xb= setTimeout(function(){_0x9d57xe+= _0x9d57xd[_0x4e1b[27]];_0x9d57x13()},_0x9d57x14* 1000)}}else {return rpcClient[_0x4e1b[58]](_0x4e1b[69],[_0x4e1b[70],{leaveAt:moment()[_0x4e1b[37]](_0x4e1b[56]),timeout:true},{where:{uniqueid:_0x9d57x7[_0x4e1b[16]],leaveAt:null},individualHooks:true}])[_0x4e1b[41]](function(_0x9d57x1f){if(_0x9d57x1f&& _0x9d57x1f[_0x4e1b[28]]&& _0x9d57x1f[1][_0x4e1b[28]]){for(var _0x9d57x1b=0;_0x9d57x1b< _0x9d57x1f[1][_0x4e1b[28]];_0x9d57x1b++){var _0x9d57x20=_0x9d57x1f[1][_0x9d57x1b];_0x9d57x8[_0x4e1b[46]](_0x4e1b[67])[_0x4e1b[43]](_0x4e1b[66],_0x9d57x20);_0x9d57x8[_0x4e1b[46]](_0x4e1b[68])[_0x4e1b[43]](_0x4e1b[66],_0x9d57x20)}}})[_0x4e1b[41]](function(){logger[_0x4e1b[20]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[65]);clearTimeout(_0x9d57xb);_0x9d57x9()})[_0x4e1b[40]](function(_0x9d57x17){logger[_0x4e1b[39]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[38]);_0x9d57x9(_0x9d57x17)})}}function _0x9d57x21(){var _0x9d57x14=((_0x9d57x6[_0x4e1b[27]]- _0x9d57xe)> _0x9d57xd[_0x4e1b[27]])?_0x9d57xd[_0x4e1b[27]]:(_0x9d57x6[_0x4e1b[27]]- _0x9d57xe);if(_0x9d57x14> 0){var _0x9d57x15;return rpcClient[_0x4e1b[58]](_0x4e1b[63],[_0x4e1b[64]])[_0x4e1b[41]](function(_0x9d57x7){_0x9d57x15= _[_0x4e1b[60]](_0x9d57x7,_0x4e1b[21]);return rpcClient[_0x4e1b[58]](_0x4e1b[77],[_0x4e1b[78],{where:{id:_0x9d57x6[_0x4e1b[79]]},attributes:[_0x4e1b[21],_0x4e1b[12],_0x4e1b[27],_0x4e1b[14],_0x4e1b[80]],include:[{model:_0x4e1b[62],where:{online:true,chatPause:false},attributes:[_0x4e1b[21],_0x4e1b[12],_0x4e1b[31],_0x4e1b[32],_0x4e1b[33],_0x4e1b[34]],raw:true}]}])})[_0x4e1b[41]](function(_0x9d57x23){if(_0x9d57x23){var _0x9d57x24=_[_0x4e1b[73]](_[_0x4e1b[72]](_0x9d57x23.Users,_0x4e1b[71]));if(_0x9d57x24&& _0x9d57x24[_0x4e1b[28]]){var _0x9d57x25;for(var _0x9d57x1b=0;_0x9d57x1b< _0x9d57x24[_0x4e1b[28]];_0x9d57x1b++){_[_0x4e1b[74]](_0x9d57x24[_0x9d57x1b],function(_0x9d57x11){var _0x9d57x1c=false;if(_0x9d57x11[_0x4e1b[34]]> 0){if(_0x9d57x15[_0x9d57x11[_0x4e1b[21]]]&& _0x9d57x15[_0x9d57x11[_0x4e1b[21]]][_0x4e1b[48]](_0x4e1b[47])&& _0x9d57x15[_0x9d57x11[_0x4e1b[21]]][_0x4e1b[47]]>= _0x9d57x11[_0x4e1b[34]]){_0x9d57x1c= true}};return _0x9d57x10(_0x9d57x11)|| _0x9d57x1c});if(_0x9d57x24[_0x9d57x1b][_0x4e1b[28]]){_0x9d57x25= _0x9d57x24[_0x9d57x1b];break}};if(_0x9d57x25&& _0x9d57x25[_0x4e1b[28]]){var _0x9d57x26=_[_0x4e1b[29]](_0x9d57x25,function(_0x9d57x11){return _[_0x4e1b[75]](_[_0x4e1b[57]](_0x9d57x7,{timeslot:_0x9d57x14,application:_0x4e1b[55],membername:_0x9d57x11[_0x4e1b[12]],memberid:_0x9d57x11[_0x4e1b[21]],queue:_0x9d57xd[_0x4e1b[21]],queuename:_0x9d57xd[_0x4e1b[12]],calledAt:moment()[_0x4e1b[37]](_0x4e1b[56])}))});var _0x9d57x27=[];for(var _0x9d57x28=0;_0x9d57x28< _0x9d57x26[_0x4e1b[28]];_0x9d57x28++){_0x9d57x27[_0x4e1b[22]](rpcClient[_0x4e1b[58]](_0x4e1b[53],[_0x4e1b[54],_0x9d57x26[_0x9d57x28]]))};return Promise[_0x4e1b[76]](_0x9d57x27)}else {logger[_0x4e1b[20]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[59])}}else {logger[_0x4e1b[20]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[59])}}else {logger[_0x4e1b[20]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[59])}})[_0x4e1b[41]](function(_0x9d57x22){if(_0x9d57x22&& _0x9d57x22[_0x4e1b[28]]){for(var _0x9d57x1b=0;_0x9d57x1b< _0x9d57x22[_0x4e1b[28]];_0x9d57x1b++){var _0x9d57x18=_0x9d57x22[_0x9d57x1b];_0x9d57x8[_0x4e1b[46]](util[_0x4e1b[37]](_0x4e1b[44],_0x9d57x18[_0x4e1b[45]]))[_0x4e1b[43]](_0x4e1b[42],_0x9d57x18)}};_0x9d57xb= setTimeout(function(){_0x9d57xe+= _0x9d57xd[_0x4e1b[27]];_0x9d57x21()},_0x9d57x14* 1000)})[_0x4e1b[40]](function(_0x9d57x17){logger[_0x4e1b[39]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[38]);_0x9d57x9(_0x9d57x17)})}else {return rpcClient[_0x4e1b[58]](_0x4e1b[69],[_0x4e1b[70],{leaveAt:moment()[_0x4e1b[37]](_0x4e1b[56]),timeout:true},{where:{uniqueid:_0x9d57x7[_0x4e1b[16]],leaveAt:null},individualHooks:true}])[_0x4e1b[41]](function(_0x9d57x1f){if(_0x9d57x1f&& _0x9d57x1f[_0x4e1b[28]]&& _0x9d57x1f[1][_0x4e1b[28]]){for(var _0x9d57x1b=0;_0x9d57x1b< _0x9d57x1f[1][_0x4e1b[28]];_0x9d57x1b++){var _0x9d57x20=_0x9d57x1f[1][_0x9d57x1b];_0x9d57x8[_0x4e1b[46]](_0x4e1b[67])[_0x4e1b[43]](_0x4e1b[66],_0x9d57x20);_0x9d57x8[_0x4e1b[46]](_0x4e1b[68])[_0x4e1b[43]](_0x4e1b[66],_0x9d57x20)}};logger[_0x4e1b[20]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[65]);clearTimeout(_0x9d57xb);_0x9d57x9();return Promise[_0x4e1b[81]]()})[_0x4e1b[40]](function(_0x9d57x17){logger[_0x4e1b[39]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[38]);_0x9d57x9(_0x9d57x17);return Promise[_0x4e1b[23]](_0x9d57x17)})}}return rpcClient[_0x4e1b[58]](_0x4e1b[77],[_0x4e1b[78],{where:{id:_0x9d57x6[_0x4e1b[79]]},attributes:[_0x4e1b[21],_0x4e1b[12],_0x4e1b[27],_0x4e1b[14],_0x4e1b[80]],include:[{model:_0x4e1b[62],attributes:[_0x4e1b[21]]}]}])[_0x4e1b[41]](function(_0x9d57x23){_0x9d57xd= _0x9d57x23;logger[_0x4e1b[20]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[90],_0x9d57x6[_0x4e1b[27]],_0x4e1b[91]);return rpcClient[_0x4e1b[58]](_0x4e1b[53],[_0x4e1b[70],_[_0x4e1b[57]](_0x9d57x7,{timeslot:_0x9d57x6[_0x4e1b[27]],application:_0x4e1b[55],queue:_0x9d57x23[_0x4e1b[21]],queuename:_0x9d57x23[_0x4e1b[12]],calledAt:moment()[_0x4e1b[37]](_0x4e1b[56]),joinAt:moment()[_0x4e1b[37]](_0x4e1b[56]),membername:null,memberid:null})])})[_0x4e1b[41]](function(_0x9d57x20){_0x9d57x8[_0x4e1b[46]](_0x4e1b[67])[_0x4e1b[43]](_0x4e1b[66],_0x9d57x20);_0x9d57x8[_0x4e1b[46]](_0x4e1b[68])[_0x4e1b[43]](_0x4e1b[66],_0x9d57x20);return rpcClient[_0x4e1b[58]](_0x4e1b[69],[_0x4e1b[30],{waiting:true},{where:{id:_0x9d57x7[_0x4e1b[89]]}}])})[_0x4e1b[41]](function(_0x9d57x29){if(_0x9d57x29){_0x9d57x8[_0x4e1b[43]](_0x4e1b[88],_0x9d57x29)}})[_0x4e1b[41]](function(_0x9d57x29){switch(_0x9d57xd[_0x4e1b[14]]){case _0x4e1b[82]:_0x9d57x21();break;case _0x4e1b[86]:_0x9d57xc= _[_0x4e1b[85]](_0x9d57xd.Users,[function(_0x9d57x2a){return _0x9d57x2a[_0x4e1b[84]][_0x4e1b[83]]|| 0}]);_0x9d57x13();break;case _0x4e1b[87]:_0x9d57xc= _[_0x4e1b[85]](_0x9d57xd.Users,[function(_0x9d57x2a){return _0x9d57x2a[_0x4e1b[84]][_0x4e1b[83]]|| 0}]);_0x9d57x13();break;default:};return Promise[_0x4e1b[81]]()})[_0x4e1b[40]](function(_0x9d57x17){logger[_0x4e1b[39]](_0x9d57x7[_0x4e1b[10]][_0x4e1b[9]](),_0x4e1b[11],_0x9d57xd[_0x4e1b[12]][_0x4e1b[9]](),_0x4e1b[13],_0x9d57xd[_0x4e1b[14]],_0x4e1b[15],_0x9d57x7[_0x4e1b[16]],_0x4e1b[38]);logger[_0x4e1b[39]](_0x9d57x17);_0x9d57x9(_0x9d57x17)})}