Amazon buyer phone numbers with extensions break UPS labels
Amazon often gives the buyer's phone like this:
+1 346-307-9643 ext. 40882
That is 16 digits. UPS says:
When it fails matters
UPS does not refuse when the shipment is created. It refuses when you fetch the label file: the shipment exists, it is paid for, the tracking number is issued, and then there is no label to print.
Do not just cut it to 15 digits
1346307964340882 cut to 134630796434088 is 15 digits and passes validation, but it is someone else's number. If delivery goes wrong the driver calls a stranger.
The fix
Read from the first digit and stop at the first character that cannot be part of a number (ext., x and # all stop it naturally). Drop a leading country code 1 from 11 digits. If what is left is not 10 to 15 digits, use a placeholder. Keep the original number with its extension on the order: that is the one to call if the doorbell does not work.