Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package twilio-utils for openSUSE:Factory 
checked in at 2021-06-11 00:19:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/twilio-utils (Old)
 and      /work/SRC/openSUSE:Factory/.twilio-utils.new.32437 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "twilio-utils"

Fri Jun 11 00:19:15 2021 rev:10 rq:899094 version:1.2.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/twilio-utils/twilio-utils.changes        
2020-03-18 12:47:10.557022367 +0100
+++ /work/SRC/openSUSE:Factory/.twilio-utils.new.32437/twilio-utils.changes     
2021-06-11 00:19:44.473428203 +0200
@@ -1,0 +2,7 @@
+Thu Jun  3 16:40:42 UTC 2021 - Archie Cobbs <archie.co...@gmail.com>
+
+- Upgrade to release 1.2.1
+  + Avoid "normalization" of numbers already in E.164 format
+  + Added specific SID mode to twils(1)
+
+-------------------------------------------------------------------

Old:
----
  twilio-utils-1.2.0.tar.gz

New:
----
  twilio-utils-1.2.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ twilio-utils.spec ++++++
--- /var/tmp/diff_new_pack.Ce3Zak/_old  2021-06-11 00:19:44.825428815 +0200
+++ /var/tmp/diff_new_pack.Ce3Zak/_new  2021-06-11 00:19:44.829428822 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package twilio-utils
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 # Copyright 2013 Archie L. Cobbs <arc...@dellroad.org>
 #
 # All modifications and additions to the file contributed by third parties
@@ -22,7 +22,7 @@
 %define defaultconf %{_sysconfdir}/twilio.conf
 
 Name:           twilio-utils
-Version:        1.2.0
+Version:        1.2.1
 Release:        0
 Summary:        Command line utilities for Twilio users
 License:        Apache-2.0

++++++ twilio-utils-1.2.0.tar.gz -> twilio-utils-1.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/CHANGES 
new/twilio-utils-1.2.1/CHANGES
--- old/twilio-utils-1.2.0/CHANGES      2020-03-02 22:25:35.000000000 +0100
+++ new/twilio-utils-1.2.1/CHANGES      2021-06-03 18:36:33.000000000 +0200
@@ -1,3 +1,8 @@
+Version 1.2.1 Released June 3, 2021
+
+    - Avoid "normalization" of numbers already in E.164 format
+    - Added specific SID mode to twils(1)
+
 Version 1.2.0 Released March 2, 2020
 
     - Added new twils(1) and twirm(1) utilities
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/configure 
new/twilio-utils-1.2.1/configure
--- old/twilio-utils-1.2.0/configure    2020-03-02 22:26:59.000000000 +0100
+++ new/twilio-utils-1.2.1/configure    2021-06-03 18:37:30.000000000 +0200
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for twilio-utils - Command line utilities for 
Twilio users 1.2.0.
+# Generated by GNU Autoconf 2.69 for twilio-utils - Command line utilities for 
Twilio users 1.2.1.
 #
 # Report bugs to <https://github.com/archiecobbs/twilio-utils>.
 #
@@ -580,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='twilio-utils - Command line utilities for Twilio users'
 PACKAGE_TARNAME='twilio-utils'
-PACKAGE_VERSION='1.2.0'
-PACKAGE_STRING='twilio-utils - Command line utilities for Twilio users 1.2.0'
+PACKAGE_VERSION='1.2.1'
+PACKAGE_STRING='twilio-utils - Command line utilities for Twilio users 1.2.1'
 PACKAGE_BUGREPORT='https://github.com/archiecobbs/twilio-utils'
 PACKAGE_URL=''
 
