You can create a Process Builder/Workflow or Apex trigger that can take the fax number from the received fax and look for a matching account/contact with the fax number taking into account formatting of the fax number on account/contact and how that is the same on the received fax. Find matching then update a lookup field they create on the Received Fax object to the Account. Then you would need a Flow or Apex to query for matched Fax and return the ID if there was no inbound fax to start with.