Built motion from commit fd18f58.|0.0.129
[motion.git] / server / config / ami / fax.js
1 var _0x9192=["\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","\x55\x73\x65\x72","\x43\x6F\x6E\x74\x61\x63\x74","\x52\x65\x70\x6F\x72\x74\x46\x61\x78","\x2E\x2E\x2F\x75\x74\x69\x6C","\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","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x4F\x50\x45\x4E","\x73\x79\x73\x74\x65\x6D","\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","\x66\x69\x6E\x64\x42\x79\x49\x64","\x61\x64\x64\x55\x73\x65\x72","\x50\x45\x4E\x44\x49\x4E\x47","\x75\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","\x54\x72\x75\x6E\x6B\x4E\x61\x6D\x65","\x72\x65\x71\x75\x65\x73\x74\x20\x66\x61\x69\x6C\x65\x64\x21","\x72\x65\x71\x75\x65\x73\x74\x20\x73\x75\x63\x63\x65\x73\x73\x65\x66\x75\x6C\x21","\x73\x65\x6E\x64\x52\x65\x71\x75\x65\x73\x74","\x63\x6F\x6E\x6E\x65\x63\x74\x69\x64","\x65\x72\x72","\x61\x63\x63\x65\x70\x74\x4D\x65\x74\x68\x6F\x64","\x61\x63\x63\x65\x70\x74\x55\x72\x6C","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x46\x61\x78\x20\x41\x63\x63\x6F\x75\x6E\x74\x3A\x20","\x20\x48\x54\x54\x50\x20\x4D\x65\x74\x68\x6F\x64\x20\x6F\x72\x20\x55\x52\x4C\x20\x69\x73\x20\x6E\x6F\x74\x20\x63\x6F\x6E\x66\x69\x67\x75\x72\x65\x64","\x6C\x65\x6E\x67\x74\x68","\x61\x63\x74\x69\x6F\x6E\x73","\x65\x6E\x61\x62\x6C\x65\x64","\x65\x78\x65\x63\x41\x63\x74\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x61\x63\x63\x6F\x75\x6E\x74\x69\x64","\x72\x65\x6A\x65\x63\x74\x65\x64\x41\x74","\x72\x65\x6A\x65\x63\x74\x4D\x65\x74\x68\x6F\x64","\x72\x65\x6A\x65\x63\x74\x55\x72\x6C","\x65\x78\x70\x6F\x72\x74\x73"];var fs=require(_0x9192[0]);var util=require(_0x9192[1]);var path=require(_0x9192[2]);var config=require(_0x9192[3]);var _=require(_0x9192[4]);var Promise=require(_0x9192[5]);var exec=require(_0x9192[7])[_0x9192[6]];var fse=require(_0x9192[8]);var moment=require(_0x9192[9]);var FaxAccount=require(_0x9192[11])[_0x9192[10]];var FaxRoom=require(_0x9192[11])[_0x9192[12]];var FaxMessage=require(_0x9192[11])[_0x9192[13]];var FaxAttachment=require(_0x9192[11])[_0x9192[14]];var Trunk=require(_0x9192[11])[_0x9192[15]];var User=require(_0x9192[11])[_0x9192[16]];var Contact=require(_0x9192[11])[_0x9192[17]];var ReportFax=require(_0x9192[11])[_0x9192[18]];var Util=require(_0x9192[19]);var Scheduler=require(_0x9192[20]);function Fax(_0x6f96x15){console[_0x9192[22]](_0x9192[21]);FaxMessage[_0x9192[23]](function(_0x6f96x16,_0x6f96x17){sendfax(_0x6f96x16,_0x6f96x15,0,_0x6f96x17)});FaxMessage[_0x9192[28]](function(_0x6f96x16){if(_0x6f96x16[_0x9192[25]](_0x9192[24])&& _0x6f96x16[_0x9192[24]]=== _0x9192[26]){sendfax(_0x6f96x16,_0x6f96x15,_0x6f96x16[_0x9192[27]]+ 1)}});ReportFax[_0x9192[28]](function(_0x6f96x16){onReportUpdate(_0x6f96x16)})}Fax[_0x9192[30]][_0x9192[29]]= function(_0x6f96x18){return FaxMessage[_0x9192[38]]({where:{channel:_0x6f96x18[_0x9192[37]]}})[_0x9192[36]](function(_0x6f96x1a){if(!_0x6f96x1a){throw  new Error(_0x9192[33])};return _0x6f96x1a[_0x9192[35]]({error:_0x6f96x18[_0x9192[34]]})})[_0x9192[32]](function(_0x6f96x19){console[_0x9192[22]](_0x9192[31],_0x6f96x19)})};Fax[_0x9192[30]][_0x9192[39]]= function(_0x6f96x18){return FaxMessage[_0x9192[38]]({where:{filename:_0x6f96x18[_0x9192[52]],localstationid:_0x6f96x18[_0x9192[53]]}})[_0x9192[36]](function(_0x6f96x1a){if(!_0x6f96x1a){throw  new Error(_0x9192[33])};return _0x6f96x1a[_0x9192[35]]({channel:_0x6f96x18[_0x9192[37]],channelstate:_0x6f96x18[_0x9192[40]],channelstatedesc:_0x6f96x18[_0x9192[41]],calleridnum:_0x6f96x18[_0x9192[42]],calleridname:_0x6f96x18[_0x9192[43]],connectedlinenum:_0x6f96x18[_0x9192[44]],connectedlinename:_0x6f96x18[_0x9192[45]],accountcode:_0x6f96x18[_0x9192[46]],context:_0x6f96x18[_0x9192[47]],exten:_0x6f96x18[_0x9192[48]],priority:_0x6f96x18[_0x9192[49]],uniqueid:_0x6f96x18[_0x9192[50]],linkedid:_0x6f96x18[_0x9192[51]],lastStatus:_0x6f96x18[_0x9192[24]]})})[_0x9192[32]](function(_0x6f96x19){console[_0x9192[22]](_0x9192[31],_0x6f96x19)})};Fax[_0x9192[30]][_0x9192[54]]= function(_0x6f96x18){var _0x6f96x1b;return FaxMessage[_0x9192[38]]({where:{filename:_0x6f96x18[_0x9192[52]],localstationid:_0x6f96x18[_0x9192[53]]}})[_0x9192[36]](function(_0x6f96x1a){if(!_0x6f96x1a){throw  new Error(_0x9192[33])};_0x6f96x1b= _0x6f96x1a;var _0x6f96x1d=_0x9192[56];if(_0x6f96x18[_0x9192[58]]== _0x9192[59]){_0x6f96x1d= _0x9192[60]};return _0x6f96x1b[_0x9192[35]]({remotestationid:_0x6f96x18[_0x9192[61]],pagestransferred:_0x6f96x18[_0x9192[58]],resolution:_0x6f96x18[_0x9192[62]],transferrate:_0x6f96x18[_0x9192[63]],status:_0x6f96x1d})})[_0x9192[36]](function(){return _0x6f96x1b[_0x9192[57]]()})[_0x9192[36]](function(_0x6f96x1c){if(!_0x6f96x1c){throw  new Error(_0x9192[55])};return _0x6f96x1c[_0x9192[35]]({lastEvent:_0x9192[56]},{individualHooks:true})})[_0x9192[32]](function(_0x6f96x19){console[_0x9192[22]](_0x9192[31],_0x6f96x19)})};Fax[_0x9192[30]][_0x9192[64]]= function(_0x6f96x18){console[_0x9192[22]](util[_0x9192[66]](_0x9192[65],_0x6f96x18[_0x9192[42]]));var _0x6f96x1e=_[_0x9192[67]](_0x6f96x18);var _0x6f96x1f;var _0x6f96x1b,_0x6f96x20;return FaxAccount[_0x9192[38]]({where:{localstationid:_0x6f96x18[_0x9192[53]]}})[_0x9192[36]](function(_0x6f96x2a){if(!_0x6f96x2a){throw  new Error(_0x9192[97])};console[_0x9192[22]](_0x9192[98],_0x6f96x18[_0x9192[53]]);_0x6f96x1f= _0x6f96x2a;if(_0x6f96x1f[_0x9192[99]]){return Contact[_0x9192[100]]({where:{ListId:_0x6f96x1f[_0x9192[99]],$or:[{phone:_0x6f96x18[_0x9192[42]]},{fax:_0x6f96x18[_0x9192[42]]}]},defaults:{phone:_0x6f96x18[_0x9192[42]],fax:_0x6f96x18[_0x9192[42]],firstName:_0x6f96x18[_0x9192[42]],ListId:_0x6f96x1f[_0x9192[99]]}})}else {return []}})[_0x9192[96]](function(_0x6f96x28,_0x6f96x29){if(_0x6f96x29!= undefined&&  !_0x6f96x29){return _0x6f96x28[_0x9192[35]]({fax:_0x6f96x18[_0x9192[42]]})};return})[_0x9192[36]](function(){return FaxRoom[_0x9192[38]]({where:{from:_0x6f96x18[_0x9192[42]],FaxAccountId:_0x6f96x1f[_0x9192[72]],status:{$ne:_0x9192[95]}}})})[_0x9192[36]](function(_0x6f96x27){if(_0x6f96x27){return _0x6f96x27[_0x9192[35]]({lastEvent:_0x9192[89],lastEventAt:moment()[_0x9192[66]](_0x9192[91]),status:_0x9192[92],openReason:_0x9192[93]})}else {return FaxRoom[_0x9192[86]]({from:_0x6f96x1e[_0x9192[42]],account:_0x6f96x1f[_0x9192[73]],status:_0x9192[94],lastEvent:_0x9192[89],lastEventAt:moment()[_0x9192[66]](_0x9192[91]),FaxAccountId:_0x6f96x1f[_0x9192[72]]})}})[_0x9192[36]](function(_0x6f96x27){if(!_0x6f96x27){throw  new Error(_0x9192[87])};_0x6f96x20= _0x6f96x27;_0x6f96x1e[_0x9192[88]]= _0x6f96x27[_0x9192[72]];_0x6f96x1e[_0x9192[24]]= _0x9192[89];_0x6f96x1e[_0x9192[74]]= _0x6f96x1e[_0x9192[42]];_0x6f96x1e[_0x9192[90]]= _0x6f96x1e[_0x9192[53]];return FaxMessage[_0x9192[86]](_0x6f96x1e)})[_0x9192[36]](function(_0x6f96x23){_0x6f96x1b= _0x6f96x23;var _0x6f96x24=[];var _0x6f96x25=path[_0x9192[78]](_0x6f96x18[_0x9192[52]])[_0x9192[73]];var _0x6f96x26=_0x6f96x25+ _0x9192[79];return FaxAttachment[_0x9192[86]]({path:path[_0x9192[85]](config[_0x9192[80]],_0x9192[81],_0x9192[82],_0x9192[69],_0x9192[83],_0x9192[84],_0x6f96x26),basename:_0x6f96x26,name:_0x6f96x25,FaxMessageId:_0x6f96x23[_0x9192[72]]})})[_0x9192[36]](function(_0x6f96x22){return exec(_0x9192[76]+ _0x6f96x22[_0x9192[2]]+ _0x9192[77]+ _0x6f96x18[_0x9192[52]])})[_0x9192[36]](function(){var _0x6f96x21= new Scheduler({channel:_0x9192[69],uniqueid:util[_0x9192[66]](_0x9192[70],moment()[_0x9192[71]](),_0x6f96x20[_0x9192[72]]),messageid:_0x6f96x1b[_0x9192[72]],roomid:_0x6f96x20[_0x9192[72]],accountid:_0x6f96x1f[_0x9192[72]],accountname:_0x6f96x1f[_0x9192[73]],accountphone:_0x6f96x1f[_0x9192[53]],from:_0x6f96x1b[_0x9192[74]]});_0x6f96x21[_0x9192[75]]()})[_0x9192[32]](function(_0x6f96x19){console[_0x9192[22]](_0x9192[68],_0x6f96x19)})};function sendfax(_0x6f96x23,_0x6f96x15,_0x6f96x2c,_0x6f96x17){if(_0x6f96x23[_0x9192[24]]=== _0x9192[26]){var _0x6f96x20;var _0x6f96x1b=_0x6f96x23;var _0x6f96x2d=_0x6f96x23[_0x9192[74]];var _0x6f96x2e=_0x6f96x23[_0x9192[90]];var _0x6f96x2f;var _0x6f96x30;var _0x6f96x31,_0x6f96x32;return FaxAccount[_0x9192[38]]({where:{localstationid:_0x6f96x1b[_0x9192[74]]}})[_0x9192[36]](function(_0x6f96x2a){if(!_0x6f96x2a){throw  new Error(_0x9192[97])};_0x6f96x2f= _0x6f96x2a;return Trunk[_0x9192[38]]({where:{name:_0x6f96x2f[_0x9192[136]]}})})[_0x9192[36]](function(_0x6f96x34){if(!_0x6f96x34){throw  new Error(_0x9192[135])};_0x6f96x30= _0x6f96x34;if(_0x6f96x1b[_0x9192[88]]){return FaxRoom[_0x9192[130]](_0x6f96x1b.FaxRoomId)}else {return FaxRoom[_0x9192[86]]({from:_0x6f96x2d,account:_0x6f96x2f[_0x9192[73]],status:_0x9192[132],FaxAccountId:_0x6f96x2f[_0x9192[72]]})}})[_0x9192[36]](function(_0x6f96x1c){_0x6f96x20= _0x6f96x1c;return _0x6f96x20[_0x9192[134]](_0x6f96x1b[_0x9192[72]])})[_0x9192[36]](function(){return _0x6f96x20[_0x9192[35]]({status:_0x9192[132],lastEvent:_0x9192[26],lastEventAt:moment()[_0x9192[66]](_0x9192[91])},{individualHooks:true,user:_0x6f96x17[_0x9192[133]]})})[_0x9192[36]](function(){return _0x6f96x20[_0x9192[131]](_0x6f96x1b.UserId)})[_0x9192[36]](function(){return User[_0x9192[130]](_0x6f96x1b.UserId)})[_0x9192[36]](function(){if(_0x6f96x2f[_0x9192[99]]){return Contact[_0x9192[100]]({where:{ListId:_0x6f96x2f[_0x9192[99]],$or:[{phone:_0x6f96x2e},{fax:_0x6f96x2e}]},defaults:{fax:_0x6f96x2e,phone:_0x6f96x2e,firstName:_0x6f96x2e,ListId:_0x6f96x2f[_0x9192[99]]}})}else {return []}})[_0x9192[96]](function(_0x6f96x28,_0x6f96x29){if(_0x6f96x29!= undefined&&  !_0x6f96x29){return _0x6f96x28[_0x9192[35]]({fax:_0x6f96x2e})};return})[_0x9192[36]](function(){_0x6f96x31= _0x6f96x1b[_0x9192[121]][0][_0x9192[2]];if(_0x6f96x1b[_0x9192[121]][0][_0x9192[122]]=== _0x9192[123]){_0x6f96x32= path[_0x9192[85]](config[_0x9192[80]],_0x9192[81],_0x9192[82],_0x9192[69],_0x9192[124],_0x9192[84],_0x9192[125],path[_0x9192[78]](_0x6f96x31)[_0x9192[73]]+ _0x9192[126]);return exec(_0x9192[127]+ _0x6f96x32+ _0x9192[77]+ _0x6f96x31)}else {_0x6f96x32= path[_0x9192[85]](config[_0x9192[80]],_0x9192[81],_0x9192[82],_0x9192[69],_0x9192[124],_0x9192[84],_0x9192[125],path[_0x9192[78]](_0x6f96x31)[_0x9192[128]]);fse[_0x9192[129]](_0x6f96x31,_0x6f96x32);return}})[_0x9192[36]](function(){fs[_0x9192[120]](_0x6f96x32,511);return _0x6f96x1b[_0x9192[35]]({filename:_0x6f96x32,localstationid:_0x6f96x1b[_0x9192[74]],retry:_0x6f96x2c})})[_0x9192[36]](function(){return Promise[_0x9192[119]](_0x6f96x15[_0x9192[118]])({action:_0x9192[105],channel:util[_0x9192[66]](_0x9192[106],_0x6f96x2f[_0x9192[107]],_0x6f96x30[_0x9192[73]],_0x6f96x2e),exten:_0x6f96x2e,context:_0x9192[108],priority:1,callerid:util[_0x9192[66]](_0x9192[109],_0x6f96x2f[_0x9192[53]],_0x6f96x2f[_0x9192[53]]),variable:{FAXNAME:_0x6f96x2f[_0x9192[73]],FAXNUMBER:_0x6f96x2e,FAXECM:_0x6f96x2f[_0x9192[110]],FAXHEADERINFO:_0x6f96x2f[_0x9192[111]],FAXLOCALSTATIONID:_0x6f96x2f[_0x9192[53]],FAXMINRATE:_0x6f96x2f[_0x9192[112]],FAXMAXRATE:_0x6f96x2f[_0x9192[113]],FAXMODEM:util[_0x9192[66]](_0x9192[114],_0x6f96x2f[_0x9192[115]]),FAXGATEWAY:_0x6f96x2f[_0x9192[116]],FAXT38TIMEOUT:_0x6f96x2f[_0x9192[117]],FAXOUTFILE:_0x6f96x32},account:_0x6f96x2f[_0x9192[53]]})})[_0x9192[36]](function(_0x6f96x33){console[_0x9192[22]](_0x9192[104],_0x6f96x33)})[_0x9192[32]](function(_0x6f96x19){console[_0x9192[22]](_0x9192[101],_0x6f96x19);return _0x6f96x1b[_0x9192[103]]({status:_0x9192[60]})[_0x9192[36]](function(){if(_0x6f96x20){return _0x6f96x20[_0x9192[35]]({lastEvent:_0x9192[60]})};return})[_0x9192[32]](function(_0x6f96x19){console[_0x9192[22]](_0x9192[102])})})}}function execRequest(_0x6f96x16,_0x6f96x36,_0x6f96x37){Util[_0x9192[139]](_0x6f96x16,_0x6f96x36,_0x6f96x37)[_0x9192[36]](function(_0x6f96x38){console[_0x9192[22]](_0x9192[138])})[_0x9192[32]](function(_0x6f96x19){console[_0x9192[22]](_0x9192[137])})}function onReportUpdate(_0x6f96x16){var _0x6f96x1f;if(_0x6f96x16[_0x9192[25]](_0x9192[140])){return FaxAccount[_0x9192[130]](parseInt(_0x6f96x16[_0x9192[152]]))[_0x9192[36]](function(_0x6f96x2a){if(!_0x6f96x2a){throw  new Error(_0x9192[97])};_0x6f96x1f= _0x6f96x2a;if(_0x6f96x1f[_0x9192[142]]&& _0x6f96x1f[_0x9192[143]]){execRequest(_0x6f96x16[_0x9192[144]],_0x6f96x1f[_0x9192[142]],_0x6f96x1f[_0x9192[143]])}else {console[_0x9192[22]](_0x9192[145]+ _0x6f96x1f[_0x9192[73]]+ _0x9192[146])};if(_0x6f96x1f[_0x9192[148]][_0x9192[147]]){_[_0x9192[151]](_0x6f96x1f[_0x9192[148]],function(_0x6f96x3a){if(_0x6f96x3a[_0x9192[149]]){Util[_0x9192[150]](_0x6f96x3a,_0x6f96x16)}})}})[_0x9192[32]](function(_0x6f96x19){console[_0x9192[22]](_0x9192[141],_0x6f96x19)})};if(_0x6f96x16[_0x9192[25]](_0x9192[153])){return FaxAccount[_0x9192[130]](_0x6f96x16[_0x9192[152]])[_0x9192[36]](function(_0x6f96x2a){if(!_0x6f96x2a){throw  new Error(_0x9192[97])};_0x6f96x1f= _0x6f96x2a;if(_0x6f96x1f[_0x9192[154]]&& _0x6f96x1f[_0x9192[155]]){execRequest(_0x6f96x16[_0x9192[144]],_0x6f96x1f[_0x9192[154]],_0x6f96x1f[_0x9192[155]])}})[_0x9192[32]](function(_0x6f96x19){console[_0x9192[22]](_0x9192[141],_0x6f96x19)})}}module[_0x9192[156]]= Fax