Built motion from commit d127c62.|0.0.151
[motion.git] / server / config / automations / fax.js
index 77168e0..1f2bf5f 100644 (file)
@@ -1 +1 @@
-var _0xf4c1=["\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","\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","\x24\x61\x6E\x64","\x77\x68\x65\x72\x65","\x41\x6C\x6C","\x24\x6F\x72","\x41\x6E\x79","\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"];_0xf4c1[0];var _=require(_0xf4c1[1]);var config=require(_0xf4c1[2]);var moment=require(_0xf4c1[3]);var sequelize=require(_0xf4c1[5])[_0xf4c1[4]];var Automation=require(_0xf4c1[5])[_0xf4c1[6]];var FaxRoom=require(_0xf4c1[5])[_0xf4c1[7]];var Settings=require(_0xf4c1[5])[_0xf4c1[8]];var automationTimeout;var activeFaxAutomations={};function executeAutomation(_0x71f7xb){console[_0xf4c1[10]](_0xf4c1[9],_0x71f7xb);var _0x71f7xc;return Automation[_0xf4c1[30]](_0xf4c1[29])[_0xf4c1[28]](_0x71f7xb)[_0xf4c1[19]](function(_0x71f7x11){_0x71f7xc= _0x71f7x11;var _0x71f7x12={where:{$and:[],$or:[]}};_0x71f7x11[_0xf4c1[24]][_0xf4c1[17]](function(_0x71f7x13){_0x71f7x12[_0xf4c1[23]][_0xf4c1[22]][_0xf4c1[21]](getCondition(_0x71f7x13[_0xf4c1[20]]))});_0x71f7x11[_0xf4c1[26]][_0xf4c1[17]](function(_0x71f7x13){_0x71f7x12[_0xf4c1[23]][_0xf4c1[25]][_0xf4c1[21]](getCondition(_0x71f7x13[_0xf4c1[20]]))});return FaxRoom[_0xf4c1[27]](_0x71f7x12)})[_0xf4c1[19]](function(_0x71f7xe){_0x71f7xe[_0xf4c1[17]](function(_0x71f7xf){_0x71f7xc[_0xf4c1[18]][_0xf4c1[17]](function(_0x71f7x10){switch(_0x71f7x10[_0xf4c1[16]]){case _0xf4c1[15]:setStatus(_0x71f7xf[_0xf4c1[13]],_0x71f7x10[_0xf4c1[14]]);break;default:}})})})[_0xf4c1[12]](function(_0x71f7xd){console[_0xf4c1[10]](_0xf4c1[11],_0x71f7xd)})}function setStatus(_0x71f7x15,_0x71f7x16){return FaxRoom[_0xf4c1[32]]({status:_0x71f7x16},{where:{id:_0x71f7x15}})[_0xf4c1[12]](function(_0x71f7xd){console[_0xf4c1[10]](_0xf4c1[31],_0x71f7xd)})}function getCondition(_0x71f7x13){var _0x71f7x18={};switch(_0x71f7x13[_0xf4c1[33]]){case _0xf4c1[15]:switch(_0x71f7x13[_0xf4c1[37]]){case _0xf4c1[35]:_0x71f7x18[_0x71f7x13[_0xf4c1[33]]]= _0x71f7x13[_0xf4c1[34]];break;case _0xf4c1[36]:_0x71f7x18[_0x71f7x13[_0xf4c1[33]]]= {$ne:_0x71f7x13[_0xf4c1[34]]};break;default:};break;case _0xf4c1[46]:var _0x71f7x19=moment()[_0xf4c1[41]](parseInt(_0x71f7x13[_0xf4c1[34]],10),_0xf4c1[40])[_0xf4c1[39]](_0xf4c1[38]);switch(_0x71f7x13[_0xf4c1[37]]){case _0xf4c1[42]:_0x71f7x18[_0x71f7x13[_0xf4c1[33]]]= {lt:_0x71f7x19};break;case _0xf4c1[43]:_0x71f7x18[_0x71f7x13[_0xf4c1[33]]]= {$lte:_0x71f7x19};break;case _0xf4c1[44]:_0x71f7x18[_0x71f7x13[_0xf4c1[33]]]= {$gt:_0x71f7x19};break;case _0xf4c1[45]:_0x71f7x18[_0x71f7x13[_0xf4c1[33]]]= {$gte:_0x71f7x19};break;default:};break;default:};return _0x71f7x18}function createInterval(_0x71f7x11){console[_0xf4c1[10]](_0xf4c1[47],_0x71f7x11[_0xf4c1[13]],_0xf4c1[48],_0x71f7x11[_0xf4c1[49]]* 60* 1000);activeFaxAutomations[_0xf4c1[50]+ _0x71f7x11[_0xf4c1[13]]]= setInterval(function(){executeAutomation(_0x71f7x11[_0xf4c1[13]])},_0x71f7x11[_0xf4c1[49]]* 60* 1000)}module[_0xf4c1[51]]= function(){Automation[_0xf4c1[55]](function(_0x71f7x1b,_0x71f7x1c){console[_0xf4c1[10]](_0xf4c1[47],_0x71f7x1b[_0xf4c1[13]],_0xf4c1[52],_0x71f7x1b[_0xf4c1[15]]);if(_0x71f7x1b[_0xf4c1[15]]&& _0x71f7x1b[_0xf4c1[53]]=== _0xf4c1[54]){createInterval(_0x71f7x1b)}});Automation[_0xf4c1[58]](function(_0x71f7x1b,_0x71f7x1c){console[_0xf4c1[10]](_0xf4c1[47],_0x71f7x1b[_0xf4c1[13]],_0xf4c1[56],_0x71f7x1b[_0xf4c1[15]]);if(activeFaxAutomations[_0xf4c1[50]+ _0x71f7x1b[_0xf4c1[13]]]){console[_0xf4c1[10]](_0xf4c1[57],_0x71f7x1b[_0xf4c1[13]]);clearInterval(activeFaxAutomations[_0xf4c1[50]+ _0x71f7x1b[_0xf4c1[13]]]);delete activeFaxAutomations[_0xf4c1[50]+ _0x71f7x1b[_0xf4c1[13]]]};if(_0x71f7x1b[_0xf4c1[15]]&& _0x71f7x1b[_0xf4c1[53]]=== _0xf4c1[54]){createInterval(_0x71f7x1b)}});Automation[_0xf4c1[60]](function(_0x71f7x1b,_0x71f7x1c){console[_0xf4c1[10]](_0xf4c1[47],_0x71f7x1b[_0xf4c1[13]],_0xf4c1[59]);if(activeFaxAutomations[_0xf4c1[50]+ _0x71f7x1b[_0xf4c1[13]]]){console[_0xf4c1[10]](_0xf4c1[57],_0x71f7x1b[_0xf4c1[13]]);clearInterval(activeFaxAutomations[_0xf4c1[50]+ _0x71f7x1b[_0xf4c1[13]]]);delete activeFaxAutomations[_0xf4c1[50]+ _0x71f7x1b[_0xf4c1[13]]]}});return Automation[_0xf4c1[30]](_0xf4c1[29])[_0xf4c1[27]]({where:{status:true,channel:_0xf4c1[54]},attributes:[_0xf4c1[13],_0xf4c1[49]]})[_0xf4c1[19]](function(_0x71f7x1d){_0x71f7x1d[_0xf4c1[17]](function(_0x71f7x11){createInterval(_0x71f7x11)})})[_0xf4c1[12]](function(_0x71f7xd){console[_0xf4c1[10]](_0xf4c1[61],_0x71f7xd)})}
\ No newline at end of file
+var _0xe704=["\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"];_0xe704[0];var _=require(_0xe704[1]);var moment=require(_0xe704[2]);var Automation=require(_0xe704[4])[_0xe704[3]];var FaxRoom=require(_0xe704[4])[_0xe704[5]];var activeFaxAutomations={};function executeAutomation(_0x3a88x7){console[_0xe704[7]](_0xe704[6],_0x3a88x7);var _0x3a88x8;return Automation[_0xe704[33]](_0xe704[32])[_0xe704[31]](_0x3a88x7)[_0xe704[21]](function(_0x3a88xd){_0x3a88x8= _0x3a88xd;var _0x3a88xe=[];var _0x3a88xf=[];var _0x3a88x10={where:{}};_0x3a88xd[_0xe704[24]][_0xe704[19]](function(_0x3a88x11){_0x3a88xf[_0xe704[23]](getCondition(_0x3a88x11[_0xe704[22]]))});_0x3a88xd[_0xe704[25]][_0xe704[19]](function(_0x3a88x11){_0x3a88xe[_0xe704[23]](getCondition(_0x3a88x11[_0xe704[22]]))});if(_0x3a88xf[_0xe704[26]]){_0x3a88x10[_0xe704[28]][_0xe704[27]]= _0x3a88xf};if(_0x3a88xe[_0xe704[26]]){_0x3a88x10[_0xe704[28]][_0xe704[29]]= _0x3a88xe};return FaxRoom[_0xe704[30]](_0x3a88x10)})[_0xe704[21]](function(_0x3a88xa){_0x3a88xa[_0xe704[19]](function(_0x3a88xb){_0x3a88x8[_0xe704[20]][_0xe704[19]](function(_0x3a88xc){switch(_0x3a88xc[_0xe704[18]]){case _0xe704[17]:setStatus(_0x3a88xb[_0xe704[15]],_0x3a88xc[_0xe704[16]]);break;default:}})})})[_0xe704[14]](function(_0x3a88x9){console[_0xe704[9]](_0xe704[8]);console[_0xe704[9]](_0xe704[10],_0x3a88x9[_0xe704[11]]);console[_0xe704[9]](_0xe704[12],_0x3a88x9[_0xe704[13]])})}function setStatus(_0x3a88x13,_0x3a88x14){return FaxRoom[_0xe704[35]]({status:_0x3a88x14},{where:{id:_0x3a88x13}})[_0xe704[14]](function(_0x3a88x9){console[_0xe704[9]](_0xe704[34]);console[_0xe704[9]](_0xe704[10],_0x3a88x9[_0xe704[11]]);console[_0xe704[9]](_0xe704[12],_0x3a88x9[_0xe704[13]])})}function getCondition(_0x3a88x11){var _0x3a88x16={};switch(_0x3a88x11[_0xe704[36]]){case _0xe704[17]:switch(_0x3a88x11[_0xe704[40]]){case _0xe704[38]:_0x3a88x16[_0x3a88x11[_0xe704[36]]]= _0x3a88x11[_0xe704[37]];break;case _0xe704[39]:_0x3a88x16[_0x3a88x11[_0xe704[36]]]= {$ne:_0x3a88x11[_0xe704[37]]};break;default:};break;case _0xe704[49]:var _0x3a88x17=moment()[_0xe704[44]](parseInt(_0x3a88x11[_0xe704[37]],10),_0xe704[43])[_0xe704[42]](_0xe704[41]);switch(_0x3a88x11[_0xe704[40]]){case _0xe704[45]:_0x3a88x16[_0x3a88x11[_0xe704[36]]]= {lt:_0x3a88x17};break;case _0xe704[46]:_0x3a88x16[_0x3a88x11[_0xe704[36]]]= {$lte:_0x3a88x17};break;case _0xe704[47]:_0x3a88x16[_0x3a88x11[_0xe704[36]]]= {$gt:_0x3a88x17};break;case _0xe704[48]:_0x3a88x16[_0x3a88x11[_0xe704[36]]]= {$gte:_0x3a88x17};break;default:};break;default:};return _0x3a88x16}function createInterval(_0x3a88xd){console[_0xe704[7]](_0xe704[50],_0x3a88xd[_0xe704[15]],_0xe704[51],_0x3a88xd[_0xe704[52]]* 60* 1000);activeFaxAutomations[_0xe704[53]+ _0x3a88xd[_0xe704[15]]]= setInterval(function(){executeAutomation(_0x3a88xd[_0xe704[15]])},_0x3a88xd[_0xe704[52]]* 60* 1000)}module[_0xe704[54]]= function(){console[_0xe704[7]](_0xe704[55]);Automation[_0xe704[60]](function(_0x3a88x19,_0x3a88x1a){if(_0x3a88x19[_0xe704[56]]=== _0xe704[57]){console[_0xe704[7]](_0xe704[58],_0x3a88x19[_0xe704[15]],_0xe704[59],_0x3a88x19[_0xe704[17]]);if(_0x3a88x19[_0xe704[17]]){createInterval(_0x3a88x19)}}});Automation[_0xe704[63]](function(_0x3a88x19,_0x3a88x1a){if(_0x3a88x19[_0xe704[56]]=== _0xe704[57]){console[_0xe704[7]](_0xe704[58],_0x3a88x19[_0xe704[15]],_0xe704[61],_0x3a88x19[_0xe704[17]]);if(activeFaxAutomations[_0xe704[53]+ _0x3a88x19[_0xe704[15]]]){console[_0xe704[7]](_0xe704[62],_0x3a88x19[_0xe704[15]]);clearInterval(activeFaxAutomations[_0xe704[53]+ _0x3a88x19[_0xe704[15]]]);delete activeFaxAutomations[_0xe704[53]+ _0x3a88x19[_0xe704[15]]]};if(_0x3a88x19[_0xe704[17]]){createInterval(_0x3a88x19)}}});Automation[_0xe704[65]](function(_0x3a88x19,_0x3a88x1a){if(_0x3a88x19[_0xe704[56]]=== _0xe704[57]){console[_0xe704[7]](_0xe704[58],_0x3a88x19[_0xe704[15]],_0xe704[64]);if(activeFaxAutomations[_0xe704[53]+ _0x3a88x19[_0xe704[15]]]){console[_0xe704[7]](_0xe704[62],_0x3a88x19[_0xe704[15]]);clearInterval(activeFaxAutomations[_0xe704[53]+ _0x3a88x19[_0xe704[15]]]);delete activeFaxAutomations[_0xe704[53]+ _0x3a88x19[_0xe704[15]]]}}});return Automation[_0xe704[33]](_0xe704[32])[_0xe704[30]]({where:{status:true,channel:_0xe704[57]},attributes:[_0xe704[15],_0xe704[52]]})[_0xe704[21]](function(_0x3a88x1b){console[_0xe704[7]](_0xe704[67],_0x3a88x1b[_0xe704[26]]);_0x3a88x1b[_0xe704[19]](function(_0x3a88xd){createInterval(_0x3a88xd)})})[_0xe704[14]](function(_0x3a88x9){console[_0xe704[9]](_0xe704[66]);console[_0xe704[9]](_0xe704[10],_0x3a88x9[_0xe704[11]]);console[_0xe704[9]](_0xe704[12],_0x3a88x9[_0xe704[13]])})}
\ No newline at end of file