8eba48d4cf4369dae7c915315788b284fa81c921
[motion.git] / server / config / routing / chat / session.js
1 var _0xcb4c=["\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","\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x43\x68\x61\x74\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E","\x4E\x65\x77\x20\x43\x68\x61\x74\x20\x73\x65\x73\x73\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x63\x68\x61\x74\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","\x6D\x65\x6D\x62\x65\x72\x69\x64","\x6D\x65\x6D\x62\x65\x72\x6E\x61\x6D\x65","\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\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x71\x75\x65\x75\x65\x69\x64","\x71\x75\x65\x75\x65\x6E\x61\x6D\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","\x61\x62\x61\x6E\x64\x6F\x6E","\x41\x42\x41\x4E\x44\x4F\x4E","\x76\x69\x73\x69\x74\x6F\x72\x69\x64","\x76\x69\x73\x69\x74\x6F\x72\x6E\x61\x6D\x65","\x76\x69\x73\x69\x74\x6F\x72\x65\x6D\x61\x69\x6C","\x77\x65\x62\x73\x69\x74\x65\x69\x64","\x77\x65\x62\x73\x69\x74\x65\x6E\x61\x6D\x65","\x77\x65\x62\x73\x69\x74\x65\x61\x64\x64\x72\x65\x73\x73","\x66\x6F\x72\x45\x61\x63\x68","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x65\x78\x70\x6F\x72\x74\x73"];_0xcb4c[0];var _=require(_0xcb4c[1]);var moment=require(_0xcb4c[2]);var Agent=require(_0xcb4c[4])[_0xcb4c[3]];var ChatRoom=require(_0xcb4c[4])[_0xcb4c[5]];var ChatApplication=require(_0xcb4c[4])[_0xcb4c[6]];var ReportChat=require(_0xcb4c[4])[_0xcb4c[7]];var ReportChatRoom=require(_0xcb4c[4])[_0xcb4c[8]];var ReportChatSession=require(_0xcb4c[4])[_0xcb4c[9]];function Session(_0xfac3xa,_0xfac3xb){console[_0xcb4c[11]](_0xcb4c[10]);var _0xfac3xc=0;var _0xfac3xd,_0xfac3xe;Agent[_0xcb4c[35]]({where:{id:{$in:_[_0xcb4c[34]](_0xfac3xa[_0xcb4c[33]],_0xcb4c[16])},online:true,mailPause:false},include:[{model:ChatRoom,attributes:[_0xcb4c[16],_0xcb4c[18]]}],attributes:[_0xcb4c[16],_0xcb4c[24],_0xcb4c[14]]})[_0xcb4c[32]](function(_0xfac3x10){var _0xfac3x11=_[_0xcb4c[20]](_0xfac3x10,function(_0xfac3x12){if(_0xfac3x12[_0xcb4c[14]]===0){return true}else {return _0xfac3x12[_0xcb4c[14]]>_[_0xcb4c[20]](_0xfac3x12.ChatRooms,function(_0xfac3x13){return _0xfac3x13[_0xcb4c[16]]!==_0xfac3xa[_0xcb4c[17]]&&_0xfac3x13[_0xcb4c[18]]!==_0xcb4c[19]})[_0xcb4c[15]]}});var _0xfac3x14=[];var _0xfac3x15;var _0xfac3x12;_0xfac3xa[_0xcb4c[21]]=((_0xfac3xa[_0xcb4c[22]]-_0xfac3xc)>_0xfac3xa[_0xcb4c[23]])?_0xfac3xa[_0xcb4c[23]]:(_0xfac3xa[_0xcb4c[22]]-_0xfac3xc);switch(_0xfac3xa[_0xcb4c[31]]){case _0xcb4c[29]:_0xfac3x15=_[_0xcb4c[25]](_0xfac3x11,_0xfac3x14,_0xcb4c[24]);_0xfac3x12=_0xfac3x15[_0xcb4c[26]]();if(_0xfac3x12){_0xfac3xa[_0xcb4c[27]]=[{id:_0xfac3x12[_0xcb4c[16]],name:_0xfac3x12[_0xcb4c[24]]}];_0xfac3x14[_0xcb4c[28]]({id:_0xfac3x12[_0xcb4c[16]],name:_0xfac3x12[_0xcb4c[24]]});saveReport(_0xfac3xa)}else {_0xfac3x14=[];_0xfac3x12=_0xfac3x11[_0xcb4c[26]]();if(_0xfac3x12){_0xfac3x14[_0xcb4c[28]]({id:_0xfac3x12[_0xcb4c[16]],name:_0xfac3x12[_0xcb4c[24]]});saveReport(_0xfac3xa)}};break;case _0xcb4c[30]:_0xfac3xa[_0xcb4c[27]]=_0xfac3x11;saveReport(_0xfac3xa);break;default:};_0xfac3xe=setTimeout(function(){clearInterval(_0xfac3xd);return _0xfac3xb(null,false,false)},_0xfac3xa[_0xcb4c[22]]*1000);_0xfac3xd=setInterval(function(){_0xfac3xc+=_0xfac3xa[_0xcb4c[23]];return Agent[_0xcb4c[35]]({where:{id:{$in:_[_0xcb4c[34]](_0xfac3xa[_0xcb4c[33]],_0xcb4c[16])},online:true,mailPause:false},include:[{model:ChatRoom,attributes:[_0xcb4c[16],_0xcb4c[18]]}],attributes:[_0xcb4c[16],_0xcb4c[24],_0xcb4c[14]]})[_0xcb4c[32]](function(_0xfac3x10){_0xfac3x11=_[_0xcb4c[20]](_0xfac3x10,function(_0xfac3x12){if(_0xfac3x12[_0xcb4c[14]]===0){return true}else {return _0xfac3x12[_0xcb4c[14]]>_[_0xcb4c[20]](_0xfac3x12.ChatRooms,function(_0xfac3x13){return _0xfac3x13[_0xcb4c[16]]!==_0xfac3xa[_0xcb4c[17]]&&_0xfac3x13[_0xcb4c[18]]!==_0xcb4c[19]})[_0xcb4c[15]]}});_0xfac3xa[_0xcb4c[21]]=((_0xfac3xa[_0xcb4c[22]]-_0xfac3xc)>_0xfac3xa[_0xcb4c[23]])?_0xfac3xa[_0xcb4c[23]]:(_0xfac3xa[_0xcb4c[22]]-_0xfac3xc);switch(_0xfac3xa[_0xcb4c[31]]){case _0xcb4c[29]:_0xfac3x15=_[_0xcb4c[25]](_0xfac3x11,_0xfac3x14,_0xcb4c[24]);_0xfac3x12=_0xfac3x15[_0xcb4c[26]]();if(_0xfac3x12){_0xfac3xa[_0xcb4c[27]]=[{id:_0xfac3x12[_0xcb4c[16]],name:_0xfac3x12[_0xcb4c[24]]}];_0xfac3x14[_0xcb4c[28]]({id:_0xfac3x12[_0xcb4c[16]],name:_0xfac3x12[_0xcb4c[24]]});saveReport(_0xfac3xa)}else {_0xfac3x14=[];_0xfac3x12=_0xfac3x11[_0xcb4c[26]]();if(_0xfac3x12){_0xfac3xa[_0xcb4c[27]]=[{id:_0xfac3x12[_0xcb4c[16]],name:_0xfac3x12[_0xcb4c[24]]}];_0xfac3x14[_0xcb4c[28]]({id:_0xfac3x12[_0xcb4c[16]],name:_0xfac3x12[_0xcb4c[24]]});saveReport(_0xfac3xa)}};break;case _0xcb4c[30]:_0xfac3xa[_0xcb4c[27]]=_0xfac3x11;saveReport(_0xfac3xa);break;default:}})[_0xcb4c[13]](function(_0xfac3xf){console[_0xcb4c[12]](_0xfac3xf)})},_0xfac3xa[_0xcb4c[23]]*1000)})[_0xcb4c[13]](function(_0xfac3xf){console[_0xcb4c[12]](_0xfac3xf)});ReportChat[_0xcb4c[49]](function(_0xfac3x16){if(_0xfac3x16[_0xcb4c[37]](_0xcb4c[36])){return ChatRoom[_0xcb4c[48]](_0xfac3x16[_0xcb4c[17]])[_0xcb4c[32]](function(ChatRoom){return ChatRoom[_0xcb4c[47]](_0xfac3x16[_0xcb4c[38]],{individualHooks:true})})[_0xcb4c[32]](function(){return ReportChatRoom[_0xcb4c[43]]({application:_0xfac3x16[_0xcb4c[44]],memberid:_0xfac3x16[_0xcb4c[38]],membername:_0xfac3x16[_0xcb4c[39]],queueid:_0xfac3x16[_0xcb4c[45]]||null,queuename:_0xfac3x16[_0xcb4c[46]]||null,leaveAt:moment()[_0xcb4c[41]](_0xcb4c[40])},{where:{uniqueid:_0xfac3x16[_0xcb4c[42]],leaveAt:null},individualHooks:true})})[_0xcb4c[32]](function(){return ReportChatSession[_0xcb4c[43]]({memberid:_0xfac3x16[_0xcb4c[38]],membername:_0xfac3x16[_0xcb4c[39]],leaveAt:moment()[_0xcb4c[41]](_0xcb4c[40])},{where:{uniqueid:_0xfac3x16[_0xcb4c[42]],leaveAt:null},individualHooks:true})})[_0xcb4c[32]](function(){clearInterval(_0xfac3xd);clearTimeout(_0xfac3xe);return _0xfac3xb(null,true,false)})[_0xcb4c[13]](function(_0xfac3xf){console[_0xcb4c[12]](_0xfac3xf)})}});ReportChatSession[_0xcb4c[49]](function(_0xfac3x16){if(_0xfac3x16[_0xcb4c[37]](_0xcb4c[50])&&_0xfac3x16[_0xcb4c[50]]){return ChatRoom[_0xcb4c[48]](_0xfac3x16[_0xcb4c[17]])[_0xcb4c[32]](function(_0xfac3x17){return _0xfac3x17[_0xcb4c[43]]({status:_0xcb4c[51]})})[_0xcb4c[32]](function(){clearInterval(_0xfac3xd);clearTimeout(_0xfac3xe);return _0xfac3xb(null,true,true)})[_0xcb4c[13]](function(_0xfac3xf){console[_0xcb4c[12]](_0xfac3xf)})}});return {}}function saveReport(_0xfac3xa){var _0xfac3x19=[];_0xfac3xa[_0xcb4c[27]][_0xcb4c[58]](function(_0xfac3x12,_0xfac3x1a){_0xfac3x19[_0xcb4c[28]]({uniqueid:_0xfac3xa[_0xcb4c[42]],visitorid:_0xfac3xa[_0xcb4c[52]],visitorname:_0xfac3xa[_0xcb4c[53]],visitoremail:_0xfac3xa[_0xcb4c[54]],timeslot:_0xfac3xa[_0xcb4c[21]],websiteid:_0xfac3xa[_0xcb4c[55]],websitename:_0xfac3xa[_0xcb4c[56]],websiteaddress:_0xfac3xa[_0xcb4c[57]],application:_0xfac3xa[_0xcb4c[44]],membername:_0xfac3x12[_0xcb4c[24]],memberid:_0xfac3x12[_0xcb4c[16]],queueid:_0xfac3xa[_0xcb4c[45]]||null,queuename:_0xfac3xa[_0xcb4c[46]]||null,roomid:_0xfac3xa[_0xcb4c[17]]||null,calledAt:moment()[_0xcb4c[41]](_0xcb4c[40])})});if(_0xfac3x19[_0xcb4c[15]]){return ReportChat[_0xcb4c[59]](_0xfac3x19,{individualHooks:true})[_0xcb4c[13]](function(_0xfac3xf){console[_0xcb4c[12]](_0xfac3xf)})}}module[_0xcb4c[60]]=Session