The following heuristics are used, in this order:
* if the message replies to an existing thread by having a Message-Id that matches an existing mail_message.message_id, we take the original message model/thread_id pair and ignore custom_value as no creation will take place
* if the message replies to an existing thread by having In-Reply-To or References matching odoo model/thread_id Message-Id and if this thread has messages without message_id, take this model/thread_id pair and ignore custom_value as no creation will take place (6.1 compatibility)
* look for a mail.alias entry matching the message recipients and use the corresponding model, thread_id, custom_values and user_id. This could lead to a thread update or creation depending on the alias * fallback on provided ``model``, ``thread_id`` and ``custom_values``
* raise an exception as no route has been found