Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

uk_mobile_format (1) Versions 1.0.0

Normalise UK phone numbers and check their Ofcom prefix before using them for SMS alerts or one-time codes

Policyfile
Berkshelf
Knife
cookbook 'uk_mobile_format', '~> 1.0.0', :supermarket
cookbook 'uk_mobile_format', '~> 1.0.0'
knife supermarket install uk_mobile_format
knife supermarket download uk_mobile_format
README
Dependencies
Changelog

uk_mobile_format

A small Chef cookbook for checking UK phone numbers before they end up in
an alerting config. It normalises whatever a person typed (07700 900123,
+44 (0)7700 900123, 0044 7700-900-123) to E.164 and tells you which
Ofcom prefix block the number is in, so a landline, a 070 forwarding
number or a premium-rate number in your on-call list is caught by the
Chef run instead of during an incident.

Why "starts with 07" is not a good enough check

The 07 block in the Ofcom National Telephone Numbering Plan is split:

Prefix Allocated for
071–075, 077–079 Standard mobile. Always 11 digits: 07xxx xxxxxx, or +44 7xxx xxxxxx
07624 Isle of Man mobile (treated as a mobile here)
070 Personal numbering: a forwarding number, not a mobile. SMS often fails
076 (except 07624) Radiopaging

Outside 07: 01/02 are geographic landlines, 03 non-geographic
landline-rate, 05 corporate (often VoIP), 08 freephone/special rate and
09 premium rate. None of these will reliably receive a text.

Usage

Library (recipes, custom resources, anywhere)

UkMobileFormat::UkNumber.international('07700 900123')     # => "+447700900123"
UkMobileFormat::UkNumber.kind('020 7946 0000')             # => :geographic
UkMobileFormat::UkNumber.standard_mobile?('+44 7700 900123') # => true
UkMobileFormat::UkNumber.sms_reject_reason('0808 157 0000')
# => "08 is freephone or special-rate"   (nil means the prefix looks fine)

Inside recipes and resources the module is also available as uk_number.

Recipe uk_mobile_format::default

Checks node['uk_mobile_format']['numbers'] and logs a warning for every
number SMS will probably not reach. Set node['uk_mobile_format']['strict']
to true to fail the run instead.

default['uk_mobile_format']['numbers'] = ['07700 900123', '020 7946 0000']
default['uk_mobile_format']['strict']  = true

Resource uk_mobile_format_sms_contacts

Writes a file of E.164 numbers, one per line, for smstools, a Twilio or
Vonage notifier, or any script that sends alert texts. Numbers without a
standard mobile prefix are skipped with a warning, or fail the run with
strict true.

uk_mobile_format_sms_contacts '/etc/alerting/sms_contacts' do
  numbers ['07700 900123', '+44 (0)7700 900456', '0306 999 0000']
  strict  false
  mode    '0640'
end

What it cannot tell you

It is a format and prefix check only. It does not query a network, so it
cannot tell whether a number is in service, whether it has been ported,
or whether a mobile-looking +44 7… number is actually delivered over
VoIP. Many sign-up and verification services reject virtual numbers even
when the prefix looks right, so treat standard_mobile? as necessary, not
sufficient.

If what you need is a number rather than a validator, for example an
anonymous UK phone number to keep
your personal SIM out of app sign-ups, Ghost SIMs rents real +44 7 mobile
numbers that receive SMS verification codes into a private inbox.

Tests

ruby test/unit/uk_number_test.rb (minitest, no Chef needed). Every test
number is from Ofcom's drama ranges, which are reserved and never issued:
mobile 07700 900000–900999, London 020 7946 0000–0999,
0306 999 0xxx, 0808 157 0xxx and 0909 879 0xxx. 070 and 076 have
no drama range, so those tests use all-zero digits.

Licence

MIT. Copyright 2026 Ghost SIMs.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

uk_mobile_format changelog

1.0.0 (2026-11-24)

  • First release: UkMobileFormat::UkNumber library, default recipe and uk_mobile_format_sms_contacts resource.
Copyright © 2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.

Progress and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries.
See Trademarksfor appropriate markings. All rights in any other trademarks contained herein are reserved by their respective owners and their inclusion does not imply an endorsement, affiliation, or sponsorship as between Progress and the respective owners.

Code of Conduct Terms and Conditions of Use Privacy Policy Cookie Policy Trademark Policy Status