Built motion from commit 76eb00b9e.|1.0.24
[motion.git] / server / config / ami / db / fax.js
index 723c1c6..b8fabb6 100644 (file)
@@ -1 +1 @@
-var _0x1e13=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x6F\x6D\x65\x6E\x74","\x75\x74\x69\x6C","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\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\x4D\x65\x73\x73\x61\x67\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x61\x78\x52\x6F\x6F\x6D","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x46\x61\x78\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x43\x6F\x6E\x74\x61\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x5B\x46\x61\x78\x5D\x20\x4E\x65\x77\x20\x6D\x65\x73\x73\x61\x67\x65\x20\x66\x72\x6F\x6D\x20\x25\x73","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x66\x6F\x72\x6D\x61\x74","\x6C\x6F\x67","\x63\x6C\x6F\x6E\x65","\x5B\x46\x61\x78\x5D\x20\x45\x72\x72\x6F\x72\x20\x72\x65\x63\x65\x69\x76\x69\x6E\x67\x20\x6D\x65\x73\x73\x61\x67\x65\x3A","\x65\x72\x72\x6F\x72","\x5B\x46\x61\x78\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x3A","\x6D\x65\x73\x73\x61\x67\x65","\x5B\x46\x61\x78\x5D\x20\x53\x74\x61\x63\x6B\x3A","\x73\x74\x61\x63\x6B","\x63\x61\x74\x63\x68","\x70\x61\x67\x65\x73\x74\x72\x61\x6E\x73\x66\x65\x72\x72\x65\x64","\x5B\x46\x61\x78\x5D\x20\x46\x69\x6C\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x6C\x79\x20\x63\x6F\x6E\x76\x65\x72\x74\x65\x64","\x69\x6E\x69\x74\x46\x61\x78\x52\x6F\x75\x74\x69\x6E\x67","\x73\x65\x6E\x64","\x74\x68\x65\x6E","\x5B\x46\x61\x78\x5D\x20\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x20\x6E\x6F\x74\x20\x63\x72\x65\x61\x74\x65\x64","\x5B\x46\x61\x78\x5D\x20\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x3A","\x69\x64","\x74\x69\x66\x66\x32\x70\x64\x66\x20\x2D\x6F\x20","\x20","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x5B\x46\x61\x78\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x20\x6E\x6F\x74\x20\x63\x72\x65\x61\x74\x65\x64","\x6E\x61\x6D\x65","\x70\x61\x72\x73\x65","\x2E\x70\x64\x66","\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","\x6A\x6F\x69\x6E","\x63\x72\x65\x61\x74\x65","\x5B\x46\x61\x78\x5D\x20\x54\x72\x61\x6E\x73\x66\x65\x72\x72\x65\x64\x20\x66\x69\x6C\x65\x20\x69\x73\x20\x65\x6D\x70\x74\x79\x20\x28\x70\x61\x67\x65\x73\x74\x72\x61\x6E\x73\x66\x65\x72\x72\x65\x64\x3A\x25\x73\x29","\x5B\x46\x61\x78\x5D\x20\x52\x6F\x6F\x6D\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x2F\x63\x72\x65\x61\x74\x65\x64","\x5B\x46\x61\x78\x5D\x20\x52\x6F\x6F\x6D\x3A","\x46\x61\x78\x52\x6F\x6F\x6D\x49\x64","\x73\x74\x61\x74\x75\x73","\x52\x45\x43\x45\x49\x56\x45\x44","\x66\x72\x6F\x6D","\x74\x6F","\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64","","\x54\x72\x61\x6E\x73\x66\x65\x72\x72\x65\x64\x20\x66\x69\x6C\x65\x20\x69\x73\x20\x65\x6D\x70\x74\x79","\x6C\x65\x6E\x67\x74\x68","\x66\x69\x72\x73\x74","\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","\x66\x61\x78\x49\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x4E\x45\x57","\x43\x4C\x4F\x53\x45\x44","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x44\x45\x53\x43","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x70\x72\x65\x61\x64","\x5B\x46\x61\x78\x5D\x20\x41\x63\x63\x6F\x75\x6E\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x5B\x46\x61\x78\x5D\x20\x41\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","\x66\x69\x6E\x64\x4F\x6E\x65","\x5B\x46\x61\x78\x5D\x20\x45\x72\x72\x6F\x72\x20\x75\x70\x64\x61\x74\x69\x6E\x67\x20\x73\x65\x6E\x64\x69\x6E\x67\x20\x6D\x65\x73\x73\x61\x67\x65\x3A","\x5B\x46\x61\x78\x5D\x20\x52\x6F\x6F\x6D\x20\x75\x70\x64\x61\x74\x65\x20\x66\x6F\x72\x20\x53\x65\x6E\x64\x46\x61\x78\x20\x65\x76\x65\x6E\x74","\x5B\x46\x61\x78\x5D\x20\x52\x6F\x6F\x6D\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x53\x45\x4E\x54","\x5B\x46\x61\x78\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x20\x75\x70\x64\x61\x74\x65\x20\x66\x6F\x72\x20\x53\x65\x6E\x64\x46\x61\x78\x20\x65\x76\x65\x6E\x74","\x67\x65\x74\x46\x61\x78\x52\x6F\x6F\x6D","\x5B\x46\x61\x78\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\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","\x76\x61\x72\x69\x61\x62\x6C\x65","\x72\x65\x73\x6F\x6C\x76\x65","\x5B\x46\x61\x78\x5D\x20\x45\x72\x72\x6F\x72\x20\x75\x70\x64\x61\x74\x69\x6E\x67\x20\x6D\x65\x73\x73\x61\x67\x65\x3A","\x63\x68\x61\x6E\x6E\x65\x6C","\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\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\x61\x78\x65\x72\x72\x6F\x72","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x76\x61\x6C\x75\x65","\x5B\x46\x61\x78\x5D\x20\x45\x72\x72\x6F\x72\x20\x75\x70\x64\x61\x74\x69\x6E\x67\x20\x65\x72\x72\x6F\x72\x3A"];_0x1e13[0];var BPromise=require(_0x1e13[1]);var moment=require(_0x1e13[2]);var util=require(_0x1e13[3]);var _=require(_0x1e13[4]);var path=require(_0x1e13[5]);var config=require(_0x1e13[6]);var exec=require(_0x1e13[8])[_0x1e13[7]];var FaxMessage=require(_0x1e13[10])[_0x1e13[9]];var FaxRoom=require(_0x1e13[10])[_0x1e13[11]];var FaxAccount=require(_0x1e13[10])[_0x1e13[12]];var FaxAttachment=require(_0x1e13[10])[_0x1e13[13]];var Contact=require(_0x1e13[10])[_0x1e13[14]];module[_0x1e13[15]]= function(){return {receivefax:function(_0xd0d6xd){return function(_0xd0d6xe){console[_0x1e13[19]](util[_0x1e13[18]](_0x1e13[16],_0xd0d6xd[_0x1e13[17]]));var _0xd0d6xf=_[_0x1e13[20]](_0xd0d6xd);var _0xd0d6x10;var _0xd0d6x11,_0xd0d6x12;return FaxAccount[_0x1e13[79]]({where:{localstationid:_0xd0d6xd[_0x1e13[59]]}})[_0x1e13[32]](function(_0xd0d6x1b){if(!_0xd0d6x1b){throw  new Error(_0x1e13[75])};console[_0x1e13[19]](_0x1e13[76],_0xd0d6xd[_0x1e13[59]]);_0xd0d6x10= _0xd0d6x1b;if(_0xd0d6x10[_0x1e13[77]]){return Contact[_0x1e13[78]]({where:{ListId:_0xd0d6x10[_0x1e13[77]],$or:[{phone:_0xd0d6xd[_0x1e13[17]]},{fax:_0xd0d6xd[_0x1e13[17]]}]},defaults:{phone:_0xd0d6xd[_0x1e13[17]],fax:_0xd0d6xd[_0x1e13[17]],firstName:_0xd0d6xd[_0x1e13[17]],ListId:_0xd0d6x10[_0x1e13[77]]}})}else {return []}})[_0x1e13[74]](function(_0xd0d6x19,_0xd0d6x1a){if(_0xd0d6x1a!== undefined&&  !_0xd0d6x1a){return _0xd0d6x19[_0x1e13[68]]({fax:_0xd0d6xd[_0x1e13[17]]})};return})[_0x1e13[32]](function(){return FaxRoom[_0x1e13[73]]({limit:1,where:{contact:_0xd0d6xf[_0x1e13[17]],FaxAccountId:_0xd0d6x10[_0x1e13[35]],status:{$ne:_0x1e13[70]}},order:[[_0x1e13[71],_0x1e13[72]]]})})[_0x1e13[32]](function(_0xd0d6x18){if(_0xd0d6x18[_0x1e13[62]]){_0xd0d6x18= _[_0x1e13[63]](_0xd0d6x18);return _0xd0d6x18[_0x1e13[68]]({lastEvent:_0x1e13[56],lastEventAt:moment()[_0x1e13[18]](_0x1e13[64]),status:_0x1e13[65],openReason:_0x1e13[66],faxIn:++_0xd0d6x18[_0x1e13[67]]})}else {return FaxRoom[_0x1e13[50]]({contact:_0xd0d6xf[_0x1e13[17]],account:_0xd0d6x10[_0x1e13[40]],status:_0x1e13[69],lastEvent:_0x1e13[56],lastEventAt:moment()[_0x1e13[18]](_0x1e13[64]),FaxAccountId:_0xd0d6x10[_0x1e13[35]],faxIn:1})}})[_0x1e13[32]](function(_0xd0d6x18){if(!_0xd0d6x18){throw  new Error(_0x1e13[52])};console[_0x1e13[19]](_0x1e13[53],_0xd0d6x18[_0x1e13[35]]);_0xd0d6x12= _0xd0d6x18;_0xd0d6xf[_0x1e13[54]]= _0xd0d6x18[_0x1e13[35]];_0xd0d6xf[_0x1e13[55]]= _0x1e13[56];_0xd0d6xf[_0x1e13[57]]= _0xd0d6xf[_0x1e13[17]];_0xd0d6xf[_0x1e13[58]]= _0xd0d6xf[_0x1e13[59]];_0xd0d6xf[_0x1e13[22]]= parseInt(_0xd0d6xf[_0x1e13[28]])> 0?_0x1e13[60]:_0x1e13[61];return FaxMessage[_0x1e13[50]](_0xd0d6xf)})[_0x1e13[32]](function(_0xd0d6x15){if(!_0xd0d6x15){throw  new Error(_0x1e13[39])};_0xd0d6x11= _0xd0d6x15;console[_0x1e13[19]](_0x1e13[23],_0xd0d6x15[_0x1e13[35]]);if(parseInt(_0xd0d6xd[_0x1e13[28]])> 0){var _0xd0d6x16=path[_0x1e13[41]](_0xd0d6xd[_0x1e13[38]])[_0x1e13[40]];var _0xd0d6x17=_0xd0d6x16+ _0x1e13[42];return FaxAttachment[_0x1e13[50]]({path:path[_0x1e13[49]](config[_0x1e13[43]],_0x1e13[44],_0x1e13[45],_0x1e13[46],_0x1e13[47],_0x1e13[48],_0xd0d6x17),basename:_0xd0d6x17,name:_0xd0d6x16,FaxMessageId:_0xd0d6x15[_0x1e13[35]]})};console[_0x1e13[19]](util[_0x1e13[18]](_0x1e13[51],_0xd0d6xd[_0x1e13[28]]));return})[_0x1e13[32]](function(_0xd0d6x14){if(!_0xd0d6x14){console[_0x1e13[19]](_0x1e13[33]);return};console[_0x1e13[19]](_0x1e13[34],_0xd0d6x14[_0x1e13[35]]);return exec(_0x1e13[36]+ _0xd0d6x14[_0x1e13[5]]+ _0x1e13[37]+ _0xd0d6xd[_0x1e13[38]])})[_0x1e13[32]](function(){if(parseInt(_0xd0d6xd[_0x1e13[28]])> 0){console[_0x1e13[19]](_0x1e13[29]);process[_0x1e13[31]]({message:_0x1e13[30],doc:{message:_0xd0d6x11,account:_0xd0d6x10}})}})[_0x1e13[27]](function(_0xd0d6x13){console[_0x1e13[22]](_0x1e13[21],_0xd0d6x13);console[_0x1e13[22]](_0x1e13[23],_0xd0d6x13[_0x1e13[24]]);console[_0x1e13[22]](_0x1e13[25],_0xd0d6x13[_0x1e13[26]])})}},sendfax:function(_0xd0d6xd){return function(_0xd0d6xe){var _0xd0d6x11;return FaxMessage[_0x1e13[79]]({where:{filename:_0xd0d6xd[_0x1e13[38]],localstationid:_0xd0d6xd[_0x1e13[59]]}})[_0x1e13[32]](function(_0xd0d6x1d){if(!_0xd0d6x1d){throw  new Error(_0x1e13[86])};_0xd0d6x11= _0xd0d6x1d;var _0xd0d6x1e=_0x1e13[83];if(_0xd0d6xd[_0x1e13[28]]=== _0x1e13[87]){_0xd0d6x1e= _0x1e13[88]};return _0xd0d6x11[_0x1e13[68]]({remotestationid:_0xd0d6xd[_0x1e13[89]],pagestransferred:_0xd0d6xd[_0x1e13[28]],resolution:_0xd0d6xd[_0x1e13[90]],transferrate:_0xd0d6xd[_0x1e13[91]],status:_0xd0d6x1e})})[_0x1e13[32]](function(_0xd0d6x15){console[_0x1e13[19]](_0x1e13[84],_0xd0d6x15[_0x1e13[35]]);return _0xd0d6x11[_0x1e13[85]]()})[_0x1e13[32]](function(_0xd0d6x1c){if(!_0xd0d6x1c){throw  new Error(_0x1e13[82])};return _0xd0d6x1c[_0x1e13[68]]({lastEvent:_0x1e13[83]},{individualHooks:true})})[_0x1e13[32]](function(_0xd0d6x18){console[_0x1e13[19]](_0x1e13[81],_0xd0d6x18[_0x1e13[35]])})[_0x1e13[27]](function(_0xd0d6x13){console[_0x1e13[22]](_0x1e13[80],_0xd0d6x13);console[_0x1e13[22]](_0x1e13[23],_0xd0d6x13[_0x1e13[24]]);console[_0x1e13[22]](_0x1e13[25],_0xd0d6x13[_0x1e13[26]])})}},faxstatus:function(_0xd0d6xd){return function(_0xd0d6xe){if(_0xd0d6xd[_0x1e13[92]]!== _0x1e13[31]){return BPromise[_0x1e13[93]]()};return FaxMessage[_0x1e13[79]]({where:{filename:_0xd0d6xd[_0x1e13[38]],localstationid:_0xd0d6xd[_0x1e13[59]]}})[_0x1e13[32]](function(_0xd0d6x1d){if(!_0xd0d6x1d){throw  new Error(_0x1e13[86])};return _0xd0d6x1d[_0x1e13[68]]({channel:_0xd0d6xd[_0x1e13[95]],channelstate:_0xd0d6xd[_0x1e13[96]],channelstatedesc:_0xd0d6xd[_0x1e13[97]],calleridnum:_0xd0d6xd[_0x1e13[17]],calleridname:_0xd0d6xd[_0x1e13[98]],connectedlinenum:_0xd0d6xd[_0x1e13[99]],connectedlinename:_0xd0d6xd[_0x1e13[100]],accountcode:_0xd0d6xd[_0x1e13[101]],context:_0xd0d6xd[_0x1e13[102]],exten:_0xd0d6xd[_0x1e13[103]],priority:_0xd0d6xd[_0x1e13[104]],uniqueid:_0xd0d6xd[_0x1e13[105]],linkedid:_0xd0d6xd[_0x1e13[106]],lastStatus:_0xd0d6xd[_0x1e13[55]]})})[_0x1e13[27]](function(_0xd0d6x13){console[_0x1e13[22]](_0x1e13[94],_0xd0d6x13);console[_0x1e13[22]](_0x1e13[23],_0xd0d6x13[_0x1e13[24]]);console[_0x1e13[22]](_0x1e13[25],_0xd0d6x13[_0x1e13[26]])})}},faxerror:function(_0xd0d6xd){return function(_0xd0d6xe){if(!_0xd0d6xd[_0x1e13[92]][_0x1e13[108]](_0x1e13[107])||  !_0xd0d6xd[_0x1e13[109]]){return BPromise[_0x1e13[93]]()};return FaxMessage[_0x1e13[79]]({where:{channel:_0xd0d6xd[_0x1e13[95]]}})[_0x1e13[32]](function(_0xd0d6x1d){if(_0xd0d6x1d){return _0xd0d6x1d[_0x1e13[68]]({error:_0xd0d6xd[_0x1e13[109]]})};return})[_0x1e13[27]](function(_0xd0d6x13){console[_0x1e13[22]](_0x1e13[110],_0xd0d6x13)})}}}}
\ No newline at end of file
+var _0x1fd7=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x6F\x6D\x65\x6E\x74","\x75\x74\x69\x6C","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\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\x61\x78","\x2E\x2E\x2F\x2E\x2E\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\x46\x61\x78\x4D\x65\x73\x73\x61\x67\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x46\x61\x78\x52\x6F\x6F\x6D","\x46\x61\x78\x41\x63\x63\x6F\x75\x6E\x74","\x46\x61\x78\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x43\x6F\x6E\x74\x61\x63\x74","\x65\x78\x70\x6F\x72\x74\x73","\x5B\x46\x61\x78\x5D\x20\x4E\x65\x77\x20\x6D\x65\x73\x73\x61\x67\x65\x20\x66\x72\x6F\x6D\x20\x25\x73","\x63\x61\x6C\x6C\x65\x72\x69\x64\x6E\x75\x6D","\x66\x6F\x72\x6D\x61\x74","\x69\x6E\x66\x6F","\x63\x6C\x6F\x6E\x65","\x5B\x46\x61\x78\x5D\x20\x45\x72\x72\x6F\x72\x20\x72\x65\x63\x65\x69\x76\x69\x6E\x67\x20\x6D\x65\x73\x73\x61\x67\x65\x3A","\x65\x72\x72\x6F\x72","\x5B\x46\x61\x78\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x3A","\x6D\x65\x73\x73\x61\x67\x65","\x5B\x46\x61\x78\x5D\x20\x53\x74\x61\x63\x6B\x3A","\x73\x74\x61\x63\x6B","\x63\x61\x74\x63\x68","\x70\x61\x67\x65\x73\x74\x72\x61\x6E\x73\x66\x65\x72\x72\x65\x64","\x5B\x46\x61\x78\x5D\x20\x46\x69\x6C\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x6C\x79\x20\x63\x6F\x6E\x76\x65\x72\x74\x65\x64","\x64\x65\x62\x75\x67","\x5B\x46\x61\x78\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x20\x63\x6F\x72\x72\x65\x63\x74\x6C\x79\x20\x72\x65\x63\x65\x69\x76\x65\x64\x2C\x20\x69\x6E\x69\x74\x69\x61\x74\x69\x6E\x67\x20\x72\x6F\x75\x74\x69\x6E\x67\x2E\x2E\x2E","\x69\x6E\x69\x74\x46\x61\x78\x52\x6F\x75\x74\x69\x6E\x67","\x73\x65\x6E\x64","\x67\x65\x74","\x74\x68\x65\x6E","\x5B\x46\x61\x78\x5D\x20\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x20\x6E\x6F\x74\x20\x63\x72\x65\x61\x74\x65\x64","\x5B\x46\x61\x78\x5D\x20\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x3A","\x69\x64","\x74\x69\x66\x66\x32\x70\x64\x66\x20\x2D\x6F\x20","\x20","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x5B\x46\x61\x78\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x20\x6E\x6F\x74\x20\x63\x72\x65\x61\x74\x65\x64","\x6E\x61\x6D\x65","\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","\x5B\x46\x61\x78\x5D\x20\x54\x72\x61\x6E\x73\x66\x65\x72\x72\x65\x64\x20\x66\x69\x6C\x65\x20\x69\x73\x20\x65\x6D\x70\x74\x79\x20\x28\x70\x61\x67\x65\x73\x74\x72\x61\x6E\x73\x66\x65\x72\x72\x65\x64\x3A\x25\x73\x29","\x5B\x46\x61\x78\x5D\x20\x52\x6F\x6F\x6D\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64\x2F\x63\x72\x65\x61\x74\x65\x64","\x5B\x46\x61\x78\x5D\x20\x52\x6F\x6F\x6D\x3A","\x46\x61\x78\x52\x6F\x6F\x6D\x49\x64","\x73\x74\x61\x74\x75\x73","\x52\x45\x43\x45\x49\x56\x45\x44","\x66\x72\x6F\x6D","\x74\x6F","\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64","","\x54\x72\x61\x6E\x73\x66\x65\x72\x72\x65\x64\x20\x66\x69\x6C\x65\x20\x69\x73\x20\x65\x6D\x70\x74\x79","\x6C\x65\x6E\x67\x74\x68","\x66\x69\x72\x73\x74","\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","\x66\x61\x78\x49\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x4E\x45\x57","\x43\x4C\x4F\x53\x45\x44","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x44\x45\x53\x43","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x70\x72\x65\x61\x64","\x5B\x46\x61\x78\x5D\x20\x41\x63\x63\x6F\x75\x6E\x74\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x5B\x46\x61\x78\x5D\x20\x41\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","\x66\x69\x6E\x64\x4F\x6E\x65","\x5B\x46\x61\x78\x5D\x20\x45\x72\x72\x6F\x72\x20\x75\x70\x64\x61\x74\x69\x6E\x67\x20\x73\x65\x6E\x64\x69\x6E\x67\x20\x6D\x65\x73\x73\x61\x67\x65\x3A","\x5B\x46\x61\x78\x5D\x20\x52\x6F\x6F\x6D\x20\x75\x70\x64\x61\x74\x65\x20\x66\x6F\x72\x20\x53\x65\x6E\x64\x46\x61\x78\x20\x65\x76\x65\x6E\x74","\x5B\x46\x61\x78\x5D\x20\x52\x6F\x6F\x6D\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x53\x45\x4E\x54","\x5B\x46\x61\x78\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x20\x75\x70\x64\x61\x74\x65\x20\x66\x6F\x72\x20\x53\x65\x6E\x64\x46\x61\x78\x20\x65\x76\x65\x6E\x74","\x67\x65\x74\x46\x61\x78\x52\x6F\x6F\x6D","\x5B\x46\x61\x78\x5D\x20\x4D\x65\x73\x73\x61\x67\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\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","\x76\x61\x72\x69\x61\x62\x6C\x65","\x72\x65\x73\x6F\x6C\x76\x65","\x5B\x46\x61\x78\x5D\x20\x45\x72\x72\x6F\x72\x20\x75\x70\x64\x61\x74\x69\x6E\x67\x20\x6D\x65\x73\x73\x61\x67\x65\x3A","\x63\x68\x61\x6E\x6E\x65\x6C","\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\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\x61\x78\x65\x72\x72\x6F\x72","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x76\x61\x6C\x75\x65","\x5B\x46\x61\x78\x5D\x20\x45\x72\x72\x6F\x72\x20\x75\x70\x64\x61\x74\x69\x6E\x67\x20\x65\x72\x72\x6F\x72\x3A"];_0x1fd7[0];var BPromise=require(_0x1fd7[1]);var moment=require(_0x1fd7[2]);var util=require(_0x1fd7[3]);var _=require(_0x1fd7[4]);var path=require(_0x1fd7[5]);var config=require(_0x1fd7[6]);var exec=require(_0x1fd7[8])[_0x1fd7[7]];var logger=require(_0x1fd7[10])(_0x1fd7[9]);var FaxMessage=require(_0x1fd7[12])[_0x1fd7[11]];var FaxRoom=require(_0x1fd7[12])[_0x1fd7[13]];var FaxAccount=require(_0x1fd7[12])[_0x1fd7[14]];var FaxAttachment=require(_0x1fd7[12])[_0x1fd7[15]];var Contact=require(_0x1fd7[12])[_0x1fd7[16]];module[_0x1fd7[17]]= function(){return {receivefax:function(_0x4afbxe){return function(_0x4afbxf){logger[_0x1fd7[21]](util[_0x1fd7[20]](_0x1fd7[18],_0x4afbxe[_0x1fd7[19]]));var _0x4afbx10=_[_0x1fd7[22]](_0x4afbxe);var _0x4afbx11;var _0x4afbx12,_0x4afbx13;return FaxAccount[_0x1fd7[83]]({where:{localstationid:_0x4afbxe[_0x1fd7[63]]}})[_0x1fd7[37]](function(_0x4afbx1c){if(!_0x4afbx1c){throw  new Error(_0x1fd7[79])};logger[_0x1fd7[32]](_0x1fd7[80],_0x4afbxe[_0x1fd7[63]]);_0x4afbx11= _0x4afbx1c;if(_0x4afbx11[_0x1fd7[81]]){return Contact[_0x1fd7[82]]({where:{ListId:_0x4afbx11[_0x1fd7[81]],$or:[{phone:_0x4afbxe[_0x1fd7[19]]},{fax:_0x4afbxe[_0x1fd7[19]]}]},defaults:{phone:_0x4afbxe[_0x1fd7[19]],fax:_0x4afbxe[_0x1fd7[19]],firstName:_0x4afbxe[_0x1fd7[19]],ListId:_0x4afbx11[_0x1fd7[81]]}})}else {return []}})[_0x1fd7[78]](function(_0x4afbx1a,_0x4afbx1b){if(_0x4afbx1b!== undefined&&  !_0x4afbx1b){return _0x4afbx1a[_0x1fd7[72]]({fax:_0x4afbxe[_0x1fd7[19]]})};return})[_0x1fd7[37]](function(){return FaxRoom[_0x1fd7[77]]({limit:1,where:{contact:_0x4afbx10[_0x1fd7[19]],FaxAccountId:_0x4afbx11[_0x1fd7[40]],status:{$ne:_0x1fd7[74]}},order:[[_0x1fd7[75],_0x1fd7[76]]]})})[_0x1fd7[37]](function(_0x4afbx19){if(_0x4afbx19[_0x1fd7[66]]){_0x4afbx19= _[_0x1fd7[67]](_0x4afbx19);return _0x4afbx19[_0x1fd7[72]]({lastEvent:_0x1fd7[60],lastEventAt:moment()[_0x1fd7[20]](_0x1fd7[68]),status:_0x1fd7[69],openReason:_0x1fd7[70],faxIn:++_0x4afbx19[_0x1fd7[71]]})}else {return FaxRoom[_0x1fd7[54]]({contact:_0x4afbx10[_0x1fd7[19]],account:_0x4afbx11[_0x1fd7[45]],status:_0x1fd7[73],lastEvent:_0x1fd7[60],lastEventAt:moment()[_0x1fd7[20]](_0x1fd7[68]),FaxAccountId:_0x4afbx11[_0x1fd7[40]],faxIn:1})}})[_0x1fd7[37]](function(_0x4afbx19){if(!_0x4afbx19){throw  new Error(_0x1fd7[56])};logger[_0x1fd7[32]](_0x1fd7[57],_0x4afbx19[_0x1fd7[40]]);_0x4afbx13= _0x4afbx19;_0x4afbx10[_0x1fd7[58]]= _0x4afbx19[_0x1fd7[40]];_0x4afbx10[_0x1fd7[59]]= _0x1fd7[60];_0x4afbx10[_0x1fd7[61]]= _0x4afbx10[_0x1fd7[19]];_0x4afbx10[_0x1fd7[62]]= _0x4afbx10[_0x1fd7[63]];_0x4afbx10[_0x1fd7[24]]= parseInt(_0x4afbx10[_0x1fd7[30]])> 0?_0x1fd7[64]:_0x1fd7[65];return FaxMessage[_0x1fd7[54]](_0x4afbx10)})[_0x1fd7[37]](function(_0x4afbx16){if(!_0x4afbx16){throw  new Error(_0x1fd7[44])};_0x4afbx12= _0x4afbx16;logger[_0x1fd7[32]](_0x1fd7[25],_0x4afbx16[_0x1fd7[40]]);if(parseInt(_0x4afbxe[_0x1fd7[30]])> 0){var _0x4afbx17=path[_0x1fd7[46]](_0x4afbxe[_0x1fd7[43]])[_0x1fd7[45]];var _0x4afbx18=_0x4afbx17+ _0x1fd7[47];return FaxAttachment[_0x1fd7[54]]({path:path[_0x1fd7[53]](config[_0x1fd7[48]],_0x1fd7[49],_0x1fd7[50],_0x1fd7[9],_0x1fd7[51],_0x1fd7[52],_0x4afbx18),basename:_0x4afbx18,name:_0x4afbx17,FaxMessageId:_0x4afbx16[_0x1fd7[40]]})};logger[_0x1fd7[24]](util[_0x1fd7[20]](_0x1fd7[55],_0x4afbxe[_0x1fd7[30]]));return})[_0x1fd7[37]](function(_0x4afbx15){if(!_0x4afbx15){logger[_0x1fd7[24]](_0x1fd7[38]);return};logger[_0x1fd7[32]](_0x1fd7[39],_0x4afbx15[_0x1fd7[40]]);return exec(_0x1fd7[41]+ _0x4afbx15[_0x1fd7[5]]+ _0x1fd7[42]+ _0x4afbxe[_0x1fd7[43]])})[_0x1fd7[37]](function(){if(parseInt(_0x4afbxe[_0x1fd7[30]])> 0){logger[_0x1fd7[32]](_0x1fd7[31]);logger[_0x1fd7[21]](_0x1fd7[33]);process[_0x1fd7[35]]({message:_0x1fd7[34],doc:{message:_0x4afbx12,account:_0x4afbx11}});return _0x4afbx12[_0x1fd7[36]]({plain:true})}})[_0x1fd7[29]](function(_0x4afbx14){logger[_0x1fd7[24]](_0x1fd7[23],_0x4afbx14);logger[_0x1fd7[24]](_0x1fd7[25],_0x4afbx14[_0x1fd7[26]]);logger[_0x1fd7[24]](_0x1fd7[27],_0x4afbx14[_0x1fd7[28]])})}},sendfax:function(_0x4afbxe){return function(_0x4afbxf){var _0x4afbx12;return FaxMessage[_0x1fd7[83]]({where:{filename:_0x4afbxe[_0x1fd7[43]],localstationid:_0x4afbxe[_0x1fd7[63]]}})[_0x1fd7[37]](function(_0x4afbx1e){if(!_0x4afbx1e){throw  new Error(_0x1fd7[90])};_0x4afbx12= _0x4afbx1e;var _0x4afbx1f=_0x1fd7[87];if(_0x4afbxe[_0x1fd7[30]]=== _0x1fd7[91]){_0x4afbx1f= _0x1fd7[92]};return _0x4afbx12[_0x1fd7[72]]({remotestationid:_0x4afbxe[_0x1fd7[93]],pagestransferred:_0x4afbxe[_0x1fd7[30]],resolution:_0x4afbxe[_0x1fd7[94]],transferrate:_0x4afbxe[_0x1fd7[95]],status:_0x4afbx1f})})[_0x1fd7[37]](function(_0x4afbx16){logger[_0x1fd7[32]](_0x1fd7[88],_0x4afbx16[_0x1fd7[40]]);return _0x4afbx12[_0x1fd7[89]]()})[_0x1fd7[37]](function(_0x4afbx1d){if(!_0x4afbx1d){throw  new Error(_0x1fd7[86])};return _0x4afbx1d[_0x1fd7[72]]({lastEvent:_0x1fd7[87]},{individualHooks:true})})[_0x1fd7[37]](function(_0x4afbx19){logger[_0x1fd7[32]](_0x1fd7[85],_0x4afbx19[_0x1fd7[40]])})[_0x1fd7[29]](function(_0x4afbx14){logger[_0x1fd7[24]](_0x1fd7[84],_0x4afbx14);logger[_0x1fd7[24]](_0x1fd7[25],_0x4afbx14[_0x1fd7[26]]);logger[_0x1fd7[24]](_0x1fd7[27],_0x4afbx14[_0x1fd7[28]])})}},faxstatus:function(_0x4afbxe){return function(_0x4afbxf){if(_0x4afbxe[_0x1fd7[96]]!== _0x1fd7[35]){return BPromise[_0x1fd7[97]]()};return FaxMessage[_0x1fd7[83]]({where:{filename:_0x4afbxe[_0x1fd7[43]],localstationid:_0x4afbxe[_0x1fd7[63]]}})[_0x1fd7[37]](function(_0x4afbx1e){if(!_0x4afbx1e){throw  new Error(_0x1fd7[90])};return _0x4afbx1e[_0x1fd7[72]]({channel:_0x4afbxe[_0x1fd7[99]],channelstate:_0x4afbxe[_0x1fd7[100]],channelstatedesc:_0x4afbxe[_0x1fd7[101]],calleridnum:_0x4afbxe[_0x1fd7[19]],calleridname:_0x4afbxe[_0x1fd7[102]],connectedlinenum:_0x4afbxe[_0x1fd7[103]],connectedlinename:_0x4afbxe[_0x1fd7[104]],accountcode:_0x4afbxe[_0x1fd7[105]],context:_0x4afbxe[_0x1fd7[106]],exten:_0x4afbxe[_0x1fd7[107]],priority:_0x4afbxe[_0x1fd7[108]],uniqueid:_0x4afbxe[_0x1fd7[109]],linkedid:_0x4afbxe[_0x1fd7[110]],lastStatus:_0x4afbxe[_0x1fd7[59]]})})[_0x1fd7[29]](function(_0x4afbx14){logger[_0x1fd7[24]](_0x1fd7[98],_0x4afbx14);logger[_0x1fd7[24]](_0x1fd7[25],_0x4afbx14[_0x1fd7[26]]);logger[_0x1fd7[24]](_0x1fd7[27],_0x4afbx14[_0x1fd7[28]])})}},faxerror:function(_0x4afbxe){return function(_0x4afbxf){if(!_0x4afbxe[_0x1fd7[96]][_0x1fd7[112]](_0x1fd7[111])||  !_0x4afbxe[_0x1fd7[113]]){return BPromise[_0x1fd7[97]]()};return FaxMessage[_0x1fd7[83]]({where:{channel:_0x4afbxe[_0x1fd7[99]]}})[_0x1fd7[37]](function(_0x4afbx1e){if(_0x4afbx1e){return _0x4afbx1e[_0x1fd7[72]]({error:_0x4afbxe[_0x1fd7[113]]})};return})[_0x1fd7[29]](function(_0x4afbx14){logger[_0x1fd7[24]](_0x1fd7[114],_0x4afbx14)})}}}}
\ No newline at end of file