@@ -1282,7 +1282,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures twilio-utils - Command line utilities for Twilio users 
1.2.0 to adapt to many kinds of systems.
+\`configure' configures twilio-utils - Command line utilities for Twilio users 
1.2.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1348,7 +1348,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of twilio-utils - Command line 
utilities for Twilio users 1.2.0:";;
+     short | recursive ) echo "Configuration of twilio-utils - Command line 
utilities for Twilio users 1.2.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1440,7 +1440,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-twilio-utils - Command line utilities for Twilio users configure 1.2.0
+twilio-utils - Command line utilities for Twilio users configure 1.2.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1742,7 +1742,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by twilio-utils - Command line utilities for Twilio users 
$as_me 1.2.0, which was
+It was created by twilio-utils - Command line utilities for Twilio users 
$as_me 1.2.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2605,7 +2605,7 @@
 
 # Define the identity of the package.
  PACKAGE='twilio-utils'
- VERSION='1.2.0'
+ VERSION='1.2.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -5431,7 +5431,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by twilio-utils - Command line utilities for Twilio 
users $as_me 1.2.0, which was
+This file was extended by twilio-utils - Command line utilities for Twilio 
users $as_me 1.2.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5497,7 +5497,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-twilio-utils - Command line utilities for Twilio users config.status 1.2.0
+twilio-utils - Command line utilities for Twilio users config.status 1.2.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/configure.ac 
new/twilio-utils-1.2.1/configure.ac
--- old/twilio-utils-1.2.0/configure.ac 2020-03-02 22:25:49.000000000 +0100
+++ new/twilio-utils-1.2.1/configure.ac 2021-06-03 18:36:40.000000000 +0200
@@ -16,7 +16,7 @@
 # under the License.
 #
 
-AC_INIT([twilio-utils - Command line utilities for Twilio users], [1.2.0], 
[https://github.com/archiecobbs/twilio-utils], [twilio-utils])
+AC_INIT([twilio-utils - Command line utilities for Twilio users], [1.2.1], 
[https://github.com/archiecobbs/twilio-utils], [twilio-utils])
 AC_CONFIG_AUX_DIR(scripts)
 AM_INIT_AUTOMAKE
 dnl AM_MAINTAINER_MODE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/raw-result.xsl 
new/twilio-utils-1.2.1/raw-result.xsl
--- old/twilio-utils-1.2.0/raw-result.xsl       2020-03-01 21:01:41.000000000 
+0100
+++ new/twilio-utils-1.2.1/raw-result.xsl       2021-03-29 17:58:30.000000000 
+0200
@@ -9,6 +9,9 @@
     <xsl:template match="/">
         <Messages>
             <xsl:choose>
+                <xsl:when test="TwilioResponse/Message">
+                    <xsl:apply-templates select="TwilioResponse/Message"/>
+                </xsl:when>
                 <xsl:when test="$limit != ''">
                     <xsl:apply-templates 
select="TwilioResponse/Messages/Message[position() &lt;= $limit]"/>
                 </xsl:when>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/result.xsl 
new/twilio-utils-1.2.1/result.xsl
--- old/twilio-utils-1.2.0/result.xsl   2020-03-01 20:47:58.000000000 +0100
+++ new/twilio-utils-1.2.1/result.xsl   2021-03-29 18:12:49.000000000 +0200
@@ -12,7 +12,14 @@
                 <xsl:apply-templates select="TwilioResponse/RestException"/>
             </xsl:when>
             <xsl:when test="TwilioResponse/Message">
-                <xsl:value-of select="concat(TwilioResponse/Message/Sid, 
'&#10;')"/>
+                <xsl:choose>
+                    <xsl:when test="$lsop = 'count'">
+                        <xsl:value-of select="'1&#10;'"/>
+                    </xsl:when>
+                    <xsl:when test="$lsop = 'sids'">
+                        <xsl:apply-templates select="TwilioResponse/Message" 
mode="sid"/>
+                    </xsl:when>
+                </xsl:choose>
             </xsl:when>
             <xsl:when test="TwilioResponse/Messages">
                 <xsl:choose>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/twils new/twilio-utils-1.2.1/twils
--- old/twilio-utils-1.2.0/twils        2020-03-02 22:27:07.000000000 +0100
+++ new/twilio-utils-1.2.1/twils        2021-06-03 18:37:48.000000000 +0200
@@ -18,8 +18,10 @@
 # Usage message
 usage()
 {
-    echo "This command outputs the SID's of all matching SMS messages." 1>&2
-    echo "Usage: ${NAME} [options]" 1>&2
+    echo "This command outputs the SID's or raw XML for all matching SMS 
messages." 1>&2
+    echo "Usage:" 1>&2
+    echo "    ${NAME} [options]" 1>&2
+    echo "    ${NAME} [options] SID" 1>&2
     echo "Options:" 1>&2
     echo "    -C curlflag       Pass curlflag to curl(1)" 1>&2
     echo "    -c file           Specify config file (default 
\"${DEFAULT_CONFIG_FILE}\")" 1>&2
@@ -33,14 +35,22 @@
     echo "    -P                Ask for auth token from the terminal" 1>&2
     echo "    -p auth-token     Specify auth token (default read AUTH_TOKEN 
from config file)" 1>&2
     echo "    -u account-sid    Specify Account SID (default read ACCOUNT_SID 
from config file)" 1>&2
+    echo "Number, date, page, and limit options are only valid with the first 
form." 1>&2
 }
 
 # Function to normalize a phone number to the way Twilio likes it
 normalize()
 {
+    # If already in E.164 format, then leave it alone
+    if [[ "${1}" =~ ^\+ ]]; then
+        echo "${1}"
+        return
+    fi
+
+    # Clean up NANP numbers
     echo ${1+"$@"} | sed -r \
       -e 's/[^0-9]//g' \
-      -e 's/^1?([0-9]{10})$/+1\1/g'
+      -e 's/^1?([2-9][0-9]{2}[2-9][0-9]{2}[0-9]{4})$/+1\1/g'
 }
 
 # Parse flags passed in on the command line
@@ -128,15 +138,33 @@
             ;;
     esac
 done
+
+# Get specific message SID, if any
+MESSAGE_SID=""
 case "${#}" in
     0)
         ;;
     *)
+        MESSAGE_SID="${1}"
+        ;;
+    *)
         usage
         exit 1
         ;;
 esac
 
+# Sanity check specific message SID
+if [ -n "${MESSAGE_SID}" ]; then
+    if ! [[ "${MESSAGE_SID}" =~ ^SM[[:xdigit:]]{32}$ ]]; then
+        echo "${NAME}: invalid message SID \"${MESSAGE_SID}\"" 1>&2
+        exit 1
+    fi
+    if [ -n "${FROM_NUMBER}" -o -n "${TO_NUMBER}" -o -n "${MIN_DATE}" -o -n 
"${MAX_DATE}" -o -n "${LIMIT}" ]; then
+        usage
+        exit 1
+    fi
+fi
+
 # Ensure config file is readable; if not, then what we need must be provided 
on the command line
 if ! test -r "${CONFIG_FILE}"; then
     if test -z "${OVERRIDE_ACCOUNT_SID}" -o -z "${OVERRIDE_AUTH_TOKEN}"; then
@@ -214,20 +242,24 @@
 
 # Build initial URL
 URL="`echo ${BASE_URL} | sed 's|/$||g'`""`eval echo ${MESSAGES_PATH}`"
-PARAMS="PageSize=${PAGE_SIZE}"
-if [ -n "${FROM_NUMBER}" ]; then
-    PARAMS="${PARAMS}&From=${FROM_NUMBER}"
-fi
-if [ -n "${TO_NUMBER}" ]; then
-    PARAMS="${PARAMS}&From=${TO_NUMBER}"
-fi
-if [ -n "${MIN_DATE}" ]; then
-    PARAMS="${PARAMS}&DateSent%3E=${MIN_DATE}"
-fi
-if [ -n "${MAX_DATE}" ]; then
-    PARAMS="${PARAMS}&DateSent%3C=${MAX_DATE}"
+if [ -z "${MESSAGE_SID}" ]; then
+    PARAMS="PageSize=${PAGE_SIZE}"
+    if [ -n "${FROM_NUMBER}" ]; then
+        PARAMS="${PARAMS}&From=${FROM_NUMBER}"
+    fi
+    if [ -n "${TO_NUMBER}" ]; then
+        PARAMS="${PARAMS}&From=${TO_NUMBER}"
+    fi
+    if [ -n "${MIN_DATE}" ]; then
+        PARAMS="${PARAMS}&DateSent%3E=${MIN_DATE}"
+    fi
+    if [ -n "${MAX_DATE}" ]; then
+        PARAMS="${PARAMS}&DateSent%3C=${MAX_DATE}"
+    fi
+    URL="${URL}?${PARAMS}"
+else
+    URL="${URL}/${MESSAGE_SID}"
 fi
-URL="${URL}?${PARAMS}"
 
 # Read pages of results
 FIRST_PAGE="true"
@@ -308,6 +340,11 @@
         fi
     fi
 
+    # If getting specific message by SID, bail out here
+    if [ -n "${MESSAGE_SID}" ]; then
+        break
+    fi
+
     # Get next page URI
     "${XSLTPROC}" --stringparam lsop next "${RESULT_XSL}" "${RESPONSE_FILE}" > 
"${ERROR_FILE}" 2>&1
     if [ $? -ne 0 ]; then
@@ -333,4 +370,3 @@
 
 # Done
 exit 0
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/twils.1.in 
new/twilio-utils-1.2.1/twils.1.in
--- old/twilio-utils-1.2.0/twils.1.in   2020-02-27 23:50:18.000000000 +0100
+++ new/twilio-utils-1.2.1/twils.1.in   2021-03-29 18:01:59.000000000 +0200
@@ -24,6 +24,9 @@
 .Nm twils
 .Bk -words
 .Op Fl c Ar config-file
+.Op Fl u Ar account-sid
+.Op Fl p Ar auth-token
+.Op Fl P
 .Op Fl C Ar curl-flag
 .Op Fl \-from Ar number
 .Op Fl \-to Ar number
@@ -32,9 +35,15 @@
 .Op Fl \-limit Ar num
 .Op Fl \-pageSize Ar size
 .Op Fl \-raw
+.Nm twils
+.Bk -words
+.Op Fl c Ar config-file
 .Op Fl u Ar account-sid
 .Op Fl p Ar auth-token
 .Op Fl P
+.Op Fl C Ar curl-flag
+.Op Fl \-raw
+.Ar SID
 .Ek
 .Sh DESCRIPTION
 .Nm
@@ -43,6 +52,8 @@
 resources from the Twilio REST API and prints their message SID's to standard 
output.
 .Pp
 Messages are returned in reverse chronological order.
+.Pp
+In the second form, the SID of one specific message is given.
 .Sh OPTIONS
 .Bl -tag -width Ds
 .It Fl c
@@ -70,10 +81,10 @@
 Restrict to messages sent to the specified phone number (must be in E.164 
format) or 5 or 6 digit short code.
 .It Fl \-minDate
 Restrict to messages sent on or after the specified date, which must be in the 
form
-.PA YYY-MM-DD .
+.Pa YYY-MM-DD .
 .It Fl \-maxDate
 Restrict to messages sent on or before the specified date, which must be in 
the form
-.PA YYY-MM-DD .
+.Pa YYY-MM-DD .
 .It Fl \-limit
 Return at most
 .Ar num
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/twils.in 
new/twilio-utils-1.2.1/twils.in
--- old/twilio-utils-1.2.0/twils.in     2020-03-01 21:06:20.000000000 +0100
+++ new/twilio-utils-1.2.1/twils.in     2021-03-29 18:04:48.000000000 +0200
@@ -18,8 +18,10 @@
 # Usage message
 usage()
 {
-    echo "This command outputs the SID's of all matching SMS messages." 1>&2
-    echo "Usage: ${NAME} [options]" 1>&2
+    echo "This command outputs the SID's or raw XML for all matching SMS 
messages." 1>&2
+    echo "Usage:" 1>&2
+    echo "    ${NAME} [options]" 1>&2
+    echo "    ${NAME} [options] SID" 1>&2
     echo "Options:" 1>&2
     echo "    -C curlflag       Pass curlflag to curl(1)" 1>&2
     echo "    -c file           Specify config file (default 
\"${DEFAULT_CONFIG_FILE}\")" 1>&2
@@ -33,14 +35,22 @@
     echo "    -P                Ask for auth token from the terminal" 1>&2
     echo "    -p auth-token     Specify auth token (default read AUTH_TOKEN 
from config file)" 1>&2
     echo "    -u account-sid    Specify Account SID (default read ACCOUNT_SID 
from config file)" 1>&2
+    echo "Number, date, page, and limit options are only valid with the first 
form." 1>&2
 }
 
 # Function to normalize a phone number to the way Twilio likes it
 normalize()
 {
+    # If already in E.164 format, then leave it alone
+    if [[ "${1}" =~ ^\+ ]]; then
+        echo "${1}"
+        return
+    fi
+
+    # Clean up NANP numbers
     echo ${1+"$@"} | sed -r \
       -e 's/[^0-9]//g' \
-      -e 's/^1?([0-9]{10})$/+1\1/g'
+      -e 's/^1?([2-9][0-9]{2}[2-9][0-9]{2}[0-9]{4})$/+1\1/g'
 }
 
 # Parse flags passed in on the command line
@@ -128,15 +138,33 @@
             ;;
     esac
 done
+
+# Get specific message SID, if any
+MESSAGE_SID=""
 case "${#}" in
     0)
         ;;
     *)
+        MESSAGE_SID="${1}"
+        ;;
+    *)
         usage
         exit 1
         ;;
 esac
 
+# Sanity check specific message SID
+if [ -n "${MESSAGE_SID}" ]; then
+    if ! [[ "${MESSAGE_SID}" =~ ^SM[[:xdigit:]]{32}$ ]]; then
+        echo "${NAME}: invalid message SID \"${MESSAGE_SID}\"" 1>&2
+        exit 1
+    fi
+    if [ -n "${FROM_NUMBER}" -o -n "${TO_NUMBER}" -o -n "${MIN_DATE}" -o -n 
"${MAX_DATE}" -o -n "${LIMIT}" ]; then
+        usage
+        exit 1
+    fi
+fi
+
 # Ensure config file is readable; if not, then what we need must be provided 
on the command line
 if ! test -r "${CONFIG_FILE}"; then
     if test -z "${OVERRIDE_ACCOUNT_SID}" -o -z "${OVERRIDE_AUTH_TOKEN}"; then
@@ -214,20 +242,24 @@
 
 # Build initial URL
 URL="`echo ${BASE_URL} | sed 's|/$||g'`""`eval echo ${MESSAGES_PATH}`"
-PARAMS="PageSize=${PAGE_SIZE}"
-if [ -n "${FROM_NUMBER}" ]; then
-    PARAMS="${PARAMS}&From=${FROM_NUMBER}"
-fi
-if [ -n "${TO_NUMBER}" ]; then
-    PARAMS="${PARAMS}&From=${TO_NUMBER}"
-fi
-if [ -n "${MIN_DATE}" ]; then
-    PARAMS="${PARAMS}&DateSent%3E=${MIN_DATE}"
-fi
-if [ -n "${MAX_DATE}" ]; then
-    PARAMS="${PARAMS}&DateSent%3C=${MAX_DATE}"
+if [ -z "${MESSAGE_SID}" ]; then
+    PARAMS="PageSize=${PAGE_SIZE}"
+    if [ -n "${FROM_NUMBER}" ]; then
+        PARAMS="${PARAMS}&From=${FROM_NUMBER}"
+    fi
+    if [ -n "${TO_NUMBER}" ]; then
+        PARAMS="${PARAMS}&From=${TO_NUMBER}"
+    fi
+    if [ -n "${MIN_DATE}" ]; then
+        PARAMS="${PARAMS}&DateSent%3E=${MIN_DATE}"
+    fi
+    if [ -n "${MAX_DATE}" ]; then
+        PARAMS="${PARAMS}&DateSent%3C=${MAX_DATE}"
+    fi
+    URL="${URL}?${PARAMS}"
+else
+    URL="${URL}/${MESSAGE_SID}"
 fi
-URL="${URL}?${PARAMS}"
 
 # Read pages of results
 FIRST_PAGE="true"
@@ -308,6 +340,11 @@
         fi
     fi
 
+    # If getting specific message by SID, bail out here
+    if [ -n "${MESSAGE_SID}" ]; then
+        break
+    fi
+
     # Get next page URI
     "${XSLTPROC}" --stringparam lsop next "${RESULT_XSL}" "${RESPONSE_FILE}" > 
"${ERROR_FILE}" 2>&1
     if [ $? -ne 0 ]; then
@@ -333,4 +370,3 @@
 
 # Done
 exit 0
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/twimsg 
new/twilio-utils-1.2.1/twimsg
--- old/twilio-utils-1.2.0/twimsg       2020-03-02 22:27:07.000000000 +0100
+++ new/twilio-utils-1.2.1/twimsg       2021-06-03 18:37:48.000000000 +0200
@@ -39,9 +39,16 @@
 # Function to normalize a phone number to the way Twilio likes it
 normalize()
 {
+    # If already in E.164 format, then leave it alone
+    if [[ "${1}" =~ ^\+ ]]; then
+        echo "${1}"
+        return
+    fi
+
+    # Clean up NANP numbers
     echo ${1+"$@"} | sed -r \
       -e 's/[^0-9]//g' \
-      -e 's/^1?([0-9]{10})$/+1\1/g'
+      -e 's/^1?([2-9][0-9]{2}[2-9][0-9]{2}[0-9]{4})$/+1\1/g'
 }
 
 # Parse flags passed in on the command line
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/twimsg.1.in 
new/twilio-utils-1.2.1/twimsg.1.in
--- old/twilio-utils-1.2.0/twimsg.1.in  2020-02-27 22:50:07.000000000 +0100
+++ new/twilio-utils-1.2.1/twimsg.1.in  2021-03-29 17:50:31.000000000 +0200
@@ -49,7 +49,8 @@
 flag is used.
 .Pp
 Phone numbers must be specified in E.164 format, i.e., with a leading plus 
sign and followed by the country code,
-or as a 5 or 6 digit short code.
+or else as a 5 or 6 digit short code.
+As a special case, valid North American (NANP) phone numbers may omit the 
leading +1 and contain extra characters.
 .Pp
 The input is automatically truncated at the point at which it would exceed
 .Ar limit
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/twimsg.in 
new/twilio-utils-1.2.1/twimsg.in
--- old/twilio-utils-1.2.0/twimsg.in    2020-02-28 03:55:41.000000000 +0100
+++ new/twilio-utils-1.2.1/twimsg.in    2021-03-29 17:50:31.000000000 +0200
@@ -39,9 +39,16 @@
 # Function to normalize a phone number to the way Twilio likes it
 normalize()
 {
+    # If already in E.164 format, then leave it alone
+    if [[ "${1}" =~ ^\+ ]]; then
+        echo "${1}"
+        return
+    fi
+
+    # Clean up NANP numbers
     echo ${1+"$@"} | sed -r \
       -e 's/[^0-9]//g' \
-      -e 's/^1?([0-9]{10})$/+1\1/g'
+      -e 's/^1?([2-9][0-9]{2}[2-9][0-9]{2}[0-9]{4})$/+1\1/g'
 }
 
 # Parse flags passed in on the command line
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/twiping 
new/twilio-utils-1.2.1/twiping
--- old/twilio-utils-1.2.0/twiping      2020-03-02 22:27:07.000000000 +0100
+++ new/twilio-utils-1.2.1/twiping      2021-06-03 18:37:48.000000000 +0200
@@ -45,9 +45,16 @@
 # Function to normalize a phone number to the way Twilio likes it
 normalize()
 {
+    # If already in E.164 format, then leave it alone
+    if [[ "${1}" =~ ^\+ ]]; then
+        echo "${1}"
+        return
+    fi
+
+    # Clean up NANP numbers
     echo ${1+"$@"} | sed -r \
       -e 's/[^0-9]//g' \
-      -e 's/^1?([0-9]{10})$/+1\1/g'
+      -e 's/^1?([2-9][0-9]{2}[2-9][0-9]{2}[0-9]{4})$/+1\1/g'
 }
 
 # Parse a timestamp and print the result in UTC:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/twilio-utils-1.2.0/twiping.in 
new/twilio-utils-1.2.1/twiping.in
--- old/twilio-utils-1.2.0/twiping.in   2020-02-28 03:57:13.000000000 +0100
+++ new/twilio-utils-1.2.1/twiping.in   2021-03-29 17:50:31.000000000 +0200
@@ -45,9 +45,16 @@
 # Function to normalize a phone number to the way Twilio likes it
 normalize()
 {
+    # If already in E.164 format, then leave it alone
+    if [[ "${1}" =~ ^\+ ]]; then
+        echo "${1}"
+        return
+    fi
+
+    # Clean up NANP numbers
     echo ${1+"$@"} | sed -r \
       -e 's/[^0-9]//g' \
-      -e 's/^1?([0-9]{10})$/+1\1/g'
+      -e 's/^1?([2-9][0-9]{2}[2-9][0-9]{2}[0-9]{4})$/+1\1/g'
 }
 
 # Parse a timestamp and print the result in UTC:

Reply via email to