Built motion from commit b322525.|0.0.112
[motion.git] / server / config / routing / fax / index.js
1 var _0x4505=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x75\x74\x69\x6C","\x61\x73\x79\x6E\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C","\x52\x65\x70\x6F\x72\x74\x46\x61\x78","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x46\x61\x78\x52\x6F\x6F\x6D","\x52\x65\x70\x6F\x72\x74\x46\x61\x78\x53\x65\x73\x73\x69\x6F\x6E","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x46\x61\x78\x51\x75\x65\x75\x65","\x46\x61\x78\x52\x6F\x6F\x6D","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x55\x73\x65\x72","\x2E\x2F\x73\x65\x73\x73\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x73","\x46\x61\x78\x20\x52\x6F\x75\x74\x69\x6E\x67\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E","\x6C\x6F\x67","\x73\x74\x61\x74\x75\x73","\x52\x45\x43\x45\x49\x56\x45\x44","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x72\x6F\x6F\x6D\x69\x64","\x69\x64","\x75\x6E\x69\x71\x75\x65\x69\x64","\x25\x73\x2E\x25\x73","\x75\x6E\x69\x78","\x66\x6F\x72\x6D\x61\x74","\x61\x67\x65\x6E\x74\x73","\x6E\x61\x6D\x65","\x6D\x61\x70","\x67\x65\x74\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\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\x70\x68\x6F\x6E\x65","\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64","\x66\x69\x64\x65\x6C\x69\x74\x79","\x61\x70\x70\x74\x69\x6D\x65\x6F\x75\x74","\x71\x75\x65\x75\x65\x74\x69\x6D\x65\x6F\x75\x74","\x74\x69\x6D\x65\x6F\x75\x74","\x73\x74\x72\x61\x74\x65\x67\x79","\x62\x65\x65\x70\x61\x6C\x6C","\x70\x72\x69\x6F\x72\x69\x74\x79\x20\x41\x53\x43","\x6F\x6E\x6C\x69\x6E\x65","\x66\x61\x78\x50\x61\x75\x73\x65","\x67\x65\x74\x46\x61\x78\x41\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x73","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E","\x63\x6C\x6F\x6E\x65\x44\x65\x65\x70","\x6C\x65\x6E\x67\x74\x68","\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x74\x68\x65\x6E","\x61\x67\x65\x6E\x74","\x71\x75\x65\x75\x65\x69\x64","\x71\x75\x65\x75\x65\x6E\x61\x6D\x65","\x74\x69\x6D\x65\x73\x6C\x6F\x74","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x63\x72\x65\x61\x74\x65","\x66\x72\x6F\x6D","\x70\x75\x73\x68","\x61\x70\x70","\x6A\x6F\x69\x6E\x41\x74","\x55\x73\x65\x72\x73","\x55\x73\x65\x72\x48\x61\x73\x46\x61\x78\x51\x75\x65\x75\x65\x2E\x70\x65\x6E\x61\x6C\x74\x79","\x6F\x72\x64\x65\x72\x42\x79","\x70\x65\x6E\x61\x6C\x74\x79","\x55\x73\x65\x72\x48\x61\x73\x46\x61\x78\x51\x75\x65\x75\x65","\x71\x75\x65\x75\x65","\x75\x70\x64\x61\x74\x65","\x66\x6F\x72\x45\x61\x63\x68","\x45\x6E\x64\x20\x66\x61\x78\x20\x72\x6F\x75\x74\x69\x6E\x67\x2E\x2E","\x55\x4E\x4D\x41\x4E\x41\x47\x45\x44","\x66\x69\x6E\x64\x42\x79\x49\x64","\x77\x61\x74\x65\x72\x66\x61\x6C\x6C","\x65\x72\x72","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74\x2E\x2E","\x55\x6E\x6B\x6E\x6F\x77\x6E\x20\x46\x61\x78\x52\x6F\x6F\x6D\x2E\x2E","\x67\x65\x74\x46\x61\x78\x52\x6F\x6F\x6D"];_0x4505[0];var _=require(_0x4505[1]);var moment=require(_0x4505[2]);var util=require(_0x4505[3]);var async=require(_0x4505[4]);var Util=require(_0x4505[5]);var ReportFax=require(_0x4505[7])[_0x4505[6]];var ReportFaxRoom=require(_0x4505[7])[_0x4505[8]];var ReportFaxSession=require(_0x4505[7])[_0x4505[9]];var FaxMessage=require(_0x4505[7])[_0x4505[10]];var FaxQueue=require(_0x4505[7])[_0x4505[11]];var FaxRoom=require(_0x4505[7])[_0x4505[12]];var Interval=require(_0x4505[7])[_0x4505[13]];var User=require(_0x4505[7])[_0x4505[14]];var Session=require(_0x4505[15]);module[_0x4505[16]]=function(){console[_0x4505[18]](_0x4505[17]);FaxMessage[_0x4505[21]](function(_0x979fxf){if(_0x979fxf[_0x4505[19]]===_0x4505[20]){handleMessage(_0x979fxf)}})};function handleEntityNotFound(_0x979fxf){return function(_0x979fx11){if(!_0x979fx11){throw {message:_0x979fxf}};return _0x979fx11}}function handleFaxRoom(_0x979fx13,_0x979fx14){return function(_0x979fx15){_0x979fx13[_0x4505[22]]=_0x979fx15[_0x4505[23]];_0x979fx13[_0x4505[24]]=util[_0x4505[27]](_0x4505[25],moment()[_0x4505[26]](),_0x979fx15[_0x4505[23]]);_0x979fx14[_0x4505[28]]=_[_0x4505[30]](_0x979fx15.Users,function(_0x979fx16){return {id:_0x979fx16[_0x4505[23]],name:_0x979fx16[_0x4505[29]],penalty:0}});return _0x979fx15[_0x4505[31]]()}}function handleFaxAccount(_0x979fx13,_0x979fx14){return function(_0x979fx18){_0x979fx13[_0x4505[32]]=_0x979fx18[_0x4505[23]];_0x979fx13[_0x4505[33]]=_0x979fx18[_0x4505[29]];_0x979fx13[_0x4505[34]]=_0x979fx18[_0x4505[35]];_0x979fx14[_0x4505[36]]=_0x979fx18[_0x4505[36]];if(_0x979fx18[_0x4505[36]]){_0x979fx14[_0x4505[37]]=_0x979fx14[_0x4505[38]]=_0x979fx18[_0x4505[39]];_0x979fx14[_0x4505[36]]=_0x979fx18[_0x4505[39]];_0x979fx14[_0x4505[40]]=_0x4505[41]};return _0x979fx18[_0x4505[45]]({order:_0x4505[42],include:[{model:FaxQueue,attributes:[_0x4505[23],_0x4505[29],_0x4505[39],_0x4505[40]],include:[{model:User,attributes:[_0x4505[23],_0x4505[29],_0x4505[43],_0x4505[44]]}]},{model:User,attributes:[_0x4505[23],_0x4505[29],_0x4505[43],_0x4505[44]]},{model:Interval,include:[{all:true}]}]})}}function handleApps(_0x979fx13,_0x979fx14){return function(_0x979fx1a){var _0x979fx1b=[];if(_0x979fx14[_0x4505[36]]){_0x979fx13[_0x4505[38]]=_0x979fx14[_0x4505[36]];_0x979fx13[_0x4505[37]]=_0x979fx14[_0x4505[36]];_0x979fx13[_0x4505[28]]=_0x979fx14[_0x4505[28]];_0x979fx13[_0x4505[46]]=_0x4505[36];_0x979fx13[_0x4505[40]]=_0x4505[41];var _0x979fx1c=_[_0x4505[47]](_0x979fx13);if(_0x979fx1c[_0x4505[28]][_0x4505[48]]){_0x979fx1b[_0x4505[59]](function(_0x979fx1d){return ReportFaxRoom[_0x4505[57]]({uniqueid:_0x979fx1c[_0x4505[24]],accountid:_0x979fx1c[_0x4505[32]],accountname:_0x979fx1c[_0x4505[33]],accountphone:_0x979fx1c[_0x4505[34]],from:_0x979fx1c[_0x4505[58]],roomid:_0x979fx1c[_0x4505[22]],joinAt:moment()[_0x4505[27]](_0x4505[56])})[_0x4505[51]](function(){return ReportFaxSession[_0x4505[57]]({uniqueid:_0x979fx1c[_0x4505[24]],accountid:_0x979fx1c[_0x4505[32]],accountname:_0x979fx1c[_0x4505[33]],accountphone:_0x979fx1c[_0x4505[34]],application:_0x979fx1c[_0x4505[46]],memberid:(_0x979fx1c[_0x4505[46]]===_0x4505[52]&&_0x979fx1c[_0x4505[28]][0])?_0x979fx1c[_0x4505[28]][0][_0x4505[23]]:null,membername:(_0x979fx1c[_0x4505[46]]===_0x4505[52]&&_0x979fx1c[_0x4505[28]][0])?_0x979fx1c[_0x4505[28]][0][_0x4505[29]]:null,queue:_0x979fx1c[_0x4505[53]],queuename:_0x979fx1c[_0x4505[54]],roomid:_0x979fx1c[_0x4505[22]],fidelity:_0x979fx1c[_0x4505[46]]===_0x4505[36]?_0x979fx1c[_0x4505[55]]:null,joinAt:moment()[_0x4505[27]](_0x4505[56])})})[_0x4505[51]](function(){ new Session(_0x979fx1c,_0x979fx1d)})[_0x4505[50]](function(_0x979fx1e){console[_0x4505[49]](_0x979fx1e)})})}};_0x979fx1a[_0x4505[69]](function(_0x979fx1f,_0x979fx20){var _0x979fx1c=_[_0x4505[47]](_0x979fx13);_0x979fx1c[_0x4505[37]]=_0x979fx1f[_0x4505[39]];_0x979fx1c[_0x4505[46]]=_0x979fx1f[_0x4505[60]];_0x979fx1c[_0x4505[61]]=moment()[_0x4505[27]](_0x4505[56]);switch(_0x979fx1f[_0x4505[60]]){case _0x4505[67]:_0x979fx1c[_0x4505[53]]=_0x979fx1f[_0x4505[11]][_0x4505[23]];_0x979fx1c[_0x4505[54]]=_0x979fx1f[_0x4505[11]][_0x4505[29]];_0x979fx1c[_0x4505[40]]=_0x979fx1f[_0x4505[11]][_0x4505[40]];_0x979fx1c[_0x4505[38]]=_0x979fx1f[_0x4505[11]][_0x4505[39]];_0x979fx1f[_0x4505[11]][_0x4505[62]]=_[_0x4505[64]](_0x979fx1f[_0x4505[11]].Users,_0x4505[63]);_0x979fx1c[_0x4505[28]]=_[_0x4505[30]](_0x979fx1f[_0x4505[11]].Users,function(_0x979fx21){return {id:_0x979fx21[_0x4505[23]],name:_0x979fx21[_0x4505[29]],penalty:_0x979fx21[_0x4505[66]][_0x4505[65]]}});break;case _0x4505[52]:_0x979fx1c[_0x4505[38]]=_0x979fx1f[_0x4505[39]];_0x979fx1c[_0x4505[40]]=_0x4505[41];_0x979fx1c[_0x4505[28]]=[{id:_0x979fx1f[_0x4505[14]][_0x4505[23]],name:_0x979fx1f[_0x4505[14]][_0x4505[29]],penalty:0}];break;default:};if(_0x979fx1b[_0x4505[48]]){_0x979fx1b[_0x4505[59]](function(_0x979fx22,_0x979fx1d){if(_0x979fx22){_0x979fx1d(null,_0x979fx22)}else {return ReportFaxSession[_0x4505[68]]({leaveAt:moment()[_0x4505[27]](_0x4505[56]),unmanaged:true},{where:{leaveAt:null,uniqueid:_0x979fx1c[_0x4505[24]]},individualHooks:true})[_0x4505[51]](function(){return ReportFaxSession[_0x4505[57]]({uniqueid:_0x979fx1c[_0x4505[24]],accountid:_0x979fx1c[_0x4505[32]],accountname:_0x979fx1c[_0x4505[33]],accountphone:_0x979fx1c[_0x4505[34]],application:_0x979fx1c[_0x4505[46]],memberid:(_0x979fx1c[_0x4505[46]]===_0x4505[52]&&_0x979fx1c[_0x4505[28]][0])?_0x979fx1c[_0x4505[28]][0][_0x4505[23]]:null,membername:(_0x979fx1c[_0x4505[46]]===_0x4505[52]&&_0x979fx1c[_0x4505[28]][0])?_0x979fx1c[_0x4505[28]][0][_0x4505[29]]:null,queue:_0x979fx1c[_0x4505[53]],queuename:_0x979fx1c[_0x4505[54]],roomid:_0x979fx1c[_0x4505[22]],fidelity:_0x979fx1c[_0x4505[46]]===_0x4505[36]?_0x979fx1c[_0x4505[55]]:null,joinAt:moment()[_0x4505[27]](_0x4505[56])})})[_0x4505[51]](function(){ new Session(_0x979fx1c,_0x979fx1d)})[_0x4505[50]](function(_0x979fx1e){console[_0x4505[49]](_0x979fx1e)})}})}else {_0x979fx1b[_0x4505[59]](function(_0x979fx1d){return ReportFaxRoom[_0x4505[57]]({uniqueid:_0x979fx1c[_0x4505[24]],accountid:_0x979fx1c[_0x4505[32]],accountname:_0x979fx1c[_0x4505[33]],accountphone:_0x979fx1c[_0x4505[34]],from:_0x979fx1c[_0x4505[58]],roomid:_0x979fx1c[_0x4505[22]],joinAt:moment()[_0x4505[27]](_0x4505[56])})[_0x4505[51]](function(){return ReportFaxSession[_0x4505[57]]({uniqueid:_0x979fx1c[_0x4505[24]],accountid:_0x979fx1c[_0x4505[32]],accountname:_0x979fx1c[_0x4505[33]],accountphone:_0x979fx1c[_0x4505[34]],application:_0x979fx1c[_0x4505[46]],memberid:(_0x979fx1c[_0x4505[46]]===_0x4505[52]&&_0x979fx1c[_0x4505[28]][0])?_0x979fx1c[_0x4505[28]][0][_0x4505[23]]:null,membername:(_0x979fx1c[_0x4505[46]]===_0x4505[52]&&_0x979fx1c[_0x4505[28]][0])?_0x979fx1c[_0x4505[28]][0][_0x4505[29]]:null,queue:_0x979fx1c[_0x4505[53]],queuename:_0x979fx1c[_0x4505[54]],roomid:_0x979fx1c[_0x4505[22]],fidelity:_0x979fx1c[_0x4505[46]]===_0x4505[36]?_0x979fx1c[_0x4505[55]]:null,joinAt:moment()[_0x4505[27]](_0x4505[56])})})[_0x4505[51]](function(){ new Session(_0x979fx1c,_0x979fx1d)})[_0x4505[50]](function(_0x979fx1e){console[_0x4505[49]](_0x979fx1e)})})}});async[_0x4505[73]](_0x979fx1b,function(_0x979fx1e,_0x979fx23){console[_0x4505[18]](_0x4505[70]);if(_0x979fx1e){console[_0x4505[49]](_0x979fx1e)};if(!_0x979fx23){return ReportFaxRoom[_0x4505[68]]({leaveAt:moment()[_0x4505[27]](_0x4505[56]),unmanaged:true,status:_0x4505[71]},{where:{leaveAt:null,uniqueid:_0x979fx13[_0x4505[24]]},individualHooks:true})[_0x4505[51]](function(){return ReportFaxSession[_0x4505[68]]({leaveAt:moment()[_0x4505[27]](_0x4505[56]),unmanaged:true},{where:{leaveAt:null,uniqueid:_0x979fx13[_0x4505[24]]},individualHooks:true})})[_0x4505[51]](function(){return FaxRoom[_0x4505[72]](_0x979fx13[_0x4505[22]])})[_0x4505[51]](function(_0x979fx24){if(_0x979fx24){return _0x979fx24[_0x4505[68]]({status:_0x4505[71]})}})[_0x4505[50]](function(_0x979fx1e){console[_0x4505[49]](_0x979fx1e)})}})}}function handleMessage(_0x979fxf){var _0x979fx14={agents:[]};var _0x979fx13={messageid:_0x979fxf[_0x4505[23]],from:_0x979fxf[_0x4505[58]]||null,joinAt:moment()[_0x4505[27]](_0x4505[56])};return _0x979fxf[_0x4505[77]]({include:[{model:User,attributes:[_0x4505[23],_0x4505[29],_0x4505[43],_0x4505[44]]}]})[_0x4505[51]](handleEntityNotFound(_0x4505[76]))[_0x4505[51]](handleFaxRoom(_0x979fx13,_0x979fx14))[_0x4505[51]](handleEntityNotFound(_0x4505[75]))[_0x4505[51]](handleFaxAccount(_0x979fx13,_0x979fx14))[_0x4505[51]](handleApps(_0x979fx13,_0x979fx14))[_0x4505[50]](function(_0x979fx1e){console[_0x4505[49]](_0x4505[74],_0x979fx1e)})}