Built motion from commit 57199c8.|0.0.38
[motion.git] / server / config / automations / fax.js
1 var _0x27e7=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6D\x6F\x6D\x65\x6E\x74","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x46\x61\x78\x52\x6F\x6F\x6D","\x53\x65\x74\x74\x69\x6E\x67\x73","\x63\x61\x74\x63\x68","\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5F\x74\x69\x6D\x65\x6F\x75\x74","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x4F\x6E\x65","\x67\x72\x6F\x75\x70","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x73","\x70\x61\x72\x73\x65","\x61\x63\x74\x69\x6F\x6E\x73","\x62\x6F\x6F\x6C\x65\x61\x6E","\x41\x4E\x44","\x24\x61\x6E\x64","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x6F\x70\x65\x72\x61\x74\x6F\x72","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x72\x75\x6C\x65\x73","\x6C\x6F\x67","\x69\x64","\x64\x61\x74\x61","\x73\x74\x61\x74\x75\x73","\x76\x61\x6C\x75\x65","\x66\x69\x65\x6C\x64","\x66\x69\x6E\x64\x41\x6C\x6C","\x75\x70\x64\x61\x74\x65","\x3D","\x3C\x3E","\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","\x68\x6F\x75\x72\x73","\x73\x75\x62\x74\x72\x61\x63\x74","\x3E","\x3E\x3D","\x3C","\x3C\x3D","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x65\x78\x70\x6F\x72\x74\x73","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x65\x72\x72\x6F\x72","\x66\x61\x78"];_0x27e7[0];var _=require(_0x27e7[1]);var config=require(_0x27e7[2]);var moment=require(_0x27e7[3]);var sequelize=require(_0x27e7[5])[_0x27e7[4]];var Automation=require(_0x27e7[5])[_0x27e7[6]];var FaxRoom=require(_0x27e7[5])[_0x27e7[7]];var Settings=require(_0x27e7[5])[_0x27e7[8]];var automationTimeout;var activeAutomations={};function getTimeout(){Settings[_0x27e7[12]]()[_0x27e7[11]](function(_0xff2bxc){automationTimeout=_0xff2bxc[_0x27e7[10]]})[_0x27e7[9]](function(_0xff2bxb){})}function executeAutomation(_0xff2bxe){var _0xff2bxf={where:{}};var _0xff2bx10={};var _0xff2bx11=JSON[_0x27e7[15]](_0xff2bxe[_0x27e7[14]])[_0x27e7[13]];var _0xff2bx12=JSON[_0x27e7[15]](_0xff2bxe[_0x27e7[16]])[_0x27e7[13]];var _0xff2bx13={};var _0xff2bx14=_0xff2bx11[_0x27e7[17]]===_0x27e7[18]?_0x27e7[19]:_0x27e7[20];_0xff2bxf[_0x27e7[21]][_0xff2bx14]=[];_0xff2bx11[_0x27e7[25]][_0x27e7[24]](function(_0xff2bx15){if(_0xff2bx15[_0x27e7[22]]){_0xff2bxf[_0x27e7[21]][_0xff2bx14][_0x27e7[23]](getCondition(_0xff2bx15))}else {if(_0xff2bx15[_0x27e7[13]]){var _0xff2bx16=_0xff2bx15[_0x27e7[13]][_0x27e7[17]]===_0x27e7[18]?_0x27e7[19]:_0x27e7[20];var _0xff2bx17={};_0xff2bx17[_0xff2bx16]=[];_0xff2bx15[_0x27e7[13]][_0x27e7[25]][_0x27e7[24]](function(_0xff2bx18){_0xff2bx17[_0xff2bx16][_0x27e7[23]](getCondition(_0xff2bx18))});_0xff2bxf[_0x27e7[21]][_0xff2bx14][_0x27e7[23]](_0xff2bx17);}}});FaxRoom[_0x27e7[32]](_0xff2bxf)[_0x27e7[11]](function(_0xff2bx19){_0xff2bx19[_0x27e7[24]](function(_0xff2bx1a){_0xff2bx12[_0x27e7[25]][_0x27e7[24]](function(_0xff2bx15){switch(_0xff2bx15[_0x27e7[31]][_0x27e7[30]]){case _0x27e7[29]:setStatus(_0xff2bx1a[_0x27e7[27]],_0xff2bx15[_0x27e7[28]]);break ;;default:;}})})})[_0x27e7[9]](function(_0xff2bxb){console[_0x27e7[26]](_0xff2bxb)});}function setStatus(_0xff2bx1c,_0xff2bx1d){FaxRoom[_0x27e7[33]]({status:_0xff2bx1d},{where:{id:_0xff2bx1c}})[_0x27e7[9]](function(_0xff2bxb){console[_0x27e7[26]](_0xff2bxb)})}function getCondition(_0xff2bx15){var _0xff2bxc={};switch(_0xff2bx15[_0x27e7[31]][_0x27e7[30]]){case _0x27e7[29]:switch(_0xff2bx15[_0x27e7[22]]){case _0x27e7[34]:_0xff2bxc[_0xff2bx15[_0x27e7[31]][_0x27e7[30]]]=_0xff2bx15[_0x27e7[28]];break ;;case _0x27e7[35]:_0xff2bxc[_0xff2bx15[_0x27e7[31]][_0x27e7[30]]]={$ne:_0xff2bx15[_0x27e7[28]]};break ;;default:;};break ;;case _0x27e7[44]:var _0xff2bx1f=moment()[_0x27e7[39]](parseInt(_0xff2bx15[_0x27e7[28]],10),_0x27e7[38])[_0x27e7[37]](_0x27e7[36]);switch(_0xff2bx15[_0x27e7[22]]){case _0x27e7[40]:_0xff2bxc[_0xff2bx15[_0x27e7[31]][_0x27e7[30]]]={lt:_0xff2bx1f};break ;;case _0x27e7[41]:_0xff2bxc[_0xff2bx15[_0x27e7[31]][_0x27e7[30]]]={$lte:_0xff2bx1f};break ;;case _0x27e7[42]:_0xff2bxc[_0xff2bx15[_0x27e7[31]][_0x27e7[30]]]={$gt:_0xff2bx1f};break ;;case _0x27e7[43]:_0xff2bxc[_0xff2bx15[_0x27e7[31]][_0x27e7[30]]]={$gte:_0xff2bx1f};break ;;default:;};break ;;default:;};return _0xff2bxc;}function createInterval(_0xff2bxe){activeAutomations[_0x27e7[45]+_0xff2bxe[_0x27e7[27]]]=setInterval(function(){executeAutomation(_0xff2bxe)},automationTimeout*1000)}module[_0x27e7[46]]=function(){getTimeout();Automation[_0x27e7[47]](function(_0xff2bx21,_0xff2bx22){createInterval(_0xff2bx21)});Automation[_0x27e7[48]](function(_0xff2bx21,_0xff2bx22){clearInterval(activeAutomations[_0x27e7[45]+_0xff2bx21[_0x27e7[27]]]);createInterval(_0xff2bx21);});Automation[_0x27e7[49]](function(_0xff2bx21,_0xff2bx22){clearInterval(activeAutomations[_0x27e7[45]+_0xff2bx21[_0x27e7[27]]])});Automation[_0x27e7[32]]({where:{status:true,channel:_0x27e7[51]}})[_0x27e7[11]](function(_0xff2bx23){_0xff2bx23[_0x27e7[24]](function(_0xff2bxe){createInterval(_0xff2bxe)})})[_0x27e7[9]](function(_0xff2bxb){console[_0x27e7[50]](_0xff2bxb)});};