daddyz/phonelib

Validation does not support landline numbers

Closed this issue · 5 comments

I have tried to validate only landline number, using:

  validates :phone_number, phone: { possible: true, types: [:landline] }

and I'm trying to validate this landline number 1-415-509-6995, but it gives me invalid phone number

Just noticed that I was using the wrong type, it should be :fixed_line not :landline

But it's still weird that a landline number is treated as a mobile number

  validates :phone_number, phone: { possible: true, types: [:mobile] }

(415) 509-6995 is still valid although it's landline

Also it's not returning the carrier

>> Phonelib.parse('(415) 509-6995').carrier
=> nil

@shqear93 sorry for really late response, as I know US numbering plan always resolved to fixed_or_mobile since there is no real option to differentiate fixed and mobile phone numbers. Libphonenumber uses this specia fixed_or_mobile in order to overcome this issue. And regarding carrier, it is taken from opensource DB, that may miss data.

@daddyz thanks for your response, is there an option to set list of allowed types for each whitelisted country ?

@shqear93 No, currently there is no such option