Identify phone type (landline/mobile)

Asked

Viewed 1,790 times

-4

Would someone know if it is possible to identify the type of the phone (landline/cell phone) through the first digit?

For example, is the number 6889-7777 fixed or mobile? I need to identify the type of phone before the user finishes filling it completely.

Any hint?

  • Dude, I don’t understand your question. The 9th digit only exists for cell phone numbers.

  • @jbueno the doubt is whether I can identify the type of the phone by the first number, for example numbers started with 9 are mobile phones, numbers started with 3 are fixed, understood ?

  • Not all cell phones start with 9, several operators start with 8.. You can’t guarantee this

  • 1

    Yes, you can do it.

  • You want to know how to do it in the code?

  • @leofontes, it was exactly this the doubt, whether I can or not, by the answers seems very contradictory.

  • @Bacco, I changed the question, I think it’s clearer now =]

  • 1

    @Douglasneves is giving a clean in the comments above. Well, for Brazil, as I said, if you start with 9 is cellular. This is standard now. If you have a region that has not yet migrated, it is only a matter of a few months.

  • @Bacco, Rigadão for the tip

  • @jbueno, I edited the question I think was clearer now, I needed to identify if there is any pattern already defined to type the numbers through the first digit.

  • @Bacco Last week was the last region. Now it’s all over the country.

  • 1

    @Douglasneves Like Bacco said. If you start with 9, it’s cellular. Of course that can change, but there’s another story

  • 1

    @leofontes With the new standard, all mobile numbers start with 9

Show 8 more comments

1 answer

2


If you need to validate current numbers:
- starting with 9 would be mobile
- 7 is Nextel (another "type" of mobile)
- the rest would be fixed

If you need to treat history, it depends on the period you have stored, but in a generic way it would be:
- first digit > 5 is mobile
- first digit < 5 is fixed
- first digit = 5 can be fixed or mobile
This last scenario is due to the fact that at a certain moment, before the implantation of the ninth digit, Anatel released the use of numbers initiated by 5 to the mobile network, and there were already fixed started by 5 (most scenarios in SP)

  • I ended up using this lib for a more complete solution =] https://github.com/googlei18n/libphonenumber

Browser other questions tagged

You are not signed in. Login or sign up in order to post.