Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contact recognition #917

Closed
pamoreno opened this issue Dec 29, 2016 · 10 comments
Closed

Contact recognition #917

pamoreno opened this issue Dec 29, 2016 · 10 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@pamoreno
Copy link

I must first say that this issue has been a major drawback when asking people to install Kontalk.

Expected behavior

After registration, all of my contacts that are registered to the network should appear in my contacts list (within Kontalk).

Actual behavior

The only contacts that appear are those which I have in my phone with the exact same number that they used to register. I'll use as an example Argentina's telephone numbers and the subscriber number 1234-5678 with area code 11. From abroad one should dial (or save to the contacts list): +54 9 (area code) (subscriber number), that is +54 9 11 1234 5678. But within Argentina that number can be saved to the agenda as:

  • +54 9 11 1234 5678
  • +54 11 1234 5678
  • 15 1234 5678
  • 0 11 15 1234 5678
  • ...

If I save my contact with +54 9 11 1234 5678 to my contact list but the other person registers with the phone number +54 11 1234 5678 (which is also correct) that contact is not shown to me on my Kontalk's contacts list.

Steps to reproduce

  1. Save a contact with a phone number different with which she/he used to register (but also valid, meaning: you can call and send sms to that number and the other person receives them)
  2. Register to the Kontalk network (or use a new contact in step one)
  3. Refresh contact list
  4. Contact does not appear

Environment

Kontalk version: F-Droid

Android version: 6.0.1 (CyanogeMod 13)

Device model: Samsung GT-I8260L

Other

A related issue can be seen when changing the phone number within the phone's contacts list. Change the phone number of a Kontalk available contact (?) and see how the name and phone number change within Kontalk's contacts list (the name changes for the one the user registered with and the phone number changes for hash@beta.kontalk.net)

@daniele-athome
Copy link
Member

Thanks for reporting. These cases should have been handled correctly by libphonenumber. Apparently there is still some problem, I'll do some tests and get back to you ASAP.

@daniele-athome daniele-athome self-assigned this Dec 29, 2016
@daniele-athome daniele-athome added the pending Issue is pending further analysis label Dec 29, 2016
@daniele-athome daniele-athome added this to the 4.0.0 milestone Dec 29, 2016
@daniele-athome
Copy link
Member

daniele-athome commented Dec 31, 2016

I forgot to ask you, what exact version of Kontalk are you using? F-Droid is currently hosting both beta and stable releases of Kontalk. You can see that in the About screen of Kontalk. Just a curiosity at this point since also version 3.1.10 is affected.

@daniele-athome daniele-athome added bug Something isn't working and removed pending Issue is pending further analysis labels Dec 31, 2016
@daniele-athome
Copy link
Member

daniele-athome commented Dec 31, 2016

This is more problematic than I thought.
I called a friend of mine telephony expert, he said that you can't build the full international number from "15 1234 5678" since you lack information.
He also told me that both "+54 9 11 1234 5678" and "+54 11 1234 5678" are valid from a telephone exchange point of view and they are the same phone number. Just like you said of course, the problem is that libphonenumber also tells me that and format both numbers with or without the 9 (but they don't match literally, thus will not appear in Kontalk)
It's a mess man. This needs some serious thinking.

This has to wait for the new year, sorry. I'll publish beta5 now since it was expected today but the bug won't be fixed yet.

daniele-athome added a commit that referenced this issue Dec 31, 2016
Signed-off-by: Daniele Ricci <daniele.athome@gmail.com>
@pamoreno
Copy link
Author

Sorry I did not specified it before, my bad. It's Kontalk 4.0.0 beta4. I think that the issue has always been there, for i'm using (and trying to spread) Kontalk since version 2.something.

A while ago I tried to debug a little this issue and saw that the phone number resolution was left to libphonenumber. The only solution I thought it could be a "solution", until libphonenumber resolves the issue, is to have a "default contact country code", and maybe "default area code", (which can be read from the telephone and changed by the user) so all numbers are preprocessed, but I'm almost sure that this would solve the problem for me but not for others (if it works, because the 9 would still be missing).

Anyway, neither java nor android development nor telephony are my expertise, but I can test what you need.

@daniele-athome
Copy link
Member

The only solution I thought it could be a "solution", until libphonenumber resolves the issue, is to have a "default contact country code", and maybe "default area code", (which can be read from the telephone and changed by the user)

I've been told that even such a solution won't be enough because, among other problems, there are conflicts between area codes, e.g. there is "123" but also "1234".

I've fixed the code to always include the 9 (which is apparently the "most correct" form, according to ITU standards) also when registering, so the matching would be exact on every case. However, to avoid inconsistencies and fix this now, users that registered without the 9 previously would have to register again...

There a case that can't be handled with this format: 15 1234 5678 because you lack information to complete the number (the 11). I'm sorry this requires editing how you save your contacts in the address book.

@pamoreno
Copy link
Author

pamoreno commented Jan 3, 2017

I've fixed the code to always include the 9 (which is apparently the "most correct" form, according to ITU standards) also when registering, so the matching would be exact on every case. However, to avoid inconsistencies and fix this now, users that registered without the 9 previously would have to register again...

I think it's the most correct way to store phone numbers (at least in Argentina :P), so that part is ok :). Thank you :)

There a case that can't be handled with this format: 15 1234 5678 because you lack information to complete the number (the 11).

When the phone number is saved that way, (i think) the phone number belongs to the same area code of the caller (or Kontalk user in this case). So, if my area code is 341 and I've saved a contact as 15 123 4567, the area code goes before 15, leading to 341 15 123 4567 and the international number: +54 9 341 123 4567. Another way of saving contacts (that i've seen) is: 0 341 15 123 4567 (if that matters).
Also, the total number of digits (area code + customer number) is always 10, so if I live in area code 341 and save a contact as 15 1234 5678, the total number of digits would be 11, which is incorrect.

What I meant: if the phone number is just 15 [0-9]{6,8}, the area code is my own area code.

@daniele-athome
Copy link
Member

I'm afraid libphonenumber doesn't provide such features so I guess I'll have to implement these checks by myself. No problem with that, but I need some documentation stating what to do exactly. I mean I've seen cases with PI/PU conflicting (e.g. 345 and 3456), how do I distinguish those? It would mean a great deal of help if you could research that for the project and it would save me a lot of time (also because those documents are usually in the country's native language and I don't speak spanish). I'll consult with that friend of mine too so we can speed this up as much as possible.

@pamoreno
Copy link
Author

I'm sorry i did not answer before. I'm also looking for some technical information about this.

@daniele-athome
Copy link
Member

Apparently, max number of digits should always be 10, so PI/PU length could be determined using that basis.

@daniele-athome
Copy link
Member

Let me know when you have something more specific, we'll open another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants