675d1a707541cd95f3cc3705f4faddb5e2743c81
[motion.git] / server / config / routing / mail / session.js
1 var _0xf204=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\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\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\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","\x4E\x65\x77\x20\x4D\x61\x69\x6C\x20\x73\x65\x73\x73\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x6D\x61\x69\x6C\x43\x61\x70\x61\x63\x69\x74\x79","\x6C\x65\x6E\x67\x74\x68","\x69\x64","\x72\x6F\x6F\x6D\x69\x64","\x73\x74\x61\x74\x75\x73","\x43\x4C\x4F\x53\x45\x44","\x66\x69\x6C\x74\x65\x72","\x74\x69\x6D\x65\x73\x6C\x6F\x74","\x61\x70\x70\x74\x69\x6D\x65\x6F\x75\x74","\x71\x75\x65\x75\x65\x74\x69\x6D\x65\x6F\x75\x74","\x6E\x61\x6D\x65","\x64\x69\x66\x66\x65\x72\x65\x6E\x63\x65\x42\x79","\x73\x68\x69\x66\x74","\x61\x76\x61\x69\x6C\x61\x62\x6C\x65","\x70\x75\x73\x68","\x72\x72\x6D\x65\x6D\x6F\x72\x79","\x62\x65\x65\x70\x61\x6C\x6C","\x73\x74\x72\x61\x74\x65\x67\x79","\x74\x68\x65\x6E","\x61\x67\x65\x6E\x74\x73","\x6D\x61\x70","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x63\x68\x61\x6E\x67\x65\x64","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x6D\x65\x6D\x62\x65\x72\x69\x64","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\x71\x75\x65\x75\x65","\x71\x75\x65\x75\x65\x6E\x61\x6D\x65","\x66\x69\x64\x65\x6C\x69\x74\x79","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x6D\x61\x74","\x75\x6E\x69\x71\x75\x65\x69\x64","\x75\x70\x64\x61\x74\x65","\x61\x64\x64\x55\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x73\x75\x62\x6A\x65\x63\x74","\x61\x63\x63\x6F\x75\x6E\x74\x69\x64","\x61\x63\x63\x6F\x75\x6E\x74\x6E\x61\x6D\x65","\x61\x63\x63\x6F\x75\x6E\x74\x61\x64\x64\x72\x65\x73\x73","\x6D\x65\x73\x73\x61\x67\x65\x69\x64","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xf204[0];var _=require(_0xf204[1]);var moment=require(_0xf204[2]);var Agent=require(_0xf204[4])[_0xf204[3]];var MailRoom=require(_0xf204[4])[_0xf204[5]];var MailApplication=require(_0xf204[4])[_0xf204[6]];var ReportMail=require(_0xf204[4])[_0xf204[7]];var ReportMailSession=require(_0xf204[4])[_0xf204[8]];function Session(_0x2a25x9,_0x2a25xa){console[_0xf204[10]](_0xf204[9]);var _0x2a25xb=0;var _0x2a25xc,_0x2a25xd;Agent[_0xf204[34]]({where:{id:{$in:_[_0xf204[33]](_0x2a25x9[_0xf204[32]],_0xf204[15])},online:true,mailPause:false},include:[{model:MailRoom,attributes:[_0xf204[15],_0xf204[17]]}],attributes:[_0xf204[15],_0xf204[23],_0xf204[13]]})[_0xf204[31]](function(_0x2a25xf){var _0x2a25x10=_[_0xf204[19]](_0x2a25xf,function(_0x2a25x11){if(_0x2a25x11[_0xf204[13]]===0){return true}else {return _0x2a25x11[_0xf204[13]]>_[_0xf204[19]](_0x2a25x11.MailRooms,function(_0x2a25x12){return _0x2a25x12[_0xf204[15]]!==_0x2a25x9[_0xf204[16]]&&_0x2a25x12[_0xf204[17]]!==_0xf204[18]})[_0xf204[14]]}});var _0x2a25x13=[];var _0x2a25x14;var _0x2a25x11;_0x2a25x9[_0xf204[20]]=((_0x2a25x9[_0xf204[21]]-_0x2a25xb)>_0x2a25x9[_0xf204[22]])?_0x2a25x9[_0xf204[22]]:(_0x2a25x9[_0xf204[21]]-_0x2a25xb);switch(_0x2a25x9[_0xf204[30]]){case _0xf204[28]:_0x2a25x14=_[_0xf204[24]](_0x2a25x10,_0x2a25x13,_0xf204[23]);_0x2a25x11=_0x2a25x14[_0xf204[25]]();if(_0x2a25x11){_0x2a25x9[_0xf204[26]]=[{id:_0x2a25x11[_0xf204[15]],name:_0x2a25x11[_0xf204[23]]}];_0x2a25x13[_0xf204[27]]({id:_0x2a25x11[_0xf204[15]],name:_0x2a25x11[_0xf204[23]]});saveReport(_0x2a25x9)}else {_0x2a25x13=[];_0x2a25x11=_0x2a25x10[_0xf204[25]]();if(_0x2a25x11){_0x2a25x13[_0xf204[27]]({id:_0x2a25x11[_0xf204[15]],name:_0x2a25x11[_0xf204[23]]});saveReport(_0x2a25x9)}};break;case _0xf204[29]:_0x2a25x9[_0xf204[26]]=_0x2a25x10;saveReport(_0x2a25x9);break;default:};_0x2a25xd=setTimeout(function(){clearInterval(_0x2a25xc);return _0x2a25xa(null,false)},_0x2a25x9[_0xf204[21]]*1000);_0x2a25xc=setInterval(function(){_0x2a25xb+=_0x2a25x9[_0xf204[22]];return Agent[_0xf204[34]]({where:{id:{$in:_[_0xf204[33]](_0x2a25x9[_0xf204[32]],_0xf204[15])},online:true,mailPause:false},include:[{model:MailRoom,attributes:[_0xf204[15],_0xf204[17]]}],attributes:[_0xf204[15],_0xf204[23],_0xf204[13]]})[_0xf204[31]](function(_0x2a25xf){_0x2a25x10=_[_0xf204[19]](_0x2a25xf,function(_0x2a25x11){if(_0x2a25x11[_0xf204[13]]===0){return true}else {return _0x2a25x11[_0xf204[13]]>_[_0xf204[19]](_0x2a25x11.MailRooms,function(_0x2a25x12){return _0x2a25x12[_0xf204[15]]!==_0x2a25x9[_0xf204[16]]&&_0x2a25x12[_0xf204[17]]!==_0xf204[18]})[_0xf204[14]]}});_0x2a25x9[_0xf204[20]]=((_0x2a25x9[_0xf204[21]]-_0x2a25xb)>_0x2a25x9[_0xf204[22]])?_0x2a25x9[_0xf204[22]]:(_0x2a25x9[_0xf204[21]]-_0x2a25xb);switch(_0x2a25x9[_0xf204[30]]){case _0xf204[28]:_0x2a25x14=_[_0xf204[24]](_0x2a25x10,_0x2a25x13,_0xf204[23]);_0x2a25x11=_0x2a25x14[_0xf204[25]]();if(_0x2a25x11){_0x2a25x9[_0xf204[26]]=[{id:_0x2a25x11[_0xf204[15]],name:_0x2a25x11[_0xf204[23]]}];_0x2a25x13[_0xf204[27]]({id:_0x2a25x11[_0xf204[15]],name:_0x2a25x11[_0xf204[23]]});saveReport(_0x2a25x9)}else {_0x2a25x13=[];_0x2a25x11=_0x2a25x10[_0xf204[25]]();if(_0x2a25x11){_0x2a25x9[_0xf204[26]]=[{id:_0x2a25x11[_0xf204[15]],name:_0x2a25x11[_0xf204[23]]}];_0x2a25x13[_0xf204[27]]({id:_0x2a25x11[_0xf204[15]],name:_0x2a25x11[_0xf204[23]]});saveReport(_0x2a25x9)}};break;case _0xf204[29]:_0x2a25x9[_0xf204[26]]=_0x2a25x10;saveReport(_0x2a25x9);break;default:}})[_0xf204[12]](function(_0x2a25xe){console[_0xf204[11]](_0x2a25xe)})},_0x2a25x9[_0xf204[22]]*1000)})[_0xf204[12]](function(_0x2a25xe){console[_0xf204[11]](_0x2a25xe)});ReportMail[_0xf204[49]](function(_0x2a25x15){if(_0x2a25x15[_0xf204[36]](_0xf204[35])){return MailRoom[_0xf204[48]](_0x2a25x15[_0xf204[16]])[_0xf204[31]](function(_0x2a25x16){return _0x2a25x16[_0xf204[47]](_0x2a25x15[_0xf204[38]],{individualHooks:true})})[_0xf204[31]](function(){return ReportMailSession[_0xf204[46]]({application:_0x2a25x15[_0xf204[37]],memberid:_0x2a25x15[_0xf204[38]],membername:_0x2a25x15[_0xf204[39]],queue:_0x2a25x15[_0xf204[40]]||null,queuename:_0x2a25x15[_0xf204[41]]||null,fidelity:_0x2a25x15[_0xf204[37]]===_0xf204[42]?_0x2a25x15[_0xf204[20]]:null,queuecallerleaveAt:moment()[_0xf204[44]](_0xf204[43])},{where:{uniqueid:_0x2a25x15[_0xf204[45]]},individualHooks:true})})[_0xf204[31]](function(){clearInterval(_0x2a25xc);clearTimeout(_0x2a25xd);return _0x2a25xa(null,true)})[_0xf204[12]](function(_0x2a25xe){console[_0xf204[11]](_0x2a25xe)})}});return {}}function saveReport(_0x2a25x9){var _0x2a25x18=[];_0x2a25x9[_0xf204[26]][_0xf204[55]](function(_0x2a25x11,_0x2a25x19){_0x2a25x18[_0xf204[27]]({uniqueid:_0x2a25x9[_0xf204[45]],timeslot:_0x2a25x9[_0xf204[20]],subject:_0x2a25x9[_0xf204[50]],accountid:_0x2a25x9[_0xf204[51]],accountname:_0x2a25x9[_0xf204[52]],accountaddress:_0x2a25x9[_0xf204[53]],application:_0x2a25x9[_0xf204[37]],membername:_0x2a25x11[_0xf204[23]],memberid:_0x2a25x11[_0xf204[15]],queue:_0x2a25x9[_0xf204[40]]||null,queuename:_0x2a25x9[_0xf204[41]]||null,roomid:_0x2a25x9[_0xf204[16]]||null,messageid:_0x2a25x9[_0xf204[54]]||null,calledAt:moment()[_0xf204[44]](_0xf204[43])})});if(_0x2a25x18[_0xf204[14]]){return ReportMail[_0xf204[56]](_0x2a25x18,{individualHooks:true})[_0xf204[12]](function(_0x2a25xe){console[_0xf204[11]](_0x2a25xe)})}}module[_0xf204[57]]=Session