01b589c9442f01dea52b4a701a9401d3d2c4d740
[motion.git] / server / config / forked_routing / mail / queue.js
1 var _0x40b6=["\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"];_0x40b6[0];var _=require(_0x40b6[1]);var util=require(_0x40b6[2]);var moment=require(_0x40b6[3]);var Agent=require(_0x40b6[5])[_0x40b6[4]];var Room=require(_0x40b6[5])[_0x40b6[6]];var Queue=require(_0x40b6[5])[_0x40b6[7]];var Report=require(_0x40b6[5])[_0x40b6[8]];var Session=require(_0x40b6[5])[_0x40b6[9]];module[_0x40b6[10]]= function(_0xe1f5x9,_0xe1f5xa,_0xe1f5xb,_0xe1f5xc,_0xe1f5xd){var _0xe1f5xe=[];var _0xe1f5xf;var _0xe1f5x10;var _0xe1f5x11;var _0xe1f5x12=0;process[_0x40b6[28]](_0x40b6[11],function(_0xe1f5xb){switch(_0xe1f5xb[_0x40b6[27]]){case _0x40b6[26]:console[_0x40b6[23]](_0xe1f5xa[_0x40b6[13]][_0x40b6[12]](),_0x40b6[14],_0xe1f5x11[_0x40b6[15]][_0x40b6[12]](),_0x40b6[16],_0xe1f5x11[_0x40b6[17]],_0x40b6[18],_0xe1f5xa[_0x40b6[19]],_0x40b6[20],_0xe1f5xb[_0x40b6[21]],_0x40b6[22]);_0xe1f5xe[_0x40b6[25]]({id:_0xe1f5xb[_0x40b6[24]]});break;default:}});function _0xe1f5x13(_0xe1f5x14){var _0xe1f5x15=_[_0x40b6[29]](_0xe1f5xe,{id:_0xe1f5x14[_0x40b6[24]]});return _0xe1f5x15?true:false}function _0xe1f5x16(){var _0xe1f5x17=((_0xe1f5x9[_0x40b6[30]]- _0xe1f5x12)> _0xe1f5x11[_0x40b6[30]])?_0xe1f5x11[_0x40b6[30]]:(_0xe1f5x9[_0x40b6[30]]- _0xe1f5x12);if(_0xe1f5x17> 0){var _0xe1f5x18={where:{id:{$in:_[_0x40b6[31]](_0xe1f5x10,_0x40b6[24])},online:true,mailPause:false},include:[{model:Room,attributes:[_0x40b6[24]],raw:true}],attributes:[_0x40b6[24],_0x40b6[15],_0x40b6[32],_0x40b6[33],_0x40b6[34]],order:[[{raw:util[_0x40b6[37]](_0x40b6[35],_[_0x40b6[31]](_0xe1f5x10,_0x40b6[24])[_0x40b6[36]]())}]]};Agent[_0x40b6[53]](_0xe1f5x18)[_0x40b6[40]](function(_0xe1f5x1b){if(_0xe1f5x1b[_0x40b6[47]]){_0xe1f5x10= _0xe1f5x1b;for(var _0xe1f5x1c=0;_0xe1f5x1c< _0xe1f5x10[_0x40b6[47]];_0xe1f5x1c++){var _0xe1f5x1d=_0xe1f5x10[0][_0x40b6[48]]({plain:true});if(!_0xe1f5x13(_0xe1f5x1d)){return Report[_0x40b6[52]](_[_0x40b6[51]](_0xe1f5xa,{timeslot:_0xe1f5x17,application:_0x40b6[49],membername:_0xe1f5x1d[_0x40b6[15]],memberid:_0xe1f5x1d[_0x40b6[24]],queue:_0xe1f5x11[_0x40b6[24]],queuename:_0xe1f5x11[_0x40b6[15]],calledAt:moment()[_0x40b6[37]](_0x40b6[50])}))}else {var _0xe1f5x14=_0xe1f5x10[_0x40b6[46]]();_0xe1f5x10[_0x40b6[25]](_0xe1f5x14)}}}})[_0x40b6[40]](function(_0xe1f5x1a){if(_0xe1f5x1a){_0xe1f5xc[_0x40b6[45]](util[_0x40b6[37]](_0x40b6[43],_0xe1f5x1a[_0x40b6[44]]))[_0x40b6[42]](_0x40b6[41],_0xe1f5x1a)};var _0xe1f5x14=_0xe1f5x10[_0x40b6[46]]();_0xe1f5x10[_0x40b6[25]](_0xe1f5x14)})[_0x40b6[40]](function(){_0xe1f5xf= setTimeout(function(){_0xe1f5x12+= _0xe1f5x11[_0x40b6[30]];_0xe1f5x16()},_0xe1f5x17* 1000)})[_0x40b6[39]](function(_0xe1f5x19){console[_0x40b6[38]](_0xe1f5x19)})}else {return Session[_0x40b6[58]]({leaveAt:moment()[_0x40b6[37]](_0x40b6[50]),timeout:true},{where:{uniqueid:_0xe1f5xa[_0x40b6[19]],leaveAt:null},individualHooks:true})[_0x40b6[40]](function(_0xe1f5x1e){if(_0xe1f5x1e&& _0xe1f5x1e[_0x40b6[47]]&& _0xe1f5x1e[1][_0x40b6[47]]){for(var _0xe1f5x1c=0;_0xe1f5x1c< _0xe1f5x1e[1][_0x40b6[47]];_0xe1f5x1c++){var _0xe1f5x1f=_0xe1f5x1e[1][_0xe1f5x1c][_0x40b6[48]]({plain:true});_0xe1f5xc[_0x40b6[45]](_0x40b6[55])[_0x40b6[42]](_0x40b6[54],_0xe1f5x1f);_0xe1f5xc[_0x40b6[45]](_0x40b6[56])[_0x40b6[42]](_0x40b6[54],_0xe1f5x1f)}};console[_0x40b6[23]](_0xe1f5xa[_0x40b6[13]][_0x40b6[12]](),_0x40b6[14],_0xe1f5x11[_0x40b6[15]][_0x40b6[12]](),_0x40b6[16],_0xe1f5x11[_0x40b6[17]],_0x40b6[18],_0xe1f5xa[_0x40b6[19]],_0x40b6[57]);clearTimeout(_0xe1f5xf);_0xe1f5xd()})}}function _0xe1f5x20(){var _0xe1f5x21=_0xe1f5x10[_0x40b6[46]]();_0xe1f5x10[_0x40b6[25]](_0xe1f5x21);var _0xe1f5x17=((_0xe1f5x9[_0x40b6[30]]- _0xe1f5x12)> _0xe1f5x11[_0x40b6[30]])?_0xe1f5x11[_0x40b6[30]]:(_0xe1f5x9[_0x40b6[30]]- _0xe1f5x12);if(_0xe1f5x17> 0){Agent[_0x40b6[53]]({where:{id:{$in:_[_0x40b6[31]](_0xe1f5x21,_0x40b6[24])},online:true,mailPause:false},raw:true,attributes:[_0x40b6[24],_0x40b6[15],_0x40b6[32],_0x40b6[33],_0x40b6[34]]})[_0x40b6[40]](function(_0xe1f5x1b){_[_0x40b6[59]](_0xe1f5x1b,function(_0xe1f5x14){return _0xe1f5x13(_0xe1f5x14)});var _0xe1f5x23=_[_0x40b6[31]](_0xe1f5x1b,function(_0xe1f5x14){return _[_0x40b6[60]](_[_0x40b6[51]](_0xe1f5xa,{timeslot:_0xe1f5x17,application:_0x40b6[49],membername:_0xe1f5x14[_0x40b6[15]],memberid:_0xe1f5x14[_0x40b6[24]],queue:_0xe1f5x11[_0x40b6[24]],queuename:_0xe1f5x11[_0x40b6[15]],calledAt:moment()[_0x40b6[37]](_0x40b6[50])}))});return Report[_0x40b6[61]](_0xe1f5x23,{individualHooks:true})})[_0x40b6[40]](function(_0xe1f5x22){if(_0xe1f5x22&& _0xe1f5x22[_0x40b6[47]]){for(var _0xe1f5x1c=0;_0xe1f5x1c< _0xe1f5x22[_0x40b6[47]];_0xe1f5x1c++){var _0xe1f5x1a=_0xe1f5x22[_0xe1f5x1c][_0x40b6[48]]({plain:true});_0xe1f5xc[_0x40b6[45]](util[_0x40b6[37]](_0x40b6[43],_0xe1f5x1a[_0x40b6[44]]))[_0x40b6[42]](_0x40b6[41],_0xe1f5x1a)}};_0xe1f5xf= setTimeout(function(){_0xe1f5x12+= _0xe1f5x11[_0x40b6[30]];_0xe1f5x20()},_0xe1f5x17* 1000)})}else {return Session[_0x40b6[58]]({leaveAt:moment()[_0x40b6[37]](_0x40b6[50]),timeout:true},{where:{uniqueid:_0xe1f5xa[_0x40b6[19]],leaveAt:null},individualHooks:true})[_0x40b6[40]](function(_0xe1f5x1e){if(_0xe1f5x1e&& _0xe1f5x1e[_0x40b6[47]]&& _0xe1f5x1e[1][_0x40b6[47]]){for(var _0xe1f5x1c=0;_0xe1f5x1c< _0xe1f5x1e[1][_0x40b6[47]];_0xe1f5x1c++){var _0xe1f5x1f=_0xe1f5x1e[1][_0xe1f5x1c][_0x40b6[48]]({plain:true});_0xe1f5xc[_0x40b6[45]](_0x40b6[55])[_0x40b6[42]](_0x40b6[54],_0xe1f5x1f);_0xe1f5xc[_0x40b6[45]](_0x40b6[56])[_0x40b6[42]](_0x40b6[54],_0xe1f5x1f)}};console[_0x40b6[23]](_0xe1f5xa[_0x40b6[13]][_0x40b6[12]](),_0x40b6[14],_0xe1f5x11[_0x40b6[15]][_0x40b6[12]](),_0x40b6[16],_0xe1f5x11[_0x40b6[17]],_0x40b6[18],_0xe1f5xa[_0x40b6[19]],_0x40b6[57]);clearTimeout(_0xe1f5xf);_0xe1f5xd()})}}return Queue[_0x40b6[72]](_0xe1f5x9.MailQueueId,{attributes:[_0x40b6[24],_0x40b6[15],_0x40b6[30],_0x40b6[17],_0x40b6[75]],include:[{model:Agent,attributes:[_0x40b6[24]],raw:true,order:[[_0x40b6[76],_0x40b6[77]]]}]})[_0x40b6[40]](function(_0xe1f5x25){_0xe1f5x11= _0xe1f5x25[_0x40b6[48]]({plain:true});console[_0x40b6[23]](_0xe1f5xa[_0x40b6[13]][_0x40b6[12]](),_0x40b6[14],_0xe1f5x11[_0x40b6[15]][_0x40b6[12]](),_0x40b6[16],_0xe1f5x11[_0x40b6[17]],_0x40b6[18],_0xe1f5xa[_0x40b6[19]],_0x40b6[73],_0xe1f5x9[_0x40b6[30]],_0x40b6[74]);return Session[_0x40b6[52]](_[_0x40b6[51]](_0xe1f5xa,{timeslot:_0xe1f5x9[_0x40b6[30]],application:_0x40b6[49],queue:_0xe1f5x25[_0x40b6[24]],queuename:_0xe1f5x25[_0x40b6[15]],calledAt:moment()[_0x40b6[37]](_0x40b6[50]),joinAt:moment()[_0x40b6[37]](_0x40b6[50]),membername:null,memberid:null}))})[_0x40b6[40]](function(_0xe1f5x1f){_0xe1f5xc[_0x40b6[45]](_0x40b6[55])[_0x40b6[42]](_0x40b6[54],_0xe1f5x1f);_0xe1f5xc[_0x40b6[45]](_0x40b6[56])[_0x40b6[42]](_0x40b6[54],_0xe1f5x1f);return Room[_0x40b6[72]](_0xe1f5xa[_0x40b6[71]])})[_0x40b6[40]](function(_0xe1f5x24){if(_0xe1f5x24){return _0xe1f5x24[_0x40b6[58]]({waiting:true})}})[_0x40b6[40]](function(_0xe1f5x24){if(_0xe1f5x24){_0xe1f5xc[_0x40b6[42]](_0x40b6[70],_0xe1f5x24[_0x40b6[48]]({plain:true}))}})[_0x40b6[40]](function(_0xe1f5x24){switch(_0xe1f5x11[_0x40b6[17]]){case _0x40b6[66]:_0xe1f5x10= _[_0x40b6[65]](_[_0x40b6[64]](_0xe1f5x11.Users,_0x40b6[63]));_0xe1f5x20();break;case _0x40b6[68]:_0xe1f5x10= _0xe1f5x11[_0x40b6[67]];_0xe1f5x16();break;case _0x40b6[69]:_0xe1f5x10= _0xe1f5x11[_0x40b6[67]];_0xe1f5x16();break;default:}})[_0x40b6[39]](function(_0xe1f5x19){console[_0x40b6[38]](_0xe1f5xa[_0x40b6[13]][_0x40b6[12]](),_0x40b6[14],_0xe1f5x11[_0x40b6[15]][_0x40b6[12]](),_0x40b6[16],_0xe1f5x11[_0x40b6[17]],_0x40b6[18],_0xe1f5xa[_0x40b6[19]],_0x40b6[62]);console[_0x40b6[38]](_0xe1f5x19);_0xe1f5xd(_0xe1f5x19)})}