nyaruka / gocommon

Common utility library for the TextIt platform.
Other
7 stars 11 forks source link

+ is a valid phone numbers character #3

Closed norkans7 closed 6 years ago

norkans7 commented 6 years ago

This issue is causing to trim + on number(https://github.com/nyaruka/gocommon/blob/master/urns/urns.go#L289) and return the number missing the + when phonenumbers lib does not consider the number to be valid https://github.com/nyaruka/gocommon/blob/master/urns/urns.go#L305

https://github.com/nyaruka/gocommon/blob/master/urns/urns.go#L70

nicpottier commented 6 years ago

We add the plus immediately below. The logic here looks the same as RapidPro: https://github.com/nyaruka/rapidpro/blob/master/temba/contacts/models.py#L240

So I think the problem is likely not here, perhaps in phonenumbers?

nicpottier commented 6 years ago

That number passes in gophonenumbers parsing..

norkans7 commented 6 years ago

what do you mean?

nicpottier commented 6 years ago

It was passing the parsing but not the validity check. I updated the phonenumbers db in: https://github.com/nyaruka/phonenumbers/commit/9c5a28db50f85d24a31e1e9cebb6bff9f6671913

And it passes now. So we just need to update the vendored version.