This module will be used by gateway modules to validate international numbers that users input. It should provide a CRUD interface that allows admins to add, remove, edit, enable, and disable individual countries.

Right now users must enter their full international phone number and select their country. We validate the number they provided against the format for the country they provided. Other sites like Twitter don’t have this country drop down. They only ask for a number. We’d like to do this as well.

Comments

aspope’s picture

Will, are you thinking that number validation could be done based on the user's current country? (as reported by Country Code module or similar).

So, it would take numbers like "+447712123123", "00447712123123", "07712123123", "7712123123" and try to format them correctly using some common logic and some country-specific rules.

  1. Strip any separator characters ("-", ".", " ", etc), but do not strip "+" yet.
  2. Format the number:
    1. If a "+" exists first, then assume a fully-qualified international number.
    2. If an international dialling prefix exists (eg: "00") then it needs to separate the prefix (based on current country) from the international number.
    3. If a local dialling prefix exists (eg: "0") then separate this prefix (based on current country) and prepend the country code.
    4. If just a local number is specified, then try to establish whether we can handle it based on the current country rules.
  3. Strip all non-numeric characters including "+".
  4. Return international format number, eg: 447712123123
mfb’s picture

What's the current status/plans for international number validation? I saw that sms_international module was added and then removed.

Will White’s picture

Issue tags: +international

Hi mfb,
The sms_international module still exists in the 2.0 branch. Completing a plan for this module and executing it should eliminate several issues and points of confusion with international number handling.

patrickharris’s picture

The function sms_formatter kills a lot of New Zealand numbers when it returns FALSE if the number is < 9. I needed to change this to < 7 to work for me. Also, by returning FALSE, it merely kills the number (the number that is then sent is just the country code).

fw_crocodile’s picture

It seems to me that international number validation didn't really worth the work needed.

Isn't sufficient to ask the user to insert the number without international prefix and select the country?

The user should know what it is typing and the module will easily add the country code based on the selected country.

momardieng’s picture

Hello,

Thanks for the great module! I have a related issue/question: how can I bulk-sms to users in different countries? The current setup I have for bulk-sms uses a view, and you still have to pick a single country which makes it impossible to bulk-sms to an international list. Is there a simple way around this? Thanks a lot.

batje’s picture

@momardieng

If you store numbers as starting with country-code, you could use my just released patch http://drupal.org/node/674896 and SMSBulk to do this.
Create a view and filter the mobile number on the leading 2 or 3 characters (that should be the country code)

aspope’s picture

Version: 6.x-1.0-beta1 » 6.x-1.x-dev
Component: Miscellaneous » New module or gateway
Assigned: Unassigned » aspope
Status: Active » Needs review

Hi all,

Please checkout the current 6.x-1.x-dev release that includes the sms_valid module.

This number Validation module allows you to configure prefixes that can be allowed or denied. You can arrange these "rulesets" by country or whatever you wish.

Please give it a try and post some feedback. Cheers!

lhernon’s picture

I am trying to get SMS working for Guatemalan mobile numbers. I was able to navigate the Validation module pretty easily (especially after installing the services modules), and validated a sample number.

Now, I would like to formally test the number on an actual Guatemalan phone (from the US). It seems that I need to now use the Devel module to test out the number. Where I am confused is when I select the carrier. I selected my country, but the carrier menu still reflects American carriers. Is there somewhere that I should enter the three Guatemalan carriers?

Thanks a ton for your hard work. I'll be so excited *when* I get this working!

Laura

univate’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
modreoci’s picture

Component: New module or gateway » Core Framework
Category: feature » bug

I cannot find any form in administration menu to setup validation for international numbers (e.g. Slovakia, Czech rep...).

Thera are 3-digits international (country) code and 9-digits local numbers (without leading zero). I tried to fix it manually in DB in the "sms_international" table by the example from default existing rows (es, gb, us), but it does not work. When I am entering 9-digits number (without leading zero) and selecting Slovakia from the option box, there is still error message: "Please enter a valid phone number". It still expects 10-digits local number. When I put there any 10-digits number (with leading zero) it works correctly. But it does not work when I am trying to enter my mobile number during the new user registration. My mobile data are written into the table "users" only, not into the table "sms_user", where the confirmation routine expects it. It means the confirmation code is not sent to me to confirm my mobile number.

My gateway is Clickatell Please help!

univate’s picture

Component: Core Framework » New module or gateway
Category: bug » feature
almaudoh’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Assigned: aspope » almaudoh
Issue summary: View changes
Status: Needs review » Active

SMS International was developed but is not yet completed. Will look into providing simple validation using international number prefixes.

almaudoh’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Issue tags: +Needs backport to D7
Related issues: +#2642946: Utilize LibPhonenumber for phone number validation

Moving all feature requests to 8.x-1.x, and adding 'needs backport' tag.

Also there is a related issue in D8 queue of using LibPhonenumber library which would provide most of these features.

dpi’s picture

Component: New module or gateway » Documentation
Assigned: almaudoh » Unassigned

Telephone Validation has proven to work well with telephone fields, which we support as a first class telephone storage. Its dependent library, libphonenumber, remains actively maintained.

Telephone Validation also has a Drupal 7 branch.

Closing this ticket as a result, with gratitude to @zaporylie.

dpi’s picture

Status: Active » Closed (won't fix)
Issue tags: -Needs backport to D7