Built motion from commit fd18f58.|0.0.129
[motion.git] / server / config / automations / fax.js
index bce2b4d..493a72a 100644 (file)
@@ -1 +1 @@
-var _0x2e8b=["\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","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x70\x75\x73\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x66\x6F\x72\x45\x61\x63\x68","\x41\x6C\x6C","\x24\x6F\x72","\x41\x6E\x79","\x6C\x6F\x67","\x63\x61\x74\x63\x68","\x69\x64","\x64\x61\x74\x61\x31","\x73\x74\x61\x74\x75\x73","\x61\x63\x74\x69\x6F\x6E","\x41\x63\x74\x69\x6F\x6E\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6C\x6C","\x75\x70\x64\x61\x74\x65","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x65\x71\x75\x61\x6C\x73","\x6E\x6F\x74\x5F\x65\x71\x75\x61\x6C\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\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","\x67\x72\x65\x61\x74\x65\x72","\x67\x72\x65\x61\x74\x65\x72\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x6C\x65\x73\x73","\x6C\x65\x73\x73\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x74\x69\x6D\x65\x6F\x75\x74","\x65\x78\x70\x6F\x72\x74\x73","\x63\x68\x61\x6E\x6E\x65\x6C","\x66\x61\x78","\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","\x61\x6C\x6C","\x73\x63\x6F\x70\x65"];_0x2e8b[0];var _=require(_0x2e8b[1]);var config=require(_0x2e8b[2]);var moment=require(_0x2e8b[3]);var sequelize=require(_0x2e8b[5])[_0x2e8b[4]];var Automation=require(_0x2e8b[5])[_0x2e8b[6]];var FaxRoom=require(_0x2e8b[5])[_0x2e8b[7]];var Settings=require(_0x2e8b[5])[_0x2e8b[8]];var automationTimeout;var activeAutomations={};function executeAutomation(_0xbd8axb){var _0xbd8axc={where:{$and:[],$or:[]}};var _0xbd8axd={};_0xbd8axb[_0x2e8b[14]][_0x2e8b[13]](function(_0xbd8axe){_0xbd8axc[_0x2e8b[12]][_0x2e8b[11]][_0x2e8b[10]](getCondition(_0xbd8axe[_0x2e8b[9]]))});_0xbd8axb[_0x2e8b[16]][_0x2e8b[13]](function(_0xbd8axe){_0xbd8axc[_0x2e8b[12]][_0x2e8b[15]][_0x2e8b[10]](getCondition(_0xbd8axe[_0x2e8b[9]]))});return FaxRoom[_0x2e8b[25]](_0xbd8axc)[_0x2e8b[24]](function(_0xbd8ax10){_0xbd8ax10[_0x2e8b[13]](function(_0xbd8ax11){_0xbd8axb[_0x2e8b[23]][_0x2e8b[13]](function(_0xbd8ax12){switch(_0xbd8ax12[_0x2e8b[22]]){case _0x2e8b[21]:setStatus(_0xbd8ax11[_0x2e8b[19]],_0xbd8ax12[_0x2e8b[20]]);break;default:}})})})[_0x2e8b[18]](function(_0xbd8axf){console[_0x2e8b[17]](_0xbd8axf)})}function setStatus(_0xbd8ax14,_0xbd8ax15){return FaxRoom[_0x2e8b[26]]({status:_0xbd8ax15},{where:{id:_0xbd8ax14}})[_0x2e8b[18]](function(_0xbd8axf){console[_0x2e8b[17]](_0xbd8axf)})}function getCondition(_0xbd8axe){var _0xbd8ax17={};switch(_0xbd8axe[_0x2e8b[27]]){case _0x2e8b[21]:switch(_0xbd8axe[_0x2e8b[31]]){case _0x2e8b[29]:_0xbd8ax17[_0xbd8axe[_0x2e8b[27]]]=_0xbd8axe[_0x2e8b[28]];break;case _0x2e8b[30]:_0xbd8ax17[_0xbd8axe[_0x2e8b[27]]]={$ne:_0xbd8axe[_0x2e8b[28]]};break;default:};break;case _0x2e8b[40]:var _0xbd8ax18=moment()[_0x2e8b[35]](parseInt(_0xbd8axe[_0x2e8b[28]],10),_0x2e8b[34])[_0x2e8b[33]](_0x2e8b[32]);switch(_0xbd8axe[_0x2e8b[31]]){case _0x2e8b[36]:_0xbd8ax17[_0xbd8axe[_0x2e8b[27]]]={lt:_0xbd8ax18};break;case _0x2e8b[37]:_0xbd8ax17[_0xbd8axe[_0x2e8b[27]]]={$lte:_0xbd8ax18};break;case _0x2e8b[38]:_0xbd8ax17[_0xbd8axe[_0x2e8b[27]]]={$gt:_0xbd8ax18};break;case _0x2e8b[39]:_0xbd8ax17[_0xbd8axe[_0x2e8b[27]]]={$gte:_0xbd8ax18};break;default:};break;default:};return _0xbd8ax17}function createInterval(_0xbd8axb){activeAutomations[_0x2e8b[41]+_0xbd8axb[_0x2e8b[19]]]=setInterval(function(){executeAutomation(_0xbd8axb)},_0xbd8axb[_0x2e8b[42]]*60*1000)}module[_0x2e8b[43]]=function(){Automation[_0x2e8b[46]](function(_0xbd8ax1a,_0xbd8ax1b){if(_0xbd8ax1a[_0x2e8b[21]]&&_0xbd8ax1a[_0x2e8b[44]]===_0x2e8b[45]){createInterval(_0xbd8ax1a)}});Automation[_0x2e8b[47]](function(_0xbd8ax1a,_0xbd8ax1b){if(activeAutomations[_0x2e8b[41]+_0xbd8ax1a[_0x2e8b[19]]]){clearInterval(activeAutomations[_0x2e8b[41]+_0xbd8ax1a[_0x2e8b[19]]])};if(_0xbd8ax1a[_0x2e8b[21]]&&_0xbd8ax1a[_0x2e8b[44]]===_0x2e8b[45]){createInterval(_0xbd8ax1a)}});Automation[_0x2e8b[48]](function(_0xbd8ax1a,_0xbd8ax1b){if(activeAutomations[_0x2e8b[41]+_0xbd8ax1a[_0x2e8b[19]]]){clearInterval(activeAutomations[_0x2e8b[41]+_0xbd8ax1a[_0x2e8b[19]]])}});return Automation[_0x2e8b[51]](_0x2e8b[50])[_0x2e8b[25]]({where:{status:true,channel:_0x2e8b[45]}})[_0x2e8b[24]](function(_0xbd8ax1c){_0xbd8ax1c[_0x2e8b[13]](function(_0xbd8axb){createInterval(_0xbd8axb)})})[_0x2e8b[18]](function(_0xbd8axf){console[_0x2e8b[49]](_0xbd8axf)})}
\ No newline at end of file
+var _0xca4f=["\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","\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x4D\x61\x69\x6C\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20","\x6C\x6F\x67","\x46\x61\x78\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x65\x78\x65\x63\x20\x65\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x69\x64","\x64\x61\x74\x61\x31","\x73\x74\x61\x74\x75\x73","\x61\x63\x74\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x41\x63\x74\x69\x6F\x6E\x73","\x74\x68\x65\x6E","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x70\x75\x73\x68","\x41\x6C\x6C","\x41\x6E\x79","\x6C\x65\x6E\x67\x74\x68","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x24\x6F\x72","\x66\x69\x6E\x64\x41\x6C\x6C","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x6C\x6C","\x73\x63\x6F\x70\x65","\x41\x75\x74\x6F\x6D\x61\x74\x69\x63\x20\x6D\x61\x69\x6C\x20\x73\x74\x61\x74\x75\x73\x20\x65\x72\x72\x6F\x72","\x75\x70\x64\x61\x74\x65","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65","\x65\x71\x75\x61\x6C\x73","\x6E\x6F\x74\x5F\x65\x71\x75\x61\x6C\x73","\x6F\x70\x65\x72\x61\x74\x6F\x72","\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","\x67\x72\x65\x61\x74\x65\x72","\x67\x72\x65\x61\x74\x65\x72\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x6C\x65\x73\x73","\x6C\x65\x73\x73\x5F\x6F\x72\x5F\x65\x71\x75\x61\x6C","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x46\x61\x78\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20","\x20\x73\x65\x74\x20\x77\x69\x74\x68\x20\x74\x69\x6D\x65\x6F\x75\x74\x20","\x74\x69\x6D\x65\x6F\x75\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x65\x78\x70\x6F\x72\x74\x73","\x20\x63\x72\x65\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73\x20","\x63\x68\x61\x6E\x6E\x65\x6C","\x66\x61\x78","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x20\x75\x70\x64\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73\x20","\x46\x61\x78\x20\x61\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x75\x6E\x73\x65\x74\x20","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x20\x64\x65\x6C\x65\x74\x65\x64","\x61\x66\x74\x65\x72\x44\x65\x6C\x65\x74\x65","\x46\x61\x78\x20\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x20\x69\x6E\x69\x74\x20\x65\x72\x72\x6F\x72"];_0xca4f[0];var _=require(_0xca4f[1]);var config=require(_0xca4f[2]);var moment=require(_0xca4f[3]);var sequelize=require(_0xca4f[5])[_0xca4f[4]];var Automation=require(_0xca4f[5])[_0xca4f[6]];var FaxRoom=require(_0xca4f[5])[_0xca4f[7]];var automationTimeout;var activeFaxAutomations={};function executeAutomation(_0x24bcxa){console[_0xca4f[9]](_0xca4f[8],_0x24bcxa);var _0x24bcxb;return Automation[_0xca4f[30]](_0xca4f[29])[_0xca4f[28]](_0x24bcxa)[_0xca4f[18]](function(_0x24bcx10){_0x24bcxb= _0x24bcx10;var _0x24bcx11=[];var _0x24bcx12=[];var _0x24bcx13={where:{}};_0x24bcx10[_0xca4f[21]][_0xca4f[16]](function(_0x24bcx14){_0x24bcx12[_0xca4f[20]](getCondition(_0x24bcx14[_0xca4f[19]]))});_0x24bcx10[_0xca4f[22]][_0xca4f[16]](function(_0x24bcx14){_0x24bcx11[_0xca4f[20]](getCondition(_0x24bcx14[_0xca4f[19]]))});if(_0x24bcx12[_0xca4f[23]]){_0x24bcx13[_0xca4f[25]][_0xca4f[24]]= _0x24bcx12};if(_0x24bcx11[_0xca4f[23]]){_0x24bcx13[_0xca4f[25]][_0xca4f[26]]= _0x24bcx11};return FaxRoom[_0xca4f[27]](_0x24bcx13)})[_0xca4f[18]](function(_0x24bcxd){_0x24bcxd[_0xca4f[16]](function(_0x24bcxe){_0x24bcxb[_0xca4f[17]][_0xca4f[16]](function(_0x24bcxf){switch(_0x24bcxf[_0xca4f[15]]){case _0xca4f[14]:setStatus(_0x24bcxe[_0xca4f[12]],_0x24bcxf[_0xca4f[13]]);break;default:}})})})[_0xca4f[11]](function(_0x24bcxc){console[_0xca4f[9]](_0xca4f[10],_0x24bcxc)})}function setStatus(_0x24bcx16,_0x24bcx17){return FaxRoom[_0xca4f[32]]({status:_0x24bcx17},{where:{id:_0x24bcx16}})[_0xca4f[11]](function(_0x24bcxc){console[_0xca4f[9]](_0xca4f[31],_0x24bcxc)})}function getCondition(_0x24bcx14){var _0x24bcx19={};switch(_0x24bcx14[_0xca4f[33]]){case _0xca4f[14]:switch(_0x24bcx14[_0xca4f[37]]){case _0xca4f[35]:_0x24bcx19[_0x24bcx14[_0xca4f[33]]]= _0x24bcx14[_0xca4f[34]];break;case _0xca4f[36]:_0x24bcx19[_0x24bcx14[_0xca4f[33]]]= {$ne:_0x24bcx14[_0xca4f[34]]};break;default:};break;case _0xca4f[46]:var _0x24bcx1a=moment()[_0xca4f[41]](parseInt(_0x24bcx14[_0xca4f[34]],10),_0xca4f[40])[_0xca4f[39]](_0xca4f[38]);switch(_0x24bcx14[_0xca4f[37]]){case _0xca4f[42]:_0x24bcx19[_0x24bcx14[_0xca4f[33]]]= {lt:_0x24bcx1a};break;case _0xca4f[43]:_0x24bcx19[_0x24bcx14[_0xca4f[33]]]= {$lte:_0x24bcx1a};break;case _0xca4f[44]:_0x24bcx19[_0x24bcx14[_0xca4f[33]]]= {$gt:_0x24bcx1a};break;case _0xca4f[45]:_0x24bcx19[_0x24bcx14[_0xca4f[33]]]= {$gte:_0x24bcx1a};break;default:};break;default:};return _0x24bcx19}function createInterval(_0x24bcx10){console[_0xca4f[9]](_0xca4f[47],_0x24bcx10[_0xca4f[12]],_0xca4f[48],_0x24bcx10[_0xca4f[49]]* 60* 1000);activeFaxAutomations[_0xca4f[50]+ _0x24bcx10[_0xca4f[12]]]= setInterval(function(){executeAutomation(_0x24bcx10[_0xca4f[12]])},_0x24bcx10[_0xca4f[49]]* 60* 1000)}module[_0xca4f[51]]= function(){Automation[_0xca4f[55]](function(_0x24bcx1c,_0x24bcx1d){console[_0xca4f[9]](_0xca4f[47],_0x24bcx1c[_0xca4f[12]],_0xca4f[52],_0x24bcx1c[_0xca4f[14]]);if(_0x24bcx1c[_0xca4f[14]]&& _0x24bcx1c[_0xca4f[53]]=== _0xca4f[54]){createInterval(_0x24bcx1c)}});Automation[_0xca4f[58]](function(_0x24bcx1c,_0x24bcx1d){console[_0xca4f[9]](_0xca4f[47],_0x24bcx1c[_0xca4f[12]],_0xca4f[56],_0x24bcx1c[_0xca4f[14]]);if(activeFaxAutomations[_0xca4f[50]+ _0x24bcx1c[_0xca4f[12]]]){console[_0xca4f[9]](_0xca4f[57],_0x24bcx1c[_0xca4f[12]]);clearInterval(activeFaxAutomations[_0xca4f[50]+ _0x24bcx1c[_0xca4f[12]]]);delete activeFaxAutomations[_0xca4f[50]+ _0x24bcx1c[_0xca4f[12]]]};if(_0x24bcx1c[_0xca4f[14]]&& _0x24bcx1c[_0xca4f[53]]=== _0xca4f[54]){createInterval(_0x24bcx1c)}});Automation[_0xca4f[60]](function(_0x24bcx1c,_0x24bcx1d){console[_0xca4f[9]](_0xca4f[47],_0x24bcx1c[_0xca4f[12]],_0xca4f[59]);if(activeFaxAutomations[_0xca4f[50]+ _0x24bcx1c[_0xca4f[12]]]){console[_0xca4f[9]](_0xca4f[57],_0x24bcx1c[_0xca4f[12]]);clearInterval(activeFaxAutomations[_0xca4f[50]+ _0x24bcx1c[_0xca4f[12]]]);delete activeFaxAutomations[_0xca4f[50]+ _0x24bcx1c[_0xca4f[12]]]}});return Automation[_0xca4f[30]](_0xca4f[29])[_0xca4f[27]]({where:{status:true,channel:_0xca4f[54]},attributes:[_0xca4f[12],_0xca4f[49]]})[_0xca4f[18]](function(_0x24bcx1e){_0x24bcx1e[_0xca4f[16]](function(_0x24bcx10){createInterval(_0x24bcx10)})})[_0xca4f[11]](function(_0x24bcxc){console[_0xca4f[9]](_0xca4f[61],_0x24bcxc)})}
\ No newline at end of file