Built motion from commit fd18f58.|0.0.129
[motion.git] / server / config / automations / fax.js
index a8743ac..493a72a 100644 (file)
@@ -1 +1 @@
-var _0x875e=["\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"];_0x875e[0];var _=require(_0x875e[1]);var config=require(_0x875e[2]);var moment=require(_0x875e[3]);var sequelize=require(_0x875e[5])[_0x875e[4]];var Automation=require(_0x875e[5])[_0x875e[6]];var FaxRoom=require(_0x875e[5])[_0x875e[7]];var Settings=require(_0x875e[5])[_0x875e[8]];var automationTimeout;var activeAutomations={};function executeAutomation(_0xec9fxb){var _0xec9fxc={where:{$and:[],$or:[]}};var _0xec9fxd={};_0xec9fxb[_0x875e[14]][_0x875e[13]](function(_0xec9fxe){_0xec9fxc[_0x875e[12]][_0x875e[11]][_0x875e[10]](getCondition(_0xec9fxe[_0x875e[9]]))});_0xec9fxb[_0x875e[16]][_0x875e[13]](function(_0xec9fxe){_0xec9fxc[_0x875e[12]][_0x875e[15]][_0x875e[10]](getCondition(_0xec9fxe[_0x875e[9]]))});return FaxRoom[_0x875e[25]](_0xec9fxc)[_0x875e[24]](function(_0xec9fx10){_0xec9fx10[_0x875e[13]](function(_0xec9fx11){_0xec9fxb[_0x875e[23]][_0x875e[13]](function(_0xec9fx12){switch(_0xec9fx12[_0x875e[22]]){case _0x875e[21]:setStatus(_0xec9fx11[_0x875e[19]],_0xec9fx12[_0x875e[20]]);break;default:}})})})[_0x875e[18]](function(_0xec9fxf){console[_0x875e[17]](_0xec9fxf)})}function setStatus(_0xec9fx14,_0xec9fx15){return FaxRoom[_0x875e[26]]({status:_0xec9fx15},{where:{id:_0xec9fx14}})[_0x875e[18]](function(_0xec9fxf){console[_0x875e[17]](_0xec9fxf)})}function getCondition(_0xec9fxe){var _0xec9fx17={};switch(_0xec9fxe[_0x875e[27]]){case _0x875e[21]:switch(_0xec9fxe[_0x875e[31]]){case _0x875e[29]:_0xec9fx17[_0xec9fxe[_0x875e[27]]]=_0xec9fxe[_0x875e[28]];break;case _0x875e[30]:_0xec9fx17[_0xec9fxe[_0x875e[27]]]={$ne:_0xec9fxe[_0x875e[28]]};break;default:};break;case _0x875e[40]:var _0xec9fx18=moment()[_0x875e[35]](parseInt(_0xec9fxe[_0x875e[28]],10),_0x875e[34])[_0x875e[33]](_0x875e[32]);switch(_0xec9fxe[_0x875e[31]]){case _0x875e[36]:_0xec9fx17[_0xec9fxe[_0x875e[27]]]={lt:_0xec9fx18};break;case _0x875e[37]:_0xec9fx17[_0xec9fxe[_0x875e[27]]]={$lte:_0xec9fx18};break;case _0x875e[38]:_0xec9fx17[_0xec9fxe[_0x875e[27]]]={$gt:_0xec9fx18};break;case _0x875e[39]:_0xec9fx17[_0xec9fxe[_0x875e[27]]]={$gte:_0xec9fx18};break;default:};break;default:};return _0xec9fx17}function createInterval(_0xec9fxb){activeAutomations[_0x875e[41]+_0xec9fxb[_0x875e[19]]]=setInterval(function(){executeAutomation(_0xec9fxb)},_0xec9fxb[_0x875e[42]]*1000)}module[_0x875e[43]]=function(){Automation[_0x875e[46]](function(_0xec9fx1a,_0xec9fx1b){if(_0xec9fx1a[_0x875e[21]]&&_0xec9fx1a[_0x875e[44]]===_0x875e[45]){createInterval(_0xec9fx1a)}});Automation[_0x875e[47]](function(_0xec9fx1a,_0xec9fx1b){if(activeAutomations[_0x875e[41]+_0xec9fx1a[_0x875e[19]]]){clearInterval(activeAutomations[_0x875e[41]+_0xec9fx1a[_0x875e[19]]])};if(_0xec9fx1a[_0x875e[21]]&&_0xec9fx1a[_0x875e[44]]===_0x875e[45]){createInterval(_0xec9fx1a)}});Automation[_0x875e[48]](function(_0xec9fx1a,_0xec9fx1b){if(activeAutomations[_0x875e[41]+_0xec9fx1a[_0x875e[19]]]){clearInterval(activeAutomations[_0x875e[41]+_0xec9fx1a[_0x875e[19]]])}});Automation[_0x875e[51]](_0x875e[50])[_0x875e[25]]({where:{status:true,channel:_0x875e[45]}})[_0x875e[24]](function(_0xec9fx1c){_0xec9fx1c[_0x875e[13]](function(_0xec9fxb){createInterval(_0xec9fxb)})})[_0x875e[18]](function(_0xec9fxf){console[_0x875e[49]](_0xec9fxf)})}
\ 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