Built motion from commit eada615.|0.0.146
[motion.git] / server / config / automations / fax.js
index a8743ac..5f612e1 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 _0x79ae=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x6D\x6F\x6D\x65\x6E\x74","\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x61\x78\x52\x6F\x6F\x6D","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x45\x78\x65\x63\x75\x74\x69\x6E\x67\x20\x46\x61\x78","\x6C\x6F\x67","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x46\x61\x78\x20\x65\x78\x65\x63","\x65\x72\x72\x6F\x72","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x3A","\x6D\x65\x73\x73\x61\x67\x65","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x53\x74\x61\x63\x6B\x3A","\x73\x74\x61\x63\x6B","\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","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x46\x61\x78\x20\x73\x65\x74\x53\x74\x61\x74\x75\x73","\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","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x4D\x61\x69\x6C","\x73\x65\x74\x20\x77\x69\x74\x68\x20\x74\x69\x6D\x65\x6F\x75\x74","\x74\x69\x6D\x65\x6F\x75\x74","\x69\x6E\x74\x65\x72\x76\x61\x6C","\x65\x78\x70\x6F\x72\x74\x73","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x46\x61\x78\x20\x73\x65\x72\x76\x69\x63\x65\x20\x73\x74\x61\x72\x74\x65\x64","\x63\x68\x61\x6E\x6E\x65\x6C","\x66\x61\x78","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x46\x61\x78","\x63\x72\x65\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x64\x2C\x20\x74\x68\x65\x20\x73\x74\x61\x74\x75\x73\x20\x69\x73","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x46\x61\x78\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","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x45\x72\x72\x6F\x72\x20\x69\x6E\x20\x4D\x61\x69\x6C\x20\x69\x6E\x69\x74","\x5B\x41\x75\x74\x6F\x6D\x61\x74\x69\x6F\x6E\x5D\x20\x46\x61\x78\x20\x61\x72\x65"];_0x79ae[0];var _=require(_0x79ae[1]);var moment=require(_0x79ae[2]);var Automation=require(_0x79ae[4])[_0x79ae[3]];var FaxRoom=require(_0x79ae[4])[_0x79ae[5]];var activeFaxAutomations={};function executeAutomation(_0xbc63x7){console[_0x79ae[7]](_0x79ae[6],_0xbc63x7);var _0xbc63x8;return Automation[_0x79ae[33]](_0x79ae[32])[_0x79ae[31]](_0xbc63x7)[_0x79ae[21]](function(_0xbc63xd){_0xbc63x8= _0xbc63xd;var _0xbc63xe=[];var _0xbc63xf=[];var _0xbc63x10={where:{}};_0xbc63xd[_0x79ae[24]][_0x79ae[19]](function(_0xbc63x11){_0xbc63xf[_0x79ae[23]](getCondition(_0xbc63x11[_0x79ae[22]]))});_0xbc63xd[_0x79ae[25]][_0x79ae[19]](function(_0xbc63x11){_0xbc63xe[_0x79ae[23]](getCondition(_0xbc63x11[_0x79ae[22]]))});if(_0xbc63xf[_0x79ae[26]]){_0xbc63x10[_0x79ae[28]][_0x79ae[27]]= _0xbc63xf};if(_0xbc63xe[_0x79ae[26]]){_0xbc63x10[_0x79ae[28]][_0x79ae[29]]= _0xbc63xe};return FaxRoom[_0x79ae[30]](_0xbc63x10)})[_0x79ae[21]](function(_0xbc63xa){_0xbc63xa[_0x79ae[19]](function(_0xbc63xb){_0xbc63x8[_0x79ae[20]][_0x79ae[19]](function(_0xbc63xc){switch(_0xbc63xc[_0x79ae[18]]){case _0x79ae[17]:setStatus(_0xbc63xb[_0x79ae[15]],_0xbc63xc[_0x79ae[16]]);break;default:}})})})[_0x79ae[14]](function(_0xbc63x9){console[_0x79ae[9]](_0x79ae[8]);console[_0x79ae[9]](_0x79ae[10],_0xbc63x9[_0x79ae[11]]);console[_0x79ae[9]](_0x79ae[12],_0xbc63x9[_0x79ae[13]])})}function setStatus(_0xbc63x13,_0xbc63x14){return FaxRoom[_0x79ae[35]]({status:_0xbc63x14},{where:{id:_0xbc63x13}})[_0x79ae[14]](function(_0xbc63x9){console[_0x79ae[9]](_0x79ae[34]);console[_0x79ae[9]](_0x79ae[10],_0xbc63x9[_0x79ae[11]]);console[_0x79ae[9]](_0x79ae[12],_0xbc63x9[_0x79ae[13]])})}function getCondition(_0xbc63x11){var _0xbc63x16={};switch(_0xbc63x11[_0x79ae[36]]){case _0x79ae[17]:switch(_0xbc63x11[_0x79ae[40]]){case _0x79ae[38]:_0xbc63x16[_0xbc63x11[_0x79ae[36]]]= _0xbc63x11[_0x79ae[37]];break;case _0x79ae[39]:_0xbc63x16[_0xbc63x11[_0x79ae[36]]]= {$ne:_0xbc63x11[_0x79ae[37]]};break;default:};break;case _0x79ae[49]:var _0xbc63x17=moment()[_0x79ae[44]](parseInt(_0xbc63x11[_0x79ae[37]],10),_0x79ae[43])[_0x79ae[42]](_0x79ae[41]);switch(_0xbc63x11[_0x79ae[40]]){case _0x79ae[45]:_0xbc63x16[_0xbc63x11[_0x79ae[36]]]= {lt:_0xbc63x17};break;case _0x79ae[46]:_0xbc63x16[_0xbc63x11[_0x79ae[36]]]= {$lte:_0xbc63x17};break;case _0x79ae[47]:_0xbc63x16[_0xbc63x11[_0x79ae[36]]]= {$gt:_0xbc63x17};break;case _0x79ae[48]:_0xbc63x16[_0xbc63x11[_0x79ae[36]]]= {$gte:_0xbc63x17};break;default:};break;default:};return _0xbc63x16}function createInterval(_0xbc63xd){console[_0x79ae[7]](_0x79ae[50],_0xbc63xd[_0x79ae[15]],_0x79ae[51],_0xbc63xd[_0x79ae[52]]* 60* 1000);activeFaxAutomations[_0x79ae[53]+ _0xbc63xd[_0x79ae[15]]]= setInterval(function(){executeAutomation(_0xbc63xd[_0x79ae[15]])},_0xbc63xd[_0x79ae[52]]* 60* 1000)}module[_0x79ae[54]]= function(){console[_0x79ae[7]](_0x79ae[55]);Automation[_0x79ae[60]](function(_0xbc63x19,_0xbc63x1a){if(_0xbc63x19[_0x79ae[56]]=== _0x79ae[57]){console[_0x79ae[7]](_0x79ae[58],_0xbc63x19[_0x79ae[15]],_0x79ae[59],_0xbc63x19[_0x79ae[17]]);if(_0xbc63x19[_0x79ae[17]]){createInterval(_0xbc63x19)}}});Automation[_0x79ae[63]](function(_0xbc63x19,_0xbc63x1a){if(_0xbc63x19[_0x79ae[56]]=== _0x79ae[57]){console[_0x79ae[7]](_0x79ae[58],_0xbc63x19[_0x79ae[15]],_0x79ae[61],_0xbc63x19[_0x79ae[17]]);if(activeFaxAutomations[_0x79ae[53]+ _0xbc63x19[_0x79ae[15]]]){console[_0x79ae[7]](_0x79ae[62],_0xbc63x19[_0x79ae[15]]);clearInterval(activeFaxAutomations[_0x79ae[53]+ _0xbc63x19[_0x79ae[15]]]);delete activeFaxAutomations[_0x79ae[53]+ _0xbc63x19[_0x79ae[15]]]};if(_0xbc63x19[_0x79ae[17]]){createInterval(_0xbc63x19)}}});Automation[_0x79ae[65]](function(_0xbc63x19,_0xbc63x1a){if(_0xbc63x19[_0x79ae[56]]=== _0x79ae[57]){console[_0x79ae[7]](_0x79ae[58],_0xbc63x19[_0x79ae[15]],_0x79ae[64]);if(activeFaxAutomations[_0x79ae[53]+ _0xbc63x19[_0x79ae[15]]]){console[_0x79ae[7]](_0x79ae[62],_0xbc63x19[_0x79ae[15]]);clearInterval(activeFaxAutomations[_0x79ae[53]+ _0xbc63x19[_0x79ae[15]]]);delete activeFaxAutomations[_0x79ae[53]+ _0xbc63x19[_0x79ae[15]]]}}});return Automation[_0x79ae[33]](_0x79ae[32])[_0x79ae[30]]({where:{status:true,channel:_0x79ae[57]},attributes:[_0x79ae[15],_0x79ae[52]]})[_0x79ae[21]](function(_0xbc63x1b){console[_0x79ae[7]](_0x79ae[67],_0xbc63x1b[_0x79ae[26]]);_0xbc63x1b[_0x79ae[19]](function(_0xbc63xd){createInterval(_0xbc63xd)})})[_0x79ae[14]](function(_0xbc63x9){console[_0x79ae[9]](_0x79ae[66]);console[_0x79ae[9]](_0x79ae[10],_0xbc63x9[_0x79ae[11]]);console[_0x79ae[9]](_0x79ae[12],_0xbc63x9[_0x79ae[13]])})}
\ No newline at end of file