From 55167a504907a2ed02e03c0bd90f17af57fcf6d2 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Mon, 22 Nov 2010 08:17:47 +0100 Subject: Set ccc per-profile. --- localkannel-dispatch | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/localkannel-dispatch b/localkannel-dispatch index 216a633..b9efb20 100755 --- a/localkannel-dispatch +++ b/localkannel-dispatch @@ -73,11 +73,13 @@ export SMS_PHONE urldecode case "$SMS_REALM" in test) + ccc="${ccc:-99}" provider="dummy" mdpath="/home/hearth/public_webdata/hearth/content/sms" export mdpath ;; hello) + ccc="45" provider="local" # provider="coolsms" # provider="clickatell" @@ -85,6 +87,7 @@ case "$SMS_REALM" in export mdpath ;; hellobudapest) + ccc="36" # provider="clickatell" provider="local" addtestphones="+36307418279" # Jonas @@ -99,6 +102,7 @@ case "$SMS_REALM" in export SMS_ERRFROM SMS_ERRTO1 SMS_ERRTO2 mdpath ;; hellotorino) + ccc="39" provider="clickatell" gotestphones="+393453915741 +393453805531 +393453801457" # Jonas, Jacob, Vera gophones="+393407574815 +393407574813 +393381467977 +393478617029" # Alessandra, Vela, Marco, Silvia @@ -109,11 +113,13 @@ case "$SMS_REALM" in export SMS_ERRFROM SMS_ERRTO1 SMS_ERRTO2 mdpath ;; cyber) + ccc="45" provider="local" mdpath="/home/cyberhus/public_webdata/mdsms/content/sms" export mdpath ;; hpm) + ccc="84" provider="local" mdpath="/home/www-sms/public_webdata/hpm/content/sms" export mdpath @@ -185,8 +191,8 @@ esac #if [ -n "$REDIRECT_OK" ]; then case "$app" in @*) -# FIXME: Avoid hardcoding national prefix - targetphone="$(echo "$app" | perl -pe 's/^@//;' -e 's/^([^+])/+36\1/')" +# FIXME: Avoid hardcoding country code + targetphone="$(echo "$app" | perl -pe 's/^@//;' -e 's/^([^+])/+'"$ccc"'\1/')" # TODO: silence errors - or better: bounce those back to original sender targetfrom=$(lastservicephone "$targetphone") [ -n "$targetfrom" ] || exit1 "refusing to redirect: unknown target phone number \"$targetphone\"." @@ -247,7 +253,9 @@ and (if included) send MSG to subscribers." shift # FIXME: avoid juggling with leading plus here when no longer stripped from input -# phone="$(echo "$1" | perl -ne 's/^(?=[^+])/+36/;' -e '/^(\+\d\d\d+)$/ and print $1;')" +# FIXME: make country code optional when plus no longer stripped from input +# FIXME: Avoid hardcoding country code +# phone="$(echo "$1" | perl -ne 's/^(?=[^+])/+'"$ccc"'/;' -e '/^(\+\d\d\d+)$/ and print $1;')" phone="$(echo "$1" | perl -ne '/^(\d\d\d+)$/ and print $1;')" [ -n "$phone" ] || exit1 "wrong or missing phone number: must be only digits with leading + and at least 3 digits." targetfrom=$(lastservicephone "\+$phone") @@ -311,9 +319,9 @@ and (if included) send MSG to subscribers." esac # FIXME: avoid juggling with leading plus here when no longer stripped from input # FIXME: make country code optional again when plus no longer stripped from input -# FIXME: Avoid hardcoding national prefix +# FIXME: Avoid hardcoding country code while [ -n "$1" ]; do -# targetphone="$(echo "$1" | perl -ne 's/^(?=[^+])/+36/;' -e '/^(\+\d\d\d+)$/ and print $1;')" +# targetphone="$(echo "$1" | perl -ne 's/^(?=[^+])/+'"$ccc"'/;' -e '/^(\+\d\d\d+)$/ and print $1;')" targetphone="$(echo "$1" | perl -ne '/^(\d\d\d+)$/ and print $1;')" [ -n "$targetphone" ] || continue -- cgit v1.2.3