diff options
Diffstat (limited to 'localkannel-dispatch')
-rwxr-xr-x | localkannel-dispatch | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/localkannel-dispatch b/localkannel-dispatch index d2339bd..ee9cd36 100755 --- a/localkannel-dispatch +++ b/localkannel-dispatch @@ -30,6 +30,13 @@ uriunescape() { fi } +# Resolve var from "variable = value" pair in file below /etc/local +getfilevar() { + file="/etc/local/$1" + var="$2" + grep -m1 "^$var" "$file" | awk -F '(= )' '{print $2}' +} + lastservicephone() { logfile=/var/log/kannel/smsbox.log tac $logfile $logfile.1 \ @@ -66,16 +73,21 @@ case "$SMS_REALM" in ;; hellobudapest) provider="clickatell" + gotestphones="+36307418279" # Jonas + gophones="" + SMS_ERRFROM="+36307418279" # Jonas + SMS_ERRTO1="" + SMS_ERRTO2="" mdpath="/home/www-hearth/public_webdata/hellobudapest/content/sms" - export mdpath + export SMS_ERRFROM SMS_ERRTO1 SMS_ERRTO2 mdpath ;; hellotorino) provider="clickatell" gotestphones="+393453915741 +393453805531 +393453801457" # Jonas, Jacob, Vera gophones="+393407574815 +393407574813 +393381467977 +393478617029" # Alessandra, Vela, Marco, Silvia - SMS_ERRFROM="+393453915741" - SMS_ERRTO1="+393453801457" - SMS_ERRTO2="+393483281187" + SMS_ERRFROM="+393453915741" # Jonas + SMS_ERRTO1="+393453801457" # Vera + SMS_ERRTO2="+393483281187" # Rescue mdpath="/home/www-hearth/public_webdata/hellotorino/content/sms" export SMS_ERRFROM SMS_ERRTO1 SMS_ERRTO2 mdpath ;; @@ -100,8 +112,8 @@ case "$provider" in coolsms) unset SMS_SMSC SMS_URL="https://sms.coolsmsc.dk:8081/" - SMS_USER="drjones1" - SMS_PW="rahYSeGY" + SMS_USER=$(getfilevar coolsms user) + SMS_PW=$(getfilevar coolsms pw) SMS_CP="cp1252" SMS_MSGTAG="message" export SMS_URL SMS_USER SMS_PW SMS_CP SMS_MSGTAG @@ -111,11 +123,11 @@ case "$provider" in clickatell) unset SMS_SMSC SMS_URL="https://api.clickatell.com/http/sendmsg" - SMS_USER="jonas" - SMS_PW="inaritab6" + SMS_USER=$(getfilevar clickatell user) + SMS_PW=$(getfilevar clickatell pw) SMS_CP="iso8859-1" SMS_USERTAG="user" - SMS_API="3231280" + SMS_API=$(getfilevar clickatell api) SMS_CALLBACK="3" SMS_CONCAT="3" SMS_ESCALATE="1" @@ -152,7 +164,7 @@ esac case "$app" in @*) # FIXME: Avoid hardcoding national prefix - targetphone="$(echo "$app" | perl -pe 's/^@//;' -e 's/^([^+])/+39\1/')" + targetphone="$(echo "$app" | perl -pe 's/^@//;' -e 's/^([^+])/+36\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\"." |