Commit 2315ec77 authored by Luci Stanescu's avatar Luci Stanescu

Improved logic for matching contacts to incoming sessions

parent f3f4172c
...@@ -1941,10 +1941,12 @@ class SessionManager(object): ...@@ -1941,10 +1941,12 @@ class SessionManager(object):
break break
else: else:
matched_contacts = [] matched_contacts = []
if self.number_re.match(uri.user): number = uri.user.strip('0') if self.number_re.match(uri.user) else Null
number = uri.user.lstrip('0') if len(number) > 7:
for contact in (contact for contact in self.main_window.contact_model.iter_contacts() if self.number_re.match(contact.uri)): for contact in self.main_window.contact_model.iter_contacts():
if len(number) > 7 and self.normalize_number(session.account, contact.uri).endswith(number): if self.number_re.match(contact.uri) and self.normalize_number(session.account, contact.uri).endswith(number):
matched_contacts.append(contact)
elif any(self.number_re.match(alias) and self.normalize_number(session.account, alias).endswith(number) for alias in contact.sip_aliases):
matched_contacts.append(contact) matched_contacts.append(contact)
contact = matched_contacts[0] if len(matched_contacts)==1 else None contact = matched_contacts[0] if len(matched_contacts)==1 else None
if filetransfer_streams: if filetransfer_streams:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment