1 var _0x61b6=["\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\x53\x63\x68\x65\x64\x75\x6C\x65\x72","\x66\x61\x78","\x25\x73\x2E\x25\x73","\x75\x6E\x69\x78","\x69\x64","\x6E\x61\x6D\x65","\x6C\x6F\x63\x61\x6C\x73\x74\x61\x74\x69\x6F\x6E\x69\x64","\x66\x72\x6F\x6D","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x70\x61\x72\x73\x65","\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","\x74\x69\x66\x66\x32\x70\x64\x66\x20\x2D\x6F\x20","\x20","\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","\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","\x74\x6F","","\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"];_0x61b6[0];var BPromise=require(_0x61b6[1]);var moment=require(_0x61b6[2]);var util=require(_0x61b6[3]);var _=require(_0x61b6[4]);var path=require(_0x61b6[5]);var config=require(_0x61b6[6]);var exec=require(_0x61b6[8])[_0x61b6[7]];var FaxMessage=require(_0x61b6[10])[_0x61b6[9]];var FaxRoom=require(_0x61b6[10])[_0x61b6[11]];var FaxAccount=require(_0x61b6[10])[_0x61b6[12]];var FaxAttachment=require(_0x61b6[10])[_0x61b6[13]];var Contact=require(_0x61b6[10])[_0x61b6[14]];module[_0x61b6[15]]= function(){return {receivefax:function(_0x76e3xd){return function(_0x76e3xe){console[_0x61b6[19]](util[_0x61b6[18]](_0x61b6[16],_0x76e3xd[_0x61b6[17]]));var _0x76e3xf=_[_0x61b6[20]](_0x76e3xd);var _0x76e3x10;var _0x76e3x11,_0x76e3x12;return FaxAccount[_0x61b6[81]]({where:{localstationid:_0x76e3xd[_0x61b6[36]]}})[_0x61b6[41]](function(_0x76e3x1b){if(!_0x76e3x1b){throw new Error(_0x61b6[77])};console[_0x61b6[19]](_0x61b6[78],_0x76e3xd[_0x61b6[36]]);_0x76e3x10= _0x76e3x1b;if(_0x76e3x10[_0x61b6[79]]){return Contact[_0x61b6[80]]({where:{ListId:_0x76e3x10[_0x61b6[79]],$or:[{phone:_0x76e3xd[_0x61b6[17]]},{fax:_0x76e3xd[_0x61b6[17]]}]},defaults:{phone:_0x76e3xd[_0x61b6[17]],fax:_0x76e3xd[_0x61b6[17]],firstName:_0x76e3xd[_0x61b6[17]],ListId:_0x76e3x10[_0x61b6[79]]}})}else {return []}})[_0x61b6[76]](function(_0x76e3x19,_0x76e3x1a){if(_0x76e3x1a!== undefined&& !_0x76e3x1a){return _0x76e3x19[_0x61b6[70]]({fax:_0x76e3xd[_0x61b6[17]]})};return})[_0x61b6[41]](function(){return FaxRoom[_0x61b6[75]]({limit:1,where:{contact:_0x76e3xf[_0x61b6[17]],FaxAccountId:_0x76e3x10[_0x61b6[34]],status:{$ne:_0x61b6[72]}},order:[[_0x61b6[73],_0x61b6[74]]]})})[_0x61b6[41]](function(_0x76e3x18){if(_0x76e3x18[_0x61b6[64]]){_0x76e3x18= _[_0x61b6[65]](_0x76e3x18);return _0x76e3x18[_0x61b6[70]]({lastEvent:_0x61b6[60],lastEventAt:moment()[_0x61b6[18]](_0x61b6[66]),status:_0x61b6[67],openReason:_0x61b6[68],faxIn:++_0x76e3x18[_0x61b6[69]]})}else {return FaxRoom[_0x61b6[54]]({contact:_0x76e3xf[_0x61b6[17]],account:_0x76e3x10[_0x61b6[35]],status:_0x61b6[71],lastEvent:_0x61b6[60],lastEventAt:moment()[_0x61b6[18]](_0x61b6[66]),FaxAccountId:_0x76e3x10[_0x61b6[34]],faxIn:1})}})[_0x61b6[41]](function(_0x76e3x18){if(!_0x76e3x18){throw new Error(_0x61b6[56])};console[_0x61b6[19]](_0x61b6[57],_0x76e3x18[_0x61b6[34]]);_0x76e3x12= _0x76e3x18;_0x76e3xf[_0x61b6[58]]= _0x76e3x18[_0x61b6[34]];_0x76e3xf[_0x61b6[59]]= _0x61b6[60];_0x76e3xf[_0x61b6[37]]= _0x76e3xf[_0x61b6[17]];_0x76e3xf[_0x61b6[61]]= _0x76e3xf[_0x61b6[36]];_0x76e3xf[_0x61b6[22]]= parseInt(_0x76e3xf[_0x61b6[28]])> 0?_0x61b6[62]:_0x61b6[63];return FaxMessage[_0x61b6[54]](_0x76e3xf)})[_0x61b6[41]](function(_0x76e3x15){if(!_0x76e3x15){throw new Error(_0x61b6[46])};_0x76e3x11= _0x76e3x15;console[_0x61b6[19]](_0x61b6[23],_0x76e3x15[_0x61b6[34]]);if(parseInt(_0x76e3xd[_0x61b6[28]])> 0){var _0x76e3x16=path[_0x61b6[39]](_0x76e3xd[_0x61b6[38]])[_0x61b6[35]];var _0x76e3x17=_0x76e3x16+ _0x61b6[47];return FaxAttachment[_0x61b6[54]]({path:path[_0x61b6[53]](config[_0x61b6[48]],_0x61b6[49],_0x61b6[50],_0x61b6[31],_0x61b6[51],_0x61b6[52],_0x76e3x17),basename:_0x76e3x17,name:_0x76e3x16,FaxMessageId:_0x76e3x15[_0x61b6[34]]})};console[_0x61b6[19]](util[_0x61b6[18]](_0x61b6[55],_0x76e3xd[_0x61b6[28]]));return})[_0x61b6[41]](function(_0x76e3x14){if(!_0x76e3x14){console[_0x61b6[19]](_0x61b6[42]);return};console[_0x61b6[19]](_0x61b6[43],_0x76e3x14[_0x61b6[34]]);return exec(_0x61b6[44]+ _0x76e3x14[_0x61b6[5]]+ _0x61b6[45]+ _0x76e3xd[_0x61b6[38]])})[_0x61b6[41]](function(){if(parseInt(_0x76e3xd[_0x61b6[28]])> 0){console[_0x61b6[19]](_0x61b6[29]);process[_0x61b6[40]]({message:_0x61b6[30],doc:{channel:_0x61b6[31],uniqueid:util[_0x61b6[18]](_0x61b6[32],moment()[_0x61b6[33]](),_0x76e3x12[_0x61b6[34]]),messageid:_0x76e3x11[_0x61b6[34]],roomid:_0x76e3x12[_0x61b6[34]],accountid:_0x76e3x10[_0x61b6[34]],accountname:_0x76e3x10[_0x61b6[35]],accountphone:_0x76e3x10[_0x61b6[36]],from:_0x76e3x11[_0x61b6[37]],attachmentBasename:path[_0x61b6[39]](_0x76e3xd[_0x61b6[38]])[_0x61b6[35]]}})}})[_0x61b6[27]](function(_0x76e3x13){console[_0x61b6[22]](_0x61b6[21],_0x76e3x13);console[_0x61b6[22]](_0x61b6[23],_0x76e3x13[_0x61b6[24]]);console[_0x61b6[22]](_0x61b6[25],_0x76e3x13[_0x61b6[26]])})}},sendfax:function(_0x76e3xd){return function(_0x76e3xe){var _0x76e3x11;return FaxMessage[_0x61b6[81]]({where:{filename:_0x76e3xd[_0x61b6[38]],localstationid:_0x76e3xd[_0x61b6[36]]}})[_0x61b6[41]](function(_0x76e3x1d){if(!_0x76e3x1d){throw new Error(_0x61b6[88])};_0x76e3x11= _0x76e3x1d;var _0x76e3x1e=_0x61b6[85];if(_0x76e3xd[_0x61b6[28]]=== _0x61b6[89]){_0x76e3x1e= _0x61b6[90]};return _0x76e3x11[_0x61b6[70]]({remotestationid:_0x76e3xd[_0x61b6[91]],pagestransferred:_0x76e3xd[_0x61b6[28]],resolution:_0x76e3xd[_0x61b6[92]],transferrate:_0x76e3xd[_0x61b6[93]],status:_0x76e3x1e})})[_0x61b6[41]](function(_0x76e3x15){console[_0x61b6[19]](_0x61b6[86],_0x76e3x15[_0x61b6[34]]);return _0x76e3x11[_0x61b6[87]]()})[_0x61b6[41]](function(_0x76e3x1c){if(!_0x76e3x1c){throw new Error(_0x61b6[84])};return _0x76e3x1c[_0x61b6[70]]({lastEvent:_0x61b6[85]},{individualHooks:true})})[_0x61b6[41]](function(_0x76e3x18){console[_0x61b6[19]](_0x61b6[83],_0x76e3x18[_0x61b6[34]])})[_0x61b6[27]](function(_0x76e3x13){console[_0x61b6[22]](_0x61b6[82],_0x76e3x13);console[_0x61b6[22]](_0x61b6[23],_0x76e3x13[_0x61b6[24]]);console[_0x61b6[22]](_0x61b6[25],_0x76e3x13[_0x61b6[26]])})}},faxstatus:function(_0x76e3xd){return function(_0x76e3xe){if(_0x76e3xd[_0x61b6[94]]!== _0x61b6[40]){return BPromise[_0x61b6[95]]()};return FaxMessage[_0x61b6[81]]({where:{filename:_0x76e3xd[_0x61b6[38]],localstationid:_0x76e3xd[_0x61b6[36]]}})[_0x61b6[41]](function(_0x76e3x1d){if(!_0x76e3x1d){throw new Error(_0x61b6[88])};return _0x76e3x1d[_0x61b6[70]]({channel:_0x76e3xd[_0x61b6[97]],channelstate:_0x76e3xd[_0x61b6[98]],channelstatedesc:_0x76e3xd[_0x61b6[99]],calleridnum:_0x76e3xd[_0x61b6[17]],calleridname:_0x76e3xd[_0x61b6[100]],connectedlinenum:_0x76e3xd[_0x61b6[101]],connectedlinename:_0x76e3xd[_0x61b6[102]],accountcode:_0x76e3xd[_0x61b6[103]],context:_0x76e3xd[_0x61b6[104]],exten:_0x76e3xd[_0x61b6[105]],priority:_0x76e3xd[_0x61b6[106]],uniqueid:_0x76e3xd[_0x61b6[107]],linkedid:_0x76e3xd[_0x61b6[108]],lastStatus:_0x76e3xd[_0x61b6[59]]})})[_0x61b6[27]](function(_0x76e3x13){console[_0x61b6[22]](_0x61b6[96],_0x76e3x13);console[_0x61b6[22]](_0x61b6[23],_0x76e3x13[_0x61b6[24]]);console[_0x61b6[22]](_0x61b6[25],_0x76e3x13[_0x61b6[26]])})}},faxerror:function(_0x76e3xd){return function(_0x76e3xe){if(!_0x76e3xd[_0x61b6[94]][_0x61b6[110]](_0x61b6[109])|| !_0x76e3xd[_0x61b6[111]]){return BPromise[_0x61b6[95]]()};return FaxMessage[_0x61b6[81]]({where:{channel:_0x76e3xd[_0x61b6[97]]}})[_0x61b6[41]](function(_0x76e3x1d){if(_0x76e3x1d){return _0x76e3x1d[_0x61b6[70]]({error:_0x76e3xd[_0x61b6[111]]})};return})[_0x61b6[27]](function(_0x76e3x13){console[_0x61b6[22]](_0x61b6[112],_0x76e3x13)})}}}}