1 var _0x5617=["\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","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x52\x6F\x6F\x6D","\x4D\x61\x69\x6C\x51\x75\x65\x75\x65","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E","\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","\x6D\x61\x70","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x6F\x6E\x6C\x69\x6E\x65","\x6D\x61\x69\x6C\x50\x61\x75\x73\x65","\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","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\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","\x73\x68\x69\x66\x74","\x6C\x65\x6E\x67\x74\x68","\x67\x65\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","\x63\x72\x65\x61\x74\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E\x3A\x73\x61\x76\x65","\x61\x64\x6D\x69\x6E\x73","\x75\x73\x65\x72\x73","\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","\x75\x70\x64\x61\x74\x65","\x72\x65\x6D\x6F\x76\x65","\x63\x6C\x6F\x6E\x65","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x45\x52\x52\x4F\x52","\x55\x73\x65\x72\x48\x61\x73\x4D\x61\x69\x6C\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","\x62\x65\x65\x70\x61\x6C\x6C","\x55\x73\x65\x72\x73","\x72\x6F\x75\x6E\x64\x72\x6F\x62\x69\x6E","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x6D\x61\x69\x6C\x5F\x72\x6F\x6F\x6D\x3A\x73\x61\x76\x65","\x72\x6F\x6F\x6D\x69\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x54\x49\x4D\x45\x4F\x55\x54","\x53\x45\x43","\x6C\x61\x73\x74\x41\x67\x65\x6E\x74","\x70\x65\x6E\x61\x6C\x74\x79","\x41\x53\x43"];_0x5617[0];var _=require(_0x5617[1]);var util=require(_0x5617[2]);var moment=require(_0x5617[3]);var Agent=require(_0x5617[5])[_0x5617[4]];var Room=require(_0x5617[5])[_0x5617[6]];var Queue=require(_0x5617[5])[_0x5617[7]];var Report=require(_0x5617[5])[_0x5617[8]];var Session=require(_0x5617[5])[_0x5617[9]];module[_0x5617[10]]= function(_0x3cb8x9,_0x3cb8xa,_0x3cb8xb,_0x3cb8xc,_0x3cb8xd){var _0x3cb8xe=[];var _0x3cb8xf;var _0x3cb8x10;var _0x3cb8x11;var _0x3cb8x12=0;process[_0x5617[28]](_0x5617[11],function(_0x3cb8xb){switch(_0x3cb8xb[_0x5617[27]]){case _0x5617[26]:console[_0x5617[23]](_0x3cb8xa[_0x5617[13]][_0x5617[12]](),_0x5617[14],_0x3cb8x11[_0x5617[15]][_0x5617[12]](),_0x5617[16],_0x3cb8x11[_0x5617[17]],_0x5617[18],_0x3cb8xa[_0x5617[19]],_0x5617[20],_0x3cb8xb[_0x5617[21]],_0x5617[22]);_0x3cb8xe[_0x5617[25]]({id:_0x3cb8xb[_0x5617[24]]});break;default:}});function _0x3cb8x13(_0x3cb8x14){var _0x3cb8x15=_[_0x5617[29]](_0x3cb8xe,{id:_0x3cb8x14[_0x5617[24]]});return _0x3cb8x15?true:false}function _0x3cb8x16(){var _0x3cb8x17=((_0x3cb8x9[_0x5617[30]]- _0x3cb8x12)> _0x3cb8x11[_0x5617[30]])?_0x3cb8x11[_0x5617[30]]:(_0x3cb8x9[_0x5617[30]]- _0x3cb8x12);if(_0x3cb8x17> 0){var _0x3cb8x18={where:{id:{$in:_[_0x5617[31]](_0x3cb8x10,_0x5617[24])}},include:[{model:Room,attributes:[_0x5617[24]],raw:true}],attributes:[_0x5617[24],_0x5617[15],_0x5617[32],_0x5617[33],_0x5617[34]],order:[[{raw:util[_0x5617[37]](_0x5617[35],_[_0x5617[31]](_0x3cb8x10,_0x5617[24])[_0x5617[36]]())}]]};Agent[_0x5617[53]](_0x3cb8x18)[_0x5617[40]](function(_0x3cb8x1b){if(_0x3cb8x1b[_0x5617[47]]){_0x3cb8x10= _0x3cb8x1b;for(var _0x3cb8x1c=0;_0x3cb8x1c< _0x3cb8x10[_0x5617[47]];_0x3cb8x1c++){var _0x3cb8x1d=_0x3cb8x10[0][_0x5617[48]]({plain:true});if(!_0x3cb8x13(_0x3cb8x1d)){return Report[_0x5617[52]](_[_0x5617[51]](_0x3cb8xa,{timeslot:_0x3cb8x17,application:_0x5617[49],membername:_0x3cb8x1d[_0x5617[15]],memberid:_0x3cb8x1d[_0x5617[24]],queue:_0x3cb8x11[_0x5617[24]],queuename:_0x3cb8x11[_0x5617[15]],calledAt:moment()[_0x5617[37]](_0x5617[50])}))}else {var _0x3cb8x14=_0x3cb8x10[_0x5617[46]]();_0x3cb8x10[_0x5617[25]](_0x3cb8x14)}}}})[_0x5617[40]](function(_0x3cb8x1a){if(_0x3cb8x1a){_0x3cb8xc[_0x5617[45]](util[_0x5617[37]](_0x5617[43],_0x3cb8x1a[_0x5617[44]]))[_0x5617[42]](_0x5617[41],_0x3cb8x1a)};var _0x3cb8x14=_0x3cb8x10[_0x5617[46]]();_0x3cb8x10[_0x5617[25]](_0x3cb8x14)})[_0x5617[40]](function(){_0x3cb8xf= setTimeout(function(){_0x3cb8x12+= _0x3cb8x11[_0x5617[30]];_0x3cb8x16()},_0x3cb8x17* 1000)})[_0x5617[39]](function(_0x3cb8x19){console[_0x5617[38]](_0x3cb8x19)})}else {return Session[_0x5617[58]]({leaveAt:moment()[_0x5617[37]](_0x5617[50]),timeout:true},{where:{uniqueid:_0x3cb8xa[_0x5617[19]],leaveAt:null},individualHooks:true})[_0x5617[40]](function(_0x3cb8x1e){if(_0x3cb8x1e&& _0x3cb8x1e[_0x5617[47]]&& _0x3cb8x1e[1][_0x5617[47]]){for(var _0x3cb8x1c=0;_0x3cb8x1c< _0x3cb8x1e[1][_0x5617[47]];_0x3cb8x1c++){var _0x3cb8x1f=_0x3cb8x1e[1][_0x3cb8x1c][_0x5617[48]]({plain:true});_0x3cb8xc[_0x5617[45]](_0x5617[55])[_0x5617[42]](_0x5617[54],_0x3cb8x1f);_0x3cb8xc[_0x5617[45]](_0x5617[56])[_0x5617[42]](_0x5617[54],_0x3cb8x1f)}};console[_0x5617[23]](_0x3cb8xa[_0x5617[13]][_0x5617[12]](),_0x5617[14],_0x3cb8x11[_0x5617[15]][_0x5617[12]](),_0x5617[16],_0x3cb8x11[_0x5617[17]],_0x5617[18],_0x3cb8xa[_0x5617[19]],_0x5617[57]);clearTimeout(_0x3cb8xf);_0x3cb8xd()})}}function _0x3cb8x20(){var _0x3cb8x21=_0x3cb8x10[_0x5617[46]]();_0x3cb8x10[_0x5617[25]](_0x3cb8x21);var _0x3cb8x17=((_0x3cb8x9[_0x5617[30]]- _0x3cb8x12)> _0x3cb8x11[_0x5617[30]])?_0x3cb8x11[_0x5617[30]]:(_0x3cb8x9[_0x5617[30]]- _0x3cb8x12);if(_0x3cb8x17> 0){Agent[_0x5617[53]]({where:{id:{$in:_[_0x5617[31]](_0x3cb8x21,_0x5617[24])},online:true,mailPause:false},raw:true,attributes:[_0x5617[24],_0x5617[15],_0x5617[32],_0x5617[33],_0x5617[34]]})[_0x5617[40]](function(_0x3cb8x1b){_[_0x5617[59]](_0x3cb8x1b,function(_0x3cb8x14){return _0x3cb8x13(_0x3cb8x14)});var _0x3cb8x23=_[_0x5617[31]](_0x3cb8x1b,function(_0x3cb8x14){return _[_0x5617[60]](_[_0x5617[51]](_0x3cb8xa,{timeslot:_0x3cb8x17,application:_0x5617[49],membername:_0x3cb8x14[_0x5617[15]],memberid:_0x3cb8x14[_0x5617[24]],queue:_0x3cb8x11[_0x5617[24]],queuename:_0x3cb8x11[_0x5617[15]],calledAt:moment()[_0x5617[37]](_0x5617[50])}))});return Report[_0x5617[61]](_0x3cb8x23,{individualHooks:true})})[_0x5617[40]](function(_0x3cb8x22){if(_0x3cb8x22&& _0x3cb8x22[_0x5617[47]]){for(var _0x3cb8x1c=0;_0x3cb8x1c< _0x3cb8x22[_0x5617[47]];_0x3cb8x1c++){var _0x3cb8x1a=_0x3cb8x22[_0x3cb8x1c][_0x5617[48]]({plain:true});_0x3cb8xc[_0x5617[45]](util[_0x5617[37]](_0x5617[43],_0x3cb8x1a[_0x5617[44]]))[_0x5617[42]](_0x5617[41],_0x3cb8x1a)}};_0x3cb8xf= setTimeout(function(){_0x3cb8x12+= _0x3cb8x11[_0x5617[30]];_0x3cb8x20()},_0x3cb8x17* 1000)})}else {return Session[_0x5617[58]]({leaveAt:moment()[_0x5617[37]](_0x5617[50]),timeout:true},{where:{uniqueid:_0x3cb8xa[_0x5617[19]],leaveAt:null},individualHooks:true})[_0x5617[40]](function(_0x3cb8x1e){if(_0x3cb8x1e&& _0x3cb8x1e[_0x5617[47]]&& _0x3cb8x1e[1][_0x5617[47]]){for(var _0x3cb8x1c=0;_0x3cb8x1c< _0x3cb8x1e[1][_0x5617[47]];_0x3cb8x1c++){var _0x3cb8x1f=_0x3cb8x1e[1][_0x3cb8x1c][_0x5617[48]]({plain:true});_0x3cb8xc[_0x5617[45]](_0x5617[55])[_0x5617[42]](_0x5617[54],_0x3cb8x1f);_0x3cb8xc[_0x5617[45]](_0x5617[56])[_0x5617[42]](_0x5617[54],_0x3cb8x1f)}};console[_0x5617[23]](_0x3cb8xa[_0x5617[13]][_0x5617[12]](),_0x5617[14],_0x3cb8x11[_0x5617[15]][_0x5617[12]](),_0x5617[16],_0x3cb8x11[_0x5617[17]],_0x5617[18],_0x3cb8xa[_0x5617[19]],_0x5617[57]);clearTimeout(_0x3cb8xf);_0x3cb8xd()})}}return Queue[_0x5617[72]](_0x3cb8x9.MailQueueId,{attributes:[_0x5617[24],_0x5617[15],_0x5617[30],_0x5617[17],_0x5617[75]],include:[{model:Agent,attributes:[_0x5617[24]],raw:true,order:[[_0x5617[76],_0x5617[77]]]}]})[_0x5617[40]](function(_0x3cb8x25){_0x3cb8x11= _0x3cb8x25[_0x5617[48]]({plain:true});console[_0x5617[23]](_0x3cb8xa[_0x5617[13]][_0x5617[12]](),_0x5617[14],_0x3cb8x11[_0x5617[15]][_0x5617[12]](),_0x5617[16],_0x3cb8x11[_0x5617[17]],_0x5617[18],_0x3cb8xa[_0x5617[19]],_0x5617[73],_0x3cb8x9[_0x5617[30]],_0x5617[74]);return Session[_0x5617[52]](_[_0x5617[51]](_0x3cb8xa,{timeslot:_0x3cb8x9[_0x5617[30]],application:_0x5617[49],queue:_0x3cb8x25[_0x5617[24]],queuename:_0x3cb8x25[_0x5617[15]],calledAt:moment()[_0x5617[37]](_0x5617[50]),joinAt:moment()[_0x5617[37]](_0x5617[50]),membername:null,memberid:null}))})[_0x5617[40]](function(_0x3cb8x1f){_0x3cb8xc[_0x5617[45]](_0x5617[55])[_0x5617[42]](_0x5617[54],_0x3cb8x1f);_0x3cb8xc[_0x5617[45]](_0x5617[56])[_0x5617[42]](_0x5617[54],_0x3cb8x1f);return Room[_0x5617[72]](_0x3cb8xa[_0x5617[71]])})[_0x5617[40]](function(_0x3cb8x24){if(_0x3cb8x24){return _0x3cb8x24[_0x5617[58]]({waiting:true})}})[_0x5617[40]](function(_0x3cb8x24){if(_0x3cb8x24){_0x3cb8xc[_0x5617[42]](_0x5617[70],_0x3cb8x24[_0x5617[48]]({plain:true}))}})[_0x5617[40]](function(_0x3cb8x24){switch(_0x3cb8x11[_0x5617[17]]){case _0x5617[66]:_0x3cb8x10= _[_0x5617[65]](_[_0x5617[64]](_0x3cb8x11.Users,_0x5617[63]));_0x3cb8x20();break;case _0x5617[68]:_0x3cb8x10= _0x3cb8x11[_0x5617[67]];_0x3cb8x16();break;case _0x5617[69]:_0x3cb8x10= _0x3cb8x11[_0x5617[67]];_0x3cb8x16();break;default:}})[_0x5617[39]](function(_0x3cb8x19){console[_0x5617[38]](_0x3cb8xa[_0x5617[13]][_0x5617[12]](),_0x5617[14],_0x3cb8x11[_0x5617[15]][_0x5617[12]](),_0x5617[16],_0x3cb8x11[_0x5617[17]],_0x5617[18],_0x3cb8xa[_0x5617[19]],_0x5617[62]);console[_0x5617[38]](_0x3cb8x19);_0x3cb8xd(_0x3cb8x19)})}