Closed Bug 1039444 Opened 10 years ago Closed 10 years ago

Unable to make calls without prefix

Categories

(Hello (Loop) :: Server, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: fjcs, Unassigned)

References

Details

(Whiteboard: [loop server][blocking])

Attachments

(2 files)

User A registers in Loop with her phone number using prefix (i.e. +34). User B has User A in her phonebook without the international prefix, OR with prefix using double 0 (i.e. 0034). When User B tries to call User A, Loop interprets the number as a new one, and offers a new URL to contact her, instead of matching the already logged user.

Tested with Loop commit: cae484ed0c02a74c59d36c55e6798be120ad22d2
Blocks: 1036490
Whiteboard: [mobile app]
Assignee: nobody → ferjmoreno
Assignee: ferjmoreno → nobody
Component: Gaia::Loop → Server
Product: Firefox OS → Loop
I believe this should be a server side fix for a few reasons:

- We cannot really afford the memory overhead introduced by PhoneNumber.js [1] in the client.
- Fixing this issue in the server would solve it for all platforms (FxOS, Desktop and, eventually, Android and other mobile clients).
- The regular telephony network is the one responsible for adding the network prefix to phone numbers that doesn't already contain it, so it makes sense for Loop to do this in the server side as well.

In order to fix this on the server, we need to add the client MCC to the POST /calls/{token} and POST /calls API methods.

[1] https://github.com/andreasgal/PhoneNumber.js
Fernando, would this work better if we store and match the number with the double 0 all the time, for instance?
No what we need to do is to normalize all phone numbers to a MSISDN before doing the matching.

I am already using https://www.npmjs.org/package/phone for MSISDN to get a valid MSISDN number, but it needs the country letters so we need to have a table to get the country from the country code.
(In reply to Rémy Hubscher (:natim) from comment #3)
> No what we need to do is to normalize all phone numbers to a MSISDN before
> doing the matching.
> 

Exactly.

> I am already using https://www.npmjs.org/package/phone for MSISDN to get a
> valid MSISDN number, but it needs the country letters so we need to have a
> table to get the country from the country code.

I guess we can use the same table that we have for the MobileID client https://mxr.mozilla.org/gaia/source/shared/resources/mcc.json
I guess we can do that on the server side, yes.

I see some problems, though: how would the client know that the call is coming from an entry in their address book if the number is not the same? Solving this on the client side would help getting this easier, don't you think?
(In reply to Alexis Metaireau (:alexis) from comment #5)
> I see some problems, though: how would the client know that the call is
> coming from an entry in their address book if the number is not the same?
> Solving this on the client side would help getting this easier, don't you
> think?

I'm not sure where it lives, but the phone must have code for dealing with this somewhere. If you have anything other than a fully-qualified E.164 number in your address book, then the terminal must already deal with mapping from the full number to the address book entry.

In practice, this is a much easier problem to solve; using the MNC, you pull up the trunk code and exit code(s) for the country the SIM corresponds to, and strip these from the beginning of any numbers stored in the phone book. Then, you see which address book entry matches the end of the number you've received. It's nowhere near as complex as building up a full number from a partial address book entry.
(In reply to Alexis Metaireau (:alexis) from comment #5)
> I guess we can do that on the server side, yes.
> 
> I see some problems, though: how would the client know that the call is
> coming from an entry in their address book if the number is not the same?
> Solving this on the client side would help getting this easier, don't you
> think?

I think this is already handled by the Contacts API. We just need to use a "match" [1] filter instead of an "equal" filter for phone numbers.

[1] https://mxr.mozilla.org/mozilla-central/source/dom/contacts/fallback/ContactDB.jsm#1285
Ok so this means we should receive both the MCC and the number on the POST /calls endpoint?
Should we change https://wiki.mozilla.org/index.php?title=Loop/Architecture/MVP ?
I've made this change to the API: https://wiki.mozilla.org/Loop/Architecture/MVP#POST_.2Fcalls

I will implement a patch for it but feel free to improve it.
Attachment #8478972 - Flags: review?(alexis+bugs)
Whiteboard: [mobile app] → [loop server]
Status: NEW → ASSIGNED
Whiteboard: [loop server] → [loop server][blocking]
https://github.com/mozilla-services/loop-server/commit/6130408c9cb5c3eda14a03fe5f33b11531f42ccf
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Attachment #8478972 - Flags: review?(alexis+bugs) → review+
Attached file Link to Github PR
Attachment #8479787 - Flags: review?(tarek)
Comment on attachment 8479787 [details] [review]
Link to Github PR

+ minor nipick
Attachment #8479787 - Flags: review?(tarek) → review+
Version 0.11.0 is out in Production.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: