Built motion from commit 02c0abe.|0.0.118
[motion.git] / server / config / ami / fax.js
index 4e1b82b..776b087 100644 (file)
@@ -1 +1 @@
-var _0x10ac=["\x66\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6C\x6F\x64\x61\x73\x68","\x62\x6C\x75\x65\x62\x69\x72\x64","\x74\x69\x66\x66\x32\x70\x64\x66","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x65\x78\x65\x63","\x63\x68\x69\x6C\x64\x2D\x70\x72\x6F\x63\x65\x73\x73\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x61\x78\x52\x6F\x6F\x6D","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x46\x61\x78\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x54\x72\x75\x6E\x6B","\x43\x6F\x6E\x74\x61\x63\x74","\x46\x61\x78\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x63\x68\x61\x6E\x67\x65\x64","\x53\x45\x4E\x44\x49\x4E\x47","\x72\x65\x74\x72\x79","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x45\x72\x72\x6F\x72","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x45\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x46\x61\x78\x20\x6D\x65\x73\x73\x61\x67\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x76\x61\x6C\x75\x65","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x74\x68\x65\x6E","\x63\x68\x61\x6E\x6E\x65\x6C","\x66\x69\x6E\x64\x4F\x6E\x65","\x75\x70\x64\x61\x74\x65\x4D\x65\x73\x73\x61\x67\x65","\x63\x68\x61\x6E\x6E\x65\x6C\x73\x74\x61\x74\x65","\x63\x68\x61\x6E\x6E\x65\x6C\x73\x74\x61\x74\x65\x64\x65\x73\x63","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x6C\x69\x6E\x65\x6E\x75\x6D","\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x6C\x69\x6E\x65\x6E\x61\x6D\x65","\x61\x63\x63\x6F\x75\x6E\x74\x63\x6F\x64\x65","\x63\x6F\x6E\x74\x65\x78\x74","\x65\x78\x74\x65\x6E","\x70\x72\x69\x6F\x72\x69\x74\x79","\x75\x6E\x69\x71\x75\x65\x69\x64","\x6C\x69\x6E\x6B\x65\x64\x69\x64","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64","\x75\x70\x64\x61\x74\x65\x53\x65\x6E\x64","\x46\x61\x78\x20\x72\x6F\x6F\x6D\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x53\x45\x4E\x54","\x67\x65\x74\x46\x61\x78\x52\x6F\x6F\x6D","\x70\x61\x67\x65\x73\x74\x72\x61\x6E\x73\x66\x65\x72\x72\x65\x64","\x30","\x46\x41\x49\x4C\x45\x44","\x72\x65\x6D\x6F\x74\x65\x73\x74\x61\x74\x69\x6F\x6E\x69\x64","\x72\x65\x73\x6F\x6C\x75\x74\x69\x6F\x6E","\x74\x72\x61\x6E\x73\x66\x65\x72\x72\x61\x74\x65","\x72\x65\x63\x65\x69\x76\x65\x66\x61\x78","\x4E\x65\x77\x20\x46\x61\x78\x20\x6D\x65\x73\x73\x61\x67\x65\x20\x66\x72\x6F\x6D\x20\x25\x73","\x66\x6F\x72\x6D\x61\x74","\x63\x6C\x6F\x6E\x65","\x45\x72\x72\x6F\x72\x20\x72\x65\x63\x65\x69\x76\x69\x6E\x67\x20\x66\x61\x78\x20\x6D\x65\x73\x73\x61\x67\x65","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x66\x61\x78","\x69\x6E\x62\x6F\x75\x6E\x64","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64","\x2F","\x6A\x6F\x69\x6E","\x6E\x61\x6D\x65","\x70\x61\x72\x73\x65","\x2E\x70\x64\x66","\x69\x64","\x63\x72\x65\x61\x74\x65","\x46\x61\x78\x20\x72\x6F\x6F\x6D\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x2F\x63\x72\x65\x61\x74\x65\x64","\x46\x61\x78\x52\x6F\x6F\x6D\x49\x64","\x52\x45\x43\x45\x49\x56\x45\x44","\x66\x72\x6F\x6D","\x74\x6F","\x4E\x45\x57","\x43\x4C\x4F\x53\x45\x44","\x73\x70\x72\x65\x61\x64","\x46\x61\x78\x20\x61\x63\x63\x6F\x75\x6E\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x46\x61\x78\x20\x61\x63\x63\x6F\x75\x6E\x74\x20\x66\x6F\x75\x6E\x64\x3A","\x4C\x69\x73\x74\x49\x64","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x45\x72\x72\x6F\x72\x20\x73\x65\x6E\x64\x69\x6E\x67\x20\x66\x61\x78","\x45\x72\x72\x6F\x72\x20\x75\x70\x64\x61\x74\x69\x6E\x67\x20\x65\x72\x72\x6F\x72\x20\x73\x74\x61\x74\x75\x73","\x75\x70\x64\x61\x74\x65","\x72\x65\x73","\x6F\x72\x69\x67\x69\x6E\x61\x74\x65","\x25\x73\x2F\x25\x73\x2F\x25\x73","\x74\x65\x63\x68","\x6F\x75\x74\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78","\x22\x25\x73\x22\x20\x3C\x25\x73\x3E","\x65\x63\x6D","\x68\x65\x61\x64\x65\x72\x69\x6E\x66\x6F","\x6D\x69\x6E\x72\x61\x74\x65","\x6D\x61\x78\x72\x61\x74\x65","\x22\x25\x73\x22","\x6D\x6F\x64\x65\x6D","\x67\x61\x74\x65\x77\x61\x79","\x74\x33\x38\x74\x69\x6D\x65\x6F\x75\x74","\x61\x63\x74\x69\x6F\x6E","\x63\x68\x6D\x6F\x64\x53\x79\x6E\x63","\x46\x61\x78\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x2E\x74\x69\x66","\x67\x73\x20\x2D\x71\x20\x2D\x64\x4E\x4F\x50\x41\x55\x53\x45\x20\x2D\x64\x42\x41\x54\x43\x48\x20\x2D\x73\x44\x45\x56\x49\x43\x45\x3D\x74\x69\x66\x66\x67\x34\x20\x2D\x73\x50\x41\x50\x45\x52\x53\x49\x5A\x45\x3D\x6C\x65\x74\x74\x65\x72\x20\x2D\x73\x4F\x75\x74\x70\x75\x74\x46\x69\x6C\x65\x3D","\x20","\x61\x64\x64\x55\x73\x65\x72","\x61\x64\x64\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x54\x72\x75\x6E\x6B\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x4F\x50\x45\x4E","\x54\x72\x75\x6E\x6B\x4E\x61\x6D\x65","\x65\x78\x70\x6F\x72\x74\x73"];var fs=require(_0x10ac[0]);var util=require(_0x10ac[1]);var path=require(_0x10ac[2]);var config=require(_0x10ac[3]);var _=require(_0x10ac[4]);var Promise=require(_0x10ac[5]);var tiff2pdf=Promise[_0x10ac[7]](require(_0x10ac[6]));var exec=require(_0x10ac[9])[_0x10ac[8]];var FaxAccount=require(_0x10ac[11])[_0x10ac[10]];var FaxRoom=require(_0x10ac[11])[_0x10ac[12]];var FaxMessage=require(_0x10ac[11])[_0x10ac[13]];var FaxAttachment=require(_0x10ac[11])[_0x10ac[14]];var Trunk=require(_0x10ac[11])[_0x10ac[15]];var Contact=require(_0x10ac[11])[_0x10ac[16]];function Fax(_0x1b69x10){console[_0x10ac[18]](_0x10ac[17]);FaxMessage[_0x10ac[19]](function(_0x1b69x11){sendfax(_0x1b69x11,_0x1b69x10,0)});FaxMessage[_0x10ac[24]](function(_0x1b69x11){if(_0x1b69x11[_0x10ac[21]](_0x10ac[20])&&_0x1b69x11[_0x10ac[20]]===_0x10ac[22]){sendfax(_0x1b69x11,_0x1b69x10,_0x1b69x11[_0x10ac[23]]+1)}})}Fax[_0x10ac[26]][_0x10ac[25]]=function(_0x1b69x12){return FaxMessage[_0x10ac[34]]({where:{channel:_0x1b69x12[_0x10ac[33]]}})[_0x10ac[32]](function(_0x1b69x14){if(!_0x1b69x14){throw  new Error(_0x10ac[29])};return _0x1b69x14[_0x10ac[31]]({error:_0x1b69x12[_0x10ac[30]]})})[_0x10ac[28]](function(_0x1b69x13){console[_0x10ac[18]](_0x10ac[27],_0x1b69x13)})};Fax[_0x10ac[26]][_0x10ac[35]]=function(_0x1b69x12){return FaxMessage[_0x10ac[34]]({where:{filename:_0x1b69x12[_0x10ac[48]],localstationid:_0x1b69x12[_0x10ac[49]]}})[_0x10ac[32]](function(_0x1b69x14){if(!_0x1b69x14){throw  new Error(_0x10ac[29])};return _0x1b69x14[_0x10ac[31]]({channel:_0x1b69x12[_0x10ac[33]],channelstate:_0x1b69x12[_0x10ac[36]],channelstatedesc:_0x1b69x12[_0x10ac[37]],calleridnum:_0x1b69x12[_0x10ac[38]],calleridname:_0x1b69x12[_0x10ac[39]],connectedlinenum:_0x1b69x12[_0x10ac[40]],connectedlinename:_0x1b69x12[_0x10ac[41]],accountcode:_0x1b69x12[_0x10ac[42]],context:_0x1b69x12[_0x10ac[43]],exten:_0x1b69x12[_0x10ac[44]],priority:_0x1b69x12[_0x10ac[45]],uniqueid:_0x1b69x12[_0x10ac[46]],linkedid:_0x1b69x12[_0x10ac[47]],lastStatus:_0x1b69x12[_0x10ac[20]]})})[_0x10ac[28]](function(_0x1b69x13){console[_0x10ac[18]](_0x10ac[27],_0x1b69x13)})};Fax[_0x10ac[26]][_0x10ac[50]]=function(_0x1b69x12){var _0x1b69x15;return FaxMessage[_0x10ac[34]]({where:{filename:_0x1b69x12[_0x10ac[48]],localstationid:_0x1b69x12[_0x10ac[49]]}})[_0x10ac[32]](function(_0x1b69x14){if(!_0x1b69x14){throw  new Error(_0x10ac[29])};_0x1b69x15=_0x1b69x14;var _0x1b69x17=_0x10ac[52];if(_0x1b69x12[_0x10ac[54]]==_0x10ac[55]){_0x1b69x17=_0x10ac[56]};return _0x1b69x15[_0x10ac[31]]({remotestationid:_0x1b69x12[_0x10ac[57]],pagestransferred:_0x1b69x12[_0x10ac[54]],resolution:_0x1b69x12[_0x10ac[58]],transferrate:_0x1b69x12[_0x10ac[59]],status:_0x1b69x17})})[_0x10ac[32]](function(){return _0x1b69x15[_0x10ac[53]]()})[_0x10ac[32]](function(_0x1b69x16){if(!_0x1b69x16){throw  new Error(_0x10ac[51])};return _0x1b69x16[_0x10ac[31]]({lastEvent:_0x10ac[52]})})[_0x10ac[28]](function(_0x1b69x13){console[_0x10ac[18]](_0x10ac[27],_0x1b69x13)})};Fax[_0x10ac[26]][_0x10ac[60]]=function(_0x1b69x12){console[_0x10ac[18]](util[_0x10ac[62]](_0x10ac[61],_0x1b69x12[_0x10ac[38]]));var _0x1b69x18=_[_0x10ac[63]](_0x1b69x12);var _0x1b69x19;return FaxAccount[_0x10ac[34]]({where:{localstationid:_0x1b69x12[_0x10ac[49]]}})[_0x10ac[32]](function(_0x1b69x22){if(!_0x1b69x22){throw  new Error(_0x10ac[86])};console[_0x10ac[18]](_0x10ac[87],_0x1b69x12[_0x10ac[49]]);_0x1b69x19=_0x1b69x22;if(_0x1b69x19[_0x10ac[88]]){return Contact[_0x10ac[89]]({where:{ListId:_0x1b69x19[_0x10ac[88]],$or:[{phone:_0x1b69x12[_0x10ac[38]]},{fax:_0x1b69x12[_0x10ac[38]]}]},defaults:{phone:_0x1b69x12[_0x10ac[38]],fax:_0x1b69x12[_0x10ac[38]],firstName:_0x1b69x12[_0x10ac[38]],ListId:_0x1b69x19[_0x10ac[88]]}})}else {return []}})[_0x10ac[85]](function(_0x1b69x20,_0x1b69x21){if(_0x1b69x21!=undefined&& !_0x1b69x21){return _0x1b69x20[_0x10ac[31]]({fax:_0x1b69x12[_0x10ac[38]]})};return})[_0x10ac[32]](function(){return FaxRoom[_0x10ac[34]]({where:{from:_0x1b69x12[_0x10ac[38]],FaxAccountId:_0x1b69x19[_0x10ac[76]],status:{$ne:_0x10ac[84]}}})})[_0x10ac[32]](function(_0x1b69x1f){if(_0x1b69x1f){return _0x1b69x1f[_0x10ac[31]]({lastEvent:_0x10ac[80]})}else {return FaxRoom[_0x10ac[77]]({from:_0x1b69x18[_0x10ac[38]],account:_0x1b69x19[_0x10ac[73]],status:_0x10ac[83],lastEvent:_0x10ac[80],FaxAccountId:_0x1b69x19[_0x10ac[76]]})}})[_0x10ac[32]](function(_0x1b69x1f){if(!_0x1b69x1f){throw  new Error(_0x10ac[78])};_0x1b69x18[_0x10ac[79]]=_0x1b69x1f[_0x10ac[76]];_0x1b69x18[_0x10ac[20]]=_0x10ac[80];_0x1b69x18[_0x10ac[81]]=_0x1b69x18[_0x10ac[38]];_0x1b69x18[_0x10ac[82]]=_0x1b69x18[_0x10ac[49]];return FaxMessage[_0x10ac[77]](_0x1b69x18)})[_0x10ac[32]](function(_0x1b69x1b){var _0x1b69x1c=[];var _0x1b69x1d=path[_0x10ac[74]](_0x1b69x12[_0x10ac[48]])[_0x10ac[73]];var _0x1b69x1e=_0x1b69x1d+_0x10ac[75];return FaxAttachment[_0x10ac[77]]({path:path[_0x10ac[72]](config[_0x10ac[65]],_0x10ac[66],_0x10ac[67],_0x10ac[68],_0x10ac[69],_0x10ac[70],_0x1b69x1e),basename:_0x1b69x1e,name:_0x1b69x1d,FaxMessageId:_0x1b69x1b[_0x10ac[76]]})})[_0x10ac[32]](function(_0x1b69x1a){return tiff2pdf(_0x1b69x12[_0x10ac[48]],path[_0x10ac[72]](config[_0x10ac[65]],_0x10ac[66],_0x10ac[67],_0x10ac[68],_0x10ac[69],_0x10ac[70],_0x10ac[71]))})[_0x10ac[28]](function(_0x1b69x13){console[_0x10ac[18]](_0x10ac[64],_0x1b69x13)})};function sendfax(_0x1b69x1b,_0x1b69x10,_0x1b69x24){if(_0x1b69x1b[_0x10ac[20]]===_0x10ac[22]){var _0x1b69x25;var _0x1b69x15=_0x1b69x1b;var _0x1b69x26=_0x1b69x1b[_0x10ac[81]];var _0x1b69x27=_0x1b69x1b[_0x10ac[82]];var _0x1b69x28;var _0x1b69x29;var _0x1b69x2a,_0x1b69x2b;return FaxAccount[_0x10ac[34]]({where:{localstationid:_0x1b69x15[_0x10ac[81]]}})[_0x10ac[32]](function(_0x1b69x22){if(!_0x1b69x22){throw  new Error(_0x10ac[86])};_0x1b69x28=_0x1b69x22;return Trunk[_0x10ac[34]]({where:{name:_0x1b69x28[_0x10ac[119]]}})})[_0x10ac[32]](function(_0x1b69x2d){if(!_0x1b69x2d){throw  new Error(_0x10ac[116])};_0x1b69x29=_0x1b69x2d;if(_0x1b69x15[_0x10ac[79]]){return FaxRoom[_0x10ac[117]](_0x1b69x15.FaxRoomId)}else {return FaxRoom[_0x10ac[77]]({from:_0x1b69x26,account:_0x1b69x28[_0x10ac[73]],status:_0x10ac[118],FaxAccountId:_0x1b69x28[_0x10ac[76]]})}})[_0x10ac[32]](function(_0x1b69x16){_0x1b69x25=_0x1b69x16;return _0x1b69x25[_0x10ac[115]](_0x1b69x15[_0x10ac[76]])})[_0x10ac[32]](function(){return _0x1b69x25[_0x10ac[31]]({lastEvent:_0x10ac[22]})})[_0x10ac[32]](function(){return _0x1b69x25[_0x10ac[114]](_0x1b69x15.UserId)})[_0x10ac[32]](function(){if(_0x1b69x28[_0x10ac[88]]){return Contact[_0x10ac[89]]({where:{ListId:_0x1b69x28[_0x10ac[88]],$or:[{phone:_0x1b69x27},{fax:_0x1b69x27}]},defaults:{fax:_0x1b69x27,phone:_0x1b69x27,firstName:_0x1b69x27,ListId:_0x1b69x28[_0x10ac[88]]}})}else {return []}})[_0x10ac[85]](function(_0x1b69x20,_0x1b69x21){if(_0x1b69x21!=undefined&& !_0x1b69x21){return _0x1b69x20[_0x10ac[31]]({fax:_0x1b69x27})};return})[_0x10ac[32]](function(){_0x1b69x2a=_0x1b69x15[_0x10ac[109]][0][_0x10ac[2]];_0x1b69x2b=path[_0x10ac[72]](config[_0x10ac[65]],_0x10ac[66],_0x10ac[67],_0x10ac[68],_0x10ac[110],_0x10ac[70],_0x10ac[71],path[_0x10ac[74]](_0x1b69x2a)[_0x10ac[73]]+_0x10ac[111]);return exec(_0x10ac[112]+_0x1b69x2b+_0x10ac[113]+_0x1b69x2a)})[_0x10ac[32]](function(){fs[_0x10ac[108]](_0x1b69x2b,511);return _0x1b69x15[_0x10ac[31]]({filename:_0x1b69x2b,localstationid:_0x1b69x15[_0x10ac[81]],retry:_0x1b69x24})})[_0x10ac[32]](function(){return Promise[_0x10ac[7]](_0x1b69x10[_0x10ac[107]])({action:_0x10ac[94],channel:util[_0x10ac[62]](_0x10ac[95],_0x1b69x28[_0x10ac[96]],_0x1b69x29[_0x10ac[73]],_0x1b69x27),exten:_0x1b69x27,context:_0x10ac[97],priority:1,callerid:util[_0x10ac[62]](_0x10ac[98],_0x1b69x28[_0x10ac[49]],_0x1b69x28[_0x10ac[49]]),variable:{FAXNAME:_0x1b69x28[_0x10ac[73]],FAXNUMBER:_0x1b69x27,FAXECM:_0x1b69x28[_0x10ac[99]],FAXHEADERINFO:_0x1b69x28[_0x10ac[100]],FAXLOCALSTATIONID:_0x1b69x28[_0x10ac[49]],FAXMINRATE:_0x1b69x28[_0x10ac[101]],FAXMAXRATE:_0x1b69x28[_0x10ac[102]],FAXMODEM:util[_0x10ac[62]](_0x10ac[103],_0x1b69x28[_0x10ac[104]]),FAXGATEWAY:_0x1b69x28[_0x10ac[105]],FAXT38TIMEOUT:_0x1b69x28[_0x10ac[106]],FAXOUTFILE:_0x1b69x2b},account:_0x1b69x28[_0x10ac[49]]})})[_0x10ac[32]](function(_0x1b69x2c){console[_0x10ac[18]](_0x10ac[93],_0x1b69x2c)})[_0x10ac[28]](function(_0x1b69x13){console[_0x10ac[18]](_0x10ac[90],_0x1b69x13);return _0x1b69x15[_0x10ac[92]]({status:_0x10ac[56]})[_0x10ac[32]](function(){if(_0x1b69x25){return _0x1b69x25[_0x10ac[31]]({lastEvent:_0x10ac[56]})};return})[_0x10ac[28]](function(_0x1b69x13){console[_0x10ac[18]](_0x10ac[91])})})}}module[_0x10ac[120]]=Fax
\ No newline at end of file
+var _0x9660=["\x66\x73","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x6C\x6F\x64\x61\x73\x68","\x62\x6C\x75\x65\x62\x69\x72\x64","\x65\x78\x65\x63","\x63\x68\x69\x6C\x64\x2D\x70\x72\x6F\x63\x65\x73\x73\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x66\x73\x2D\x65\x78\x74\x72\x61","\x6D\x6F\x6D\x65\x6E\x74","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x61\x78\x52\x6F\x6F\x6D","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x46\x61\x78\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x54\x72\x75\x6E\x6B","\x43\x6F\x6E\x74\x61\x63\x74","\x2E\x2E\x2F\x72\x6F\x75\x74\x69\x6E\x67\x2F\x73\x63\x68\x65\x64\x75\x6C\x65\x72","\x46\x61\x78\x20\x49\x6E\x69\x74\x69\x61\x6C\x69\x7A\x61\x74\x69\x6F\x6E\x2E\x2E\x2E","\x6C\x6F\x67","\x61\x66\x74\x65\x72\x43\x72\x65\x61\x74\x65","\x73\x74\x61\x74\x75\x73","\x63\x68\x61\x6E\x67\x65\x64","\x53\x45\x4E\x44\x49\x4E\x47","\x72\x65\x74\x72\x79","\x61\x66\x74\x65\x72\x55\x70\x64\x61\x74\x65","\x75\x70\x64\x61\x74\x65\x45\x72\x72\x6F\x72","\x70\x72\x6F\x74\x6F\x74\x79\x70\x65","\x45\x72\x72\x6F\x72","\x63\x61\x74\x63\x68","\x46\x61\x78\x20\x6D\x65\x73\x73\x61\x67\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x76\x61\x6C\x75\x65","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x74\x68\x65\x6E","\x63\x68\x61\x6E\x6E\x65\x6C","\x66\x69\x6E\x64\x4F\x6E\x65","\x75\x70\x64\x61\x74\x65\x4D\x65\x73\x73\x61\x67\x65","\x63\x68\x61\x6E\x6E\x65\x6C\x73\x74\x61\x74\x65","\x63\x68\x61\x6E\x6E\x65\x6C\x73\x74\x61\x74\x65\x64\x65\x73\x63","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x61\x6D\x65","\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x6C\x69\x6E\x65\x6E\x75\x6D","\x63\x6F\x6E\x6E\x65\x63\x74\x65\x64\x6C\x69\x6E\x65\x6E\x61\x6D\x65","\x61\x63\x63\x6F\x75\x6E\x74\x63\x6F\x64\x65","\x63\x6F\x6E\x74\x65\x78\x74","\x65\x78\x74\x65\x6E","\x70\x72\x69\x6F\x72\x69\x74\x79","\x75\x6E\x69\x71\x75\x65\x69\x64","\x6C\x69\x6E\x6B\x65\x64\x69\x64","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64","\x75\x70\x64\x61\x74\x65\x53\x65\x6E\x64","\x46\x61\x78\x20\x72\x6F\x6F\x6D\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x53\x45\x4E\x54","\x67\x65\x74\x46\x61\x78\x52\x6F\x6F\x6D","\x70\x61\x67\x65\x73\x74\x72\x61\x6E\x73\x66\x65\x72\x72\x65\x64","\x30","\x46\x41\x49\x4C\x45\x44","\x72\x65\x6D\x6F\x74\x65\x73\x74\x61\x74\x69\x6F\x6E\x69\x64","\x72\x65\x73\x6F\x6C\x75\x74\x69\x6F\x6E","\x74\x72\x61\x6E\x73\x66\x65\x72\x72\x61\x74\x65","\x72\x65\x63\x65\x69\x76\x65\x66\x61\x78","\x4E\x65\x77\x20\x46\x61\x78\x20\x6D\x65\x73\x73\x61\x67\x65\x20\x66\x72\x6F\x6D\x20\x25\x73","\x66\x6F\x72\x6D\x61\x74","\x63\x6C\x6F\x6E\x65","\x45\x72\x72\x6F\x72\x20\x72\x65\x63\x65\x69\x76\x69\x6E\x67\x20\x66\x61\x78\x20\x6D\x65\x73\x73\x61\x67\x65","\x66\x61\x78","\x25\x73\x2E\x25\x73","\x75\x6E\x69\x78","\x69\x64","\x6E\x61\x6D\x65","\x66\x72\x6F\x6D","\x69\x6E\x69\x74","\x74\x69\x66\x66\x32\x70\x64\x66\x20\x2D\x6F\x20","\x20","\x70\x61\x72\x73\x65","\x2E\x70\x64\x66","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x69\x6E\x62\x6F\x75\x6E\x64","\x63\x6F\x6E\x76\x65\x72\x74\x65\x64","\x6A\x6F\x69\x6E","\x63\x72\x65\x61\x74\x65","\x46\x61\x78\x20\x72\x6F\x6F\x6D\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x2F\x63\x72\x65\x61\x74\x65\x64","\x46\x61\x78\x52\x6F\x6F\x6D\x49\x64","\x52\x45\x43\x45\x49\x56\x45\x44","\x74\x6F","\x4E\x45\x57","\x43\x4C\x4F\x53\x45\x44","\x73\x70\x72\x65\x61\x64","\x46\x61\x78\x20\x61\x63\x63\x6F\x75\x6E\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x46\x61\x78\x20\x61\x63\x63\x6F\x75\x6E\x74\x20\x66\x6F\x75\x6E\x64\x3A","\x4C\x69\x73\x74\x49\x64","\x66\x69\x6E\x64\x4F\x72\x43\x72\x65\x61\x74\x65","\x45\x72\x72\x6F\x72\x20\x73\x65\x6E\x64\x69\x6E\x67\x20\x66\x61\x78","\x45\x72\x72\x6F\x72\x20\x75\x70\x64\x61\x74\x69\x6E\x67\x20\x65\x72\x72\x6F\x72\x20\x73\x74\x61\x74\x75\x73","\x75\x70\x64\x61\x74\x65","\x72\x65\x73","\x6F\x72\x69\x67\x69\x6E\x61\x74\x65","\x25\x73\x2F\x25\x73\x2F\x25\x73","\x74\x65\x63\x68","\x6F\x75\x74\x62\x6F\x75\x6E\x64\x2D\x66\x61\x78","\x22\x25\x73\x22\x20\x3C\x25\x73\x3E","\x65\x63\x6D","\x68\x65\x61\x64\x65\x72\x69\x6E\x66\x6F","\x6D\x69\x6E\x72\x61\x74\x65","\x6D\x61\x78\x72\x61\x74\x65","\x22\x25\x73\x22","\x6D\x6F\x64\x65\x6D","\x67\x61\x74\x65\x77\x61\x79","\x74\x33\x38\x74\x69\x6D\x65\x6F\x75\x74","\x61\x63\x74\x69\x6F\x6E","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x63\x68\x6D\x6F\x64\x53\x79\x6E\x63","\x46\x61\x78\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x73","\x74\x79\x70\x65","\x61\x70\x70\x6C\x69\x63\x61\x74\x69\x6F\x6E\x2F\x70\x64\x66","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x2F","\x2E\x74\x69\x66","\x67\x73\x20\x2D\x71\x20\x2D\x64\x4E\x4F\x50\x41\x55\x53\x45\x20\x2D\x64\x42\x41\x54\x43\x48\x20\x2D\x73\x44\x45\x56\x49\x43\x45\x3D\x74\x69\x66\x66\x67\x34\x20\x2D\x73\x50\x41\x50\x45\x52\x53\x49\x5A\x45\x3D\x6C\x65\x74\x74\x65\x72\x20\x2D\x73\x4F\x75\x74\x70\x75\x74\x46\x69\x6C\x65\x3D","\x62\x61\x73\x65","\x63\x6F\x70\x79\x53\x79\x6E\x63","\x61\x64\x64\x55\x73\x65\x72","\x61\x64\x64\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x54\x72\x75\x6E\x6B\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x66\x69\x6E\x64\x42\x79\x49\x64","\x4F\x50\x45\x4E","\x54\x72\x75\x6E\x6B\x4E\x61\x6D\x65","\x65\x78\x70\x6F\x72\x74\x73"];var fs=require(_0x9660[0]);var util=require(_0x9660[1]);var path=require(_0x9660[2]);var config=require(_0x9660[3]);var _=require(_0x9660[4]);var Promise=require(_0x9660[5]);var exec=require(_0x9660[7])[_0x9660[6]];var fse=require(_0x9660[8]);var moment=require(_0x9660[9]);var FaxAccount=require(_0x9660[11])[_0x9660[10]];var FaxRoom=require(_0x9660[11])[_0x9660[12]];var FaxMessage=require(_0x9660[11])[_0x9660[13]];var FaxAttachment=require(_0x9660[11])[_0x9660[14]];var Trunk=require(_0x9660[11])[_0x9660[15]];var Contact=require(_0x9660[11])[_0x9660[16]];var Scheduler=require(_0x9660[17]);function Fax(_0x83f4x12){console[_0x9660[19]](_0x9660[18]);FaxMessage[_0x9660[20]](function(_0x83f4x13){sendfax(_0x83f4x13,_0x83f4x12,0)});FaxMessage[_0x9660[25]](function(_0x83f4x13){if(_0x83f4x13[_0x9660[22]](_0x9660[21])&& _0x83f4x13[_0x9660[21]]=== _0x9660[23]){sendfax(_0x83f4x13,_0x83f4x12,_0x83f4x13[_0x9660[24]]+ 1)}})}Fax[_0x9660[27]][_0x9660[26]]= function(_0x83f4x14){return FaxMessage[_0x9660[35]]({where:{channel:_0x83f4x14[_0x9660[34]]}})[_0x9660[33]](function(_0x83f4x16){if(!_0x83f4x16){throw  new Error(_0x9660[30])};return _0x83f4x16[_0x9660[32]]({error:_0x83f4x14[_0x9660[31]]})})[_0x9660[29]](function(_0x83f4x15){console[_0x9660[19]](_0x9660[28],_0x83f4x15)})};Fax[_0x9660[27]][_0x9660[36]]= function(_0x83f4x14){return FaxMessage[_0x9660[35]]({where:{filename:_0x83f4x14[_0x9660[49]],localstationid:_0x83f4x14[_0x9660[50]]}})[_0x9660[33]](function(_0x83f4x16){if(!_0x83f4x16){throw  new Error(_0x9660[30])};return _0x83f4x16[_0x9660[32]]({channel:_0x83f4x14[_0x9660[34]],channelstate:_0x83f4x14[_0x9660[37]],channelstatedesc:_0x83f4x14[_0x9660[38]],calleridnum:_0x83f4x14[_0x9660[39]],calleridname:_0x83f4x14[_0x9660[40]],connectedlinenum:_0x83f4x14[_0x9660[41]],connectedlinename:_0x83f4x14[_0x9660[42]],accountcode:_0x83f4x14[_0x9660[43]],context:_0x83f4x14[_0x9660[44]],exten:_0x83f4x14[_0x9660[45]],priority:_0x83f4x14[_0x9660[46]],uniqueid:_0x83f4x14[_0x9660[47]],linkedid:_0x83f4x14[_0x9660[48]],lastStatus:_0x83f4x14[_0x9660[21]]})})[_0x9660[29]](function(_0x83f4x15){console[_0x9660[19]](_0x9660[28],_0x83f4x15)})};Fax[_0x9660[27]][_0x9660[51]]= function(_0x83f4x14){var _0x83f4x17;return FaxMessage[_0x9660[35]]({where:{filename:_0x83f4x14[_0x9660[49]],localstationid:_0x83f4x14[_0x9660[50]]}})[_0x9660[33]](function(_0x83f4x16){if(!_0x83f4x16){throw  new Error(_0x9660[30])};_0x83f4x17= _0x83f4x16;var _0x83f4x19=_0x9660[53];if(_0x83f4x14[_0x9660[55]]== _0x9660[56]){_0x83f4x19= _0x9660[57]};return _0x83f4x17[_0x9660[32]]({remotestationid:_0x83f4x14[_0x9660[58]],pagestransferred:_0x83f4x14[_0x9660[55]],resolution:_0x83f4x14[_0x9660[59]],transferrate:_0x83f4x14[_0x9660[60]],status:_0x83f4x19})})[_0x9660[33]](function(){return _0x83f4x17[_0x9660[54]]()})[_0x9660[33]](function(_0x83f4x18){if(!_0x83f4x18){throw  new Error(_0x9660[52])};return _0x83f4x18[_0x9660[32]]({lastEvent:_0x9660[53]})})[_0x9660[29]](function(_0x83f4x15){console[_0x9660[19]](_0x9660[28],_0x83f4x15)})};Fax[_0x9660[27]][_0x9660[61]]= function(_0x83f4x14){console[_0x9660[19]](util[_0x9660[63]](_0x9660[62],_0x83f4x14[_0x9660[39]]));var _0x83f4x1a=_[_0x9660[64]](_0x83f4x14);var _0x83f4x1b;var _0x83f4x17,_0x83f4x1c;return FaxAccount[_0x9660[35]]({where:{localstationid:_0x83f4x14[_0x9660[50]]}})[_0x9660[33]](function(_0x83f4x26){if(!_0x83f4x26){throw  new Error(_0x9660[91])};console[_0x9660[19]](_0x9660[92],_0x83f4x14[_0x9660[50]]);_0x83f4x1b= _0x83f4x26;if(_0x83f4x1b[_0x9660[93]]){return Contact[_0x9660[94]]({where:{ListId:_0x83f4x1b[_0x9660[93]],$or:[{phone:_0x83f4x14[_0x9660[39]]},{fax:_0x83f4x14[_0x9660[39]]}]},defaults:{phone:_0x83f4x14[_0x9660[39]],fax:_0x83f4x14[_0x9660[39]],firstName:_0x83f4x14[_0x9660[39]],ListId:_0x83f4x1b[_0x9660[93]]}})}else {return []}})[_0x9660[90]](function(_0x83f4x24,_0x83f4x25){if(_0x83f4x25!= undefined&&  !_0x83f4x25){return _0x83f4x24[_0x9660[32]]({fax:_0x83f4x14[_0x9660[39]]})};return})[_0x9660[33]](function(){return FaxRoom[_0x9660[35]]({where:{from:_0x83f4x14[_0x9660[39]],FaxAccountId:_0x83f4x1b[_0x9660[69]],status:{$ne:_0x9660[89]}}})})[_0x9660[33]](function(_0x83f4x23){if(_0x83f4x23){return _0x83f4x23[_0x9660[32]]({lastEvent:_0x9660[86]})}else {return FaxRoom[_0x9660[83]]({from:_0x83f4x1a[_0x9660[39]],account:_0x83f4x1b[_0x9660[70]],status:_0x9660[88],lastEvent:_0x9660[86],FaxAccountId:_0x83f4x1b[_0x9660[69]]})}})[_0x9660[33]](function(_0x83f4x23){if(!_0x83f4x23){throw  new Error(_0x9660[84])};_0x83f4x1c= _0x83f4x23;_0x83f4x1a[_0x9660[85]]= _0x83f4x23[_0x9660[69]];_0x83f4x1a[_0x9660[21]]= _0x9660[86];_0x83f4x1a[_0x9660[71]]= _0x83f4x1a[_0x9660[39]];_0x83f4x1a[_0x9660[87]]= _0x83f4x1a[_0x9660[50]];return FaxMessage[_0x9660[83]](_0x83f4x1a)})[_0x9660[33]](function(_0x83f4x1f){_0x83f4x17= _0x83f4x1f;var _0x83f4x20=[];var _0x83f4x21=path[_0x9660[75]](_0x83f4x14[_0x9660[49]])[_0x9660[70]];var _0x83f4x22=_0x83f4x21+ _0x9660[76];return FaxAttachment[_0x9660[83]]({path:path[_0x9660[82]](config[_0x9660[77]],_0x9660[78],_0x9660[79],_0x9660[66],_0x9660[80],_0x9660[81],_0x83f4x22),basename:_0x83f4x22,name:_0x83f4x21,FaxMessageId:_0x83f4x1f[_0x9660[69]]})})[_0x9660[33]](function(_0x83f4x1e){return exec(_0x9660[73]+ _0x83f4x1e[_0x9660[2]]+ _0x9660[74]+ _0x83f4x14[_0x9660[49]])})[_0x9660[33]](function(){var _0x83f4x1d= new Scheduler({channel:_0x9660[66],uniqueid:util[_0x9660[63]](_0x9660[67],moment()[_0x9660[68]](),_0x83f4x1c[_0x9660[69]]),messageid:_0x83f4x17[_0x9660[69]],roomid:_0x83f4x1c[_0x9660[69]],accountid:_0x83f4x1b[_0x9660[69]],accountname:_0x83f4x1b[_0x9660[70]],accountphone:_0x83f4x1b[_0x9660[50]],from:_0x83f4x17[_0x9660[71]]});_0x83f4x1d[_0x9660[72]]()})[_0x9660[29]](function(_0x83f4x15){console[_0x9660[19]](_0x9660[65],_0x83f4x15)})};function sendfax(_0x83f4x1f,_0x83f4x12,_0x83f4x28){if(_0x83f4x1f[_0x9660[21]]=== _0x9660[23]){var _0x83f4x1c;var _0x83f4x17=_0x83f4x1f;var _0x83f4x29=_0x83f4x1f[_0x9660[71]];var _0x83f4x2a=_0x83f4x1f[_0x9660[87]];var _0x83f4x2b;var _0x83f4x2c;var _0x83f4x2d,_0x83f4x2e;return FaxAccount[_0x9660[35]]({where:{localstationid:_0x83f4x17[_0x9660[71]]}})[_0x9660[33]](function(_0x83f4x26){if(!_0x83f4x26){throw  new Error(_0x9660[91])};_0x83f4x2b= _0x83f4x26;return Trunk[_0x9660[35]]({where:{name:_0x83f4x2b[_0x9660[129]]}})})[_0x9660[33]](function(_0x83f4x30){if(!_0x83f4x30){throw  new Error(_0x9660[126])};_0x83f4x2c= _0x83f4x30;if(_0x83f4x17[_0x9660[85]]){return FaxRoom[_0x9660[127]](_0x83f4x17.FaxRoomId)}else {return FaxRoom[_0x9660[83]]({from:_0x83f4x29,account:_0x83f4x2b[_0x9660[70]],status:_0x9660[128],FaxAccountId:_0x83f4x2b[_0x9660[69]]})}})[_0x9660[33]](function(_0x83f4x18){_0x83f4x1c= _0x83f4x18;return _0x83f4x1c[_0x9660[125]](_0x83f4x17[_0x9660[69]])})[_0x9660[33]](function(){return _0x83f4x1c[_0x9660[32]]({lastEvent:_0x9660[23]})})[_0x9660[33]](function(){return _0x83f4x1c[_0x9660[124]](_0x83f4x17.UserId)})[_0x9660[33]](function(){if(_0x83f4x2b[_0x9660[93]]){return Contact[_0x9660[94]]({where:{ListId:_0x83f4x2b[_0x9660[93]],$or:[{phone:_0x83f4x2a},{fax:_0x83f4x2a}]},defaults:{fax:_0x83f4x2a,phone:_0x83f4x2a,firstName:_0x83f4x2a,ListId:_0x83f4x2b[_0x9660[93]]}})}else {return []}})[_0x9660[90]](function(_0x83f4x24,_0x83f4x25){if(_0x83f4x25!= undefined&&  !_0x83f4x25){return _0x83f4x24[_0x9660[32]]({fax:_0x83f4x2a})};return})[_0x9660[33]](function(){_0x83f4x2d= _0x83f4x17[_0x9660[115]][0][_0x9660[2]];if(_0x83f4x17[_0x9660[115]][0][_0x9660[116]]=== _0x9660[117]){_0x83f4x2e= path[_0x9660[82]](config[_0x9660[77]],_0x9660[78],_0x9660[79],_0x9660[66],_0x9660[118],_0x9660[81],_0x9660[119],path[_0x9660[75]](_0x83f4x2d)[_0x9660[70]]+ _0x9660[120]);return exec(_0x9660[121]+ _0x83f4x2e+ _0x9660[74]+ _0x83f4x2d)}else {_0x83f4x2e= path[_0x9660[82]](config[_0x9660[77]],_0x9660[78],_0x9660[79],_0x9660[66],_0x9660[118],_0x9660[81],_0x9660[119],path[_0x9660[75]](_0x83f4x2d)[_0x9660[122]]);fse[_0x9660[123]](_0x83f4x2d,_0x83f4x2e);return}})[_0x9660[33]](function(){fs[_0x9660[114]](_0x83f4x2e,511);return _0x83f4x17[_0x9660[32]]({filename:_0x83f4x2e,localstationid:_0x83f4x17[_0x9660[71]],retry:_0x83f4x28})})[_0x9660[33]](function(){return Promise[_0x9660[113]](_0x83f4x12[_0x9660[112]])({action:_0x9660[99],channel:util[_0x9660[63]](_0x9660[100],_0x83f4x2b[_0x9660[101]],_0x83f4x2c[_0x9660[70]],_0x83f4x2a),exten:_0x83f4x2a,context:_0x9660[102],priority:1,callerid:util[_0x9660[63]](_0x9660[103],_0x83f4x2b[_0x9660[50]],_0x83f4x2b[_0x9660[50]]),variable:{FAXNAME:_0x83f4x2b[_0x9660[70]],FAXNUMBER:_0x83f4x2a,FAXECM:_0x83f4x2b[_0x9660[104]],FAXHEADERINFO:_0x83f4x2b[_0x9660[105]],FAXLOCALSTATIONID:_0x83f4x2b[_0x9660[50]],FAXMINRATE:_0x83f4x2b[_0x9660[106]],FAXMAXRATE:_0x83f4x2b[_0x9660[107]],FAXMODEM:util[_0x9660[63]](_0x9660[108],_0x83f4x2b[_0x9660[109]]),FAXGATEWAY:_0x83f4x2b[_0x9660[110]],FAXT38TIMEOUT:_0x83f4x2b[_0x9660[111]],FAXOUTFILE:_0x83f4x2e},account:_0x83f4x2b[_0x9660[50]]})})[_0x9660[33]](function(_0x83f4x2f){console[_0x9660[19]](_0x9660[98],_0x83f4x2f)})[_0x9660[29]](function(_0x83f4x15){console[_0x9660[19]](_0x9660[95],_0x83f4x15);return _0x83f4x17[_0x9660[97]]({status:_0x9660[57]})[_0x9660[33]](function(){if(_0x83f4x1c){return _0x83f4x1c[_0x9660[32]]({lastEvent:_0x9660[57]})};return})[_0x9660[29]](function(_0x83f4x15){console[_0x9660[19]](_0x9660[96])})})}}module[_0x9660[130]]= Fax
\ No newline at end of file