From 11304dd4f8c0fe5f69e4431e692bcd71620a0b6e Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Fri, 24 Sep 2010 20:31:25 +0200 Subject: Fix lastservicephone(). shift after check. --- localkannel-dispatch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'localkannel-dispatch') diff --git a/localkannel-dispatch b/localkannel-dispatch index d034f53..e9564db 100755 --- a/localkannel-dispatch +++ b/localkannel-dispatch @@ -40,7 +40,7 @@ getfilevar() { lastservicephone() { logfile=/var/log/kannel/smsbox.log tac $logfile $logfile.1 \ - | perl -ne "/INFO: Starting to service <.*> from <\+$1> to <([^<>]*)>/ and print \$1 and exit 0" + | perl -ne "/INFO: Starting to service <.*> from <$1> to <([^<>]*)>/ and print \$1 and exit 0" } #from=`uriunescape "$1" | sed -e 's/\+/ /g'`; shift @@ -243,12 +243,13 @@ and (if included) send MSG to subscribers." while [ -n "$1" ]; do targetphone="$(echo "$1" | perl -pe 's/^(?=[^+])/+36/;' -e '/^\+\d+$/;')" [ -n "$targetphone" ] || continue - targetphones="${targetphones:+$targetphones }$targetphone" - shift # Sanity check targetfrom=$(lastservicephone "$targetphone") [ -n "$targetfrom" ] || exit1 "refusing to redirect: unknown target phone number \"$targetphone\"." + + targetphones="${targetphones:+$targetphones }$targetphone" + shift done # send responses (threaded one last, to work in debug mode) -- cgit v1.2.3