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

Handle phone numbers prefixes #31

Closed
daniele-athome opened this issue Mar 9, 2014 · 10 comments
Closed

Handle phone numbers prefixes #31

daniele-athome opened this issue Mar 9, 2014 · 10 comments
Assignees
Labels
bug Something isn't working imported
Milestone

Comments

@daniele-athome
Copy link
Member

From [email protected] on March 31, 2013 19:06:59

  1. a friend installs kontalk and registers himself an account
  2. he can´t find me in kontalk
  3. he adds a country prefix to my phonenumber (+49) in his adress book
  4. kontalk now shows my contact What version of the product are you using? On what operating system? 2.5.5 Android Please provide any additional information below. you could substitute every 0.. with the country code of a users country automaticly. A simple way to do that would be to save the country code a user chooses during registration. I know many people who don´t care about contry codes.

Original issue: http://code.google.com/p/kontalk/issues/detail?id=49

@daniele-athome daniele-athome self-assigned this Mar 9, 2014
@daniele-athome
Copy link
Member Author

From [email protected] on March 31, 2013 11:23:07

Actually Kontalk does save the country code the user uses during registration, and it uses it to find other registered users. NumberValidator#fixNumber contains this logic:

  1. if number starts with "00", it does nothing
  2. if first digit is not equal to "+", country code is prepended (first tries with SIM card country code, if not found it uses the one from the registered phone number).

Maybe there is a problem with country code detection. Can you please do the following:

  1. install Catlog from Play Store
  2. remove country code from a contact in your address book you know is registered to Kontalk
  3. refresh contacts in Kontalk -> compose message -> refresh button (wait until it finishes, eventually watching the contact disappearing from Kontalk list)
  4. open Catlog and send a log to devteam at kontalk.org

Please note that on Android 4.1+ you need root access to use Catlog.

Summary: Phone numbers in address book require country code for Kontalk to find contacts (was: phone numbers in address book require country code for kontalk to find contacts)
Labels: Component-Legacy-Android

@daniele-athome
Copy link
Member Author

From [email protected] on March 31, 2013 11:45:54

I don´t want to root my device yet, sry. I tried to get the log messages with LogCat on my laptop (ADT) with kontalk running on my connected device but no message from kontalk appeared.

But steps 2. & 3. are reproduceable. After I removed "+49" from a contacts number, it disappead in kontalk after a refresh.

@daniele-athome
Copy link
Member Author

From [email protected] on March 31, 2013 11:51:05

I didn't think about using adb, I didn't know your skills sorry :)
Problem is I cannot reproduce: in fact on my phone almost every number in my contacts is missing the country code, and it is working.
Are you using Kontalk on a tablet or something else without a GSM/UMTS module?

P.S. In logcat you should look for one of these:

  1. "error parsing number:"
  2. "no country code available"
  3. "unable to normalize number"

@daniele-athome
Copy link
Member Author

From [email protected] on March 31, 2013 11:58:05

maybe i found the problem(?):

if number does not begin with '+' you do the following

number = prefix + number;
that means, a number e.g. 0151.. is converted to +490151.. but should read +49151 (without 0)

=> number = prefix + number.substring(1);

am I right?

@daniele-athome
Copy link
Member Author

From [email protected] on March 31, 2013 12:07:13

You did find the problem :)
Actually I've just found out we have this problem also with UK users which put a "9" prefix to all mobile numbers :S
I'm renaming the issue and assigning it a higher priority. Thank you!

Summary: Handle phone numbers prefixes (was: Phone numbers in address book require country code for Kontalk to find contacts)
Status: Accepted
Owner: [email protected]
Labels: -Priority-Medium Priority-Critical Component-XMPP-Android Milestone-2.2.7 Milestone-3.0

@daniele-athome
Copy link
Member Author

From [email protected] on April 03, 2013 16:51:28

A quick look at the libphonenumber website makes this looks as a promising option.

QUOTE
Let's say you have a string representing a phone number from Switzerland. This is how you parse/normalize it into a PhoneNumber object:

String swissNumberStr = "044 668 18 00"
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
try {
PhoneNumber swissNumberProto = phoneUtil.parse(swissNumberStr, "CH");
} catch (NumberParseException e) {
System.err.println("NumberParseException was thrown: " + e.toString());
}

[..]

// Produces "+41446681800"
System.out.println(phoneUtil.format(swissNumberProto, PhoneNumberFormat.E164));
UNQUOTE

So it seems that as long as the country is known, every phone number can be converted to an international number. Since the country is known from the user's country code which is entered during setup, this should be able to solve the problem.

@daniele-athome
Copy link
Member Author

From [email protected] on April 09, 2013 03:28:36

Fixed in xmpp and master.

Status: Fixed

@daniele-athome
Copy link
Member Author

From [email protected] on May 14, 2013 02:26:19

Issue 77 has been merged into this issue.

@daniele-athome
Copy link
Member Author

From [email protected] on May 14, 2013 02:27:18

Issue 79 has been merged into this issue.

@daniele-athome
Copy link
Member Author

From [email protected] on March 08, 2014 06:24:41

Issue 79 has been merged into this 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 imported
Projects
None yet
Development

No branches or pull requests

1 participant