Built motion from commit fd18f58.|0.0.129
[motion.git] / server / config / automations / fax.js
index 1ee685c..493a72a 100644 (file)
@@ -1 +1 @@
-var _0x7437=["\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"];_0x7437[0];var _=require(_0x7437[1]);var config=require(_0x7437[2]);var moment=require(_0x7437[3]);var sequelize=require(_0x7437[5])[_0x7437[4]];var Automation=require(_0x7437[5])[_0x7437[6]];var FaxRoom=require(_0x7437[5])[_0x7437[7]];var Settings=require(_0x7437[5])[_0x7437[8]];var automationTimeout;var activeAutomations={};function executeAutomation(_0x6168xb){var _0x6168xc={where:{$and:[],$or:[]}};var _0x6168xd={};_0x6168xb[_0x7437[14]][_0x7437[13]](function(_0x6168xe){_0x6168xc[_0x7437[12]][_0x7437[11]][_0x7437[10]](getCondition(_0x6168xe[_0x7437[9]]))});_0x6168xb[_0x7437[16]][_0x7437[13]](function(_0x6168xe){_0x6168xc[_0x7437[12]][_0x7437[15]][_0x7437[10]](getCondition(_0x6168xe[_0x7437[9]]))});return FaxRoom[_0x7437[25]](_0x6168xc)[_0x7437[24]](function(_0x6168x10){_0x6168x10[_0x7437[13]](function(_0x6168x11){_0x6168xb[_0x7437[23]][_0x7437[13]](function(_0x6168x12){switch(_0x6168x12[_0x7437[22]]){case _0x7437[21]:setStatus(_0x6168x11[_0x7437[19]],_0x6168x12[_0x7437[20]]);break;default:}})})})[_0x7437[18]](function(_0x6168xf){console[_0x7437[17]](_0x6168xf)})}function setStatus(_0x6168x14,_0x6168x15){return FaxRoom[_0x7437[26]]({status:_0x6168x15},{where:{id:_0x6168x14}})[_0x7437[18]](function(_0x6168xf){console[_0x7437[17]](_0x6168xf)})}function getCondition(_0x6168xe){var _0x6168x17={};switch(_0x6168xe[_0x7437[27]]){case _0x7437[21]:switch(_0x6168xe[_0x7437[31]]){case _0x7437[29]:_0x6168x17[_0x6168xe[_0x7437[27]]]=_0x6168xe[_0x7437[28]];break;case _0x7437[30]:_0x6168x17[_0x6168xe[_0x7437[27]]]={$ne:_0x6168xe[_0x7437[28]]};break;default:};break;case _0x7437[40]:var _0x6168x18=moment()[_0x7437[35]](parseInt(_0x6168xe[_0x7437[28]],10),_0x7437[34])[_0x7437[33]](_0x7437[32]);switch(_0x6168xe[_0x7437[31]]){case _0x7437[36]:_0x6168x17[_0x6168xe[_0x7437[27]]]={lt:_0x6168x18};break;case _0x7437[37]:_0x6168x17[_0x6168xe[_0x7437[27]]]={$lte:_0x6168x18};break;case _0x7437[38]:_0x6168x17[_0x6168xe[_0x7437[27]]]={$gt:_0x6168x18};break;case _0x7437[39]:_0x6168x17[_0x6168xe[_0x7437[27]]]={$gte:_0x6168x18};break;default:};break;default:};return _0x6168x17}function createInterval(_0x6168xb){activeAutomations[_0x7437[41]+_0x6168xb[_0x7437[19]]]=setInterval(function(){executeAutomation(_0x6168xb)},_0x6168xb[_0x7437[42]]*60*1000)}module[_0x7437[43]]=function(){Automation[_0x7437[46]](function(_0x6168x1a,_0x6168x1b){if(_0x6168x1a[_0x7437[21]]&&_0x6168x1a[_0x7437[44]]===_0x7437[45]){createInterval(_0x6168x1a)}});Automation[_0x7437[47]](function(_0x6168x1a,_0x6168x1b){if(activeAutomations[_0x7437[41]+_0x6168x1a[_0x7437[19]]]){clearInterval(activeAutomations[_0x7437[41]+_0x6168x1a[_0x7437[19]]])};if(_0x6168x1a[_0x7437[21]]&&_0x6168x1a[_0x7437[44]]===_0x7437[45]){createInterval(_0x6168x1a)}});Automation[_0x7437[48]](function(_0x6168x1a,_0x6168x1b){if(activeAutomations[_0x7437[41]+_0x6168x1a[_0x7437[19]]]){clearInterval(activeAutomations[_0x7437[41]+_0x6168x1a[_0x7437[19]]])}});return Automation[_0x7437[51]](_0x7437[50])[_0x7437[25]]({where:{status:true,channel:_0x7437[45]}})[_0x7437[24]](function(_0x6168x1c){_0x6168x1c[_0x7437[13]](function(_0x6168xb){createInterval(_0x6168xb)})})[_0x7437[18]](function(_0x6168xf){console[_0x7437[49]](_0x6168xf)})}
\ 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