Signal get confused with country codes
I have:
- [x] searched open and closed issues for duplicates
- [x] read https://github.com/WhisperSystems/Signal-Android/wiki/Submitting-useful-bug-reports
Bug description
I recently moved to the US from Australia. Australian numbers begin with +61. I miss a call in the US, the number shown is eg, "1 949 123 4567" (note: not "+1") On the missed-call (in the dialer app), I choose "reply with txt message", and it opens Signal to compose a txt message to that number, except signal instead decides to use "+61 1 949 123 4567". That is, it prepends +61 (Australian country code) to the US number which already includes the US country code (1).
I suggest that Signal shouldn't presume to prepend any country code. Why is it prepending the Australian country code to numbers? I'm not in Australia..
Steps to reproduce
- Install Signal on an Australian phone (ie, configure as if you're a normal Australian user).
- Move to the US.
- Receive a call from an (edit: unknown) US number.
- "Reply as txt message" to the number you received a call from.
- Note that Signal prepends the number with +61, which is wrong.
Actual result: +61 is prepended to American numbers. Expected result: +61 should not be prepended to American numbers. They already begin with '1' (country code). Signal may like to prepend '+' to transform it to "+1" for consistency, but that's not necessary.
Device info
Device: OnePlus 5 Android version: 7.1.1 Signal version: 4.14.10
signal doesn't a have feature to update phone number incase you changed yours
Errm... What?
This has nothing to do with my phone number.
@TurkeyMan, few months ago I also have had some problems related to phone numbers.
Try this:
- Start Android's Contact application where you can edit the contacts' phone number.
- Change phone number "1 949 123 4567" into international format. That is phone number has to start with "+" then followed by international country phone code (e.g. for US I think it is 1) and then the number you are trying to call.
- Make sure you can call this number with regular phone application (not Signal), so you are 100% sure the phone number is correct.
- Open Signal, tap on Pencil icon and from menu (three dots or lines at top-right) and select Refresh.
- Make sure you see phone number in international format, so starting with "+" etc. Do the Signal call or Signal message to test out. Note: If you can't see phone number with "+" in Signal, then you did not fix the problem. Try uninstalling and installing Signal back, this should grab new contacts from Contacts application.
I suggest to perform a above test for one single contact and if it works change all of the contacts to international phone format. I did this few mounts ago and since having no problem.
In my humble opinion it is good practice to have all of the phone numbers stored using international phone number format. When ever I travel to another country I am sure my contacts are accessible without any hassle of changing phone number.
@igor2x You haven't followed my repro steps. This has nothing to do with contacts; it's specifically an issue with respect to unknown numbers. Authoring a txt message to an unknown number (ie, missed call) causes Signal to incorrectly interpret the number it got from the dialer app, and then sends the txt message to the wrong number if you don't pay careful attention and intervene (resulting in your txt not being delivered to your intended recipient, even though it looks like it was).
If there is unknown number, I conclude you are not using Signal message to reply, but you are using SMS message.
I. Google phone setting:
- Can you please log into Gmail with non-mobile version (probably simplest way to use a PC).
- Then on top-right click on gear icon and select Settings.
- On General tab second settings is Phone numbers and there is Default country code. Your current setting is probably Australia. Can you please try to set it to United States and on bottom click on Save Changes button.
- From Signal try to reply with SMS to unknown US local number. Does it work now?
II. To find out if this is Signal problem or something else:
- Open stock Android messaging application e.g. Messages.
- Accept Messages app to become your default SMS application.
- Try to reply with SMS message to the unknown US local number. Does this works? If yes, then it may be Signal problem. If it doesn't work, then it is not Signal problem, but something else, carrier problem, Android problem, settings problem etc.
III. Additional questions: a) From Signal, can you reply with SMS message to US user that has correct international phone number set in Contact? b) From Signal, can you reply with SMS message to the unknown phone call from Australia?
IV. Debug the problem:
- Do you get any error message when you reply with SMS message to the unknown US local phone call? Please post it.
- From Signal please reproduce a problem, so send SMS message to unknown US phone number and right after the problem appears, tap on menu (top-right tree dots), select Settings and Advanced and select Submit debug log and press on Submit button. This action will submit your debug log to server. Then please post the URL of the submitted debug log on this bug tracker.
I am sorry, I am not in the state to reproduce a problem, because I live in the same country as my carrier is from. Just trying to ping-pong the problem, so Signal developers have as much data as possible, to begin working on the problem.
Signal has no way to know where you are or what your phone number is. The only thing it knows is the phone number you've registered for Signal with.
If we encounter a phone number that's not E164 formatted, there's really no way to know what it is. The only thing we can do is assume that it is an implicitly formatted number for the country that you're registered in.
It sounds to me like you're still using a +61 number with Signal?
Related #5078, #5306
Stuck sick in a hotel room today so poked around this a bit. A lot of the below is probably not news to Signal devs but it was news to me:
(This is all on Android 7.1.2 LineageOS.)
Current Situation
- When user selects a number in an Android Dialer call log and choose "Send a message", Dialer sends an ACTION_SENDTO intent with uri
smsto:xxxxxxxxx. The phone number in the Uri seems to be the exact same number that is shown in Dialer's UI.- For a known Contact, this means it may or may not be E164 with
+<countrycode>prefix. - For unknown numbers which were domestic calls, it always seems to be a non-E164 number without a country code.
- For unknown numbers which were international calls, it's an E164 number already. (Annoyingly, Dialer knows the country code at this point...)
- For a known Contact, this means it may or may not be E164 with
- The Android Messaging app calls
TelephonyManager.getSimCountryIso()on any non-E164 smsto: URIs it receives. This returns the country code for the SMS provider. - Signal instead will prefix the Signal registered phone number's country code to any non-E164 number.
Rationale
I think I understand the reasoning here - that maybe this number is actually a Signal-enabled number and you don't really intend to send them an SMS. We don't know how long ago a user changed countries, they may have "local" numbers from multiple countries floating around in the call logs...
However, the UX can be confusing and fiddly when Signal gets a wrong number. The "new message" UI pops up with an invalid number shown at the top of the screen. This number can't be edited, so the only way out is to go back to Dialer, copy the number to the clipboard, go back into Signal, Back out of the "new message" UI, paste the local number, tap on the start of the number and type the correct country code manually. If the user doesn't notice and has tried to type or send an SMS to the invalid number already, it can be more confusing and fiddly.
Suggestion
This isn't ideal, but I was thinking about:
- Use libphonenumber to compare the two possible country codes. If
(signal country)+numberis invalid (& not a possible short code number) but(SIM country)+numberis valid, fall back to the SIM country code. This won't catch every "wrong" combination, but it will catch quite a few. - On ACTION_SENDTO "smsto:", prompt the user to choose between the two if
(SIM ISO country code)and(signal country code)don't match and libphonenumber thinks they both could be valid. I know adding extra UI should be a last resort, but I think this is a better user experience than guessing and getting it wrong - and most users will never see the prompt.
Happy to code & send a PR for either/both parts if there's an chance it could be acceptable:
The other possibility is changing AOSP Dialer so ACTION_SENDTO always builds an E164 number for the smsto: URI, but I suspect many apps display non-E164 numbers verbatim so this may be a fiddly change for Android to make... And doesn't help existing versions or non-AOSP Dialers.
Thanks for all your work on Signal, it's a great app. :)
GitHub Issue Cleanup: See #7598 for more information.