Hi I'll just answer right below your comments:
On Jun 7, 2010, at 4:44 PM, Thomas Sieh wrote: > hi, > > that the last line don't give a output is correct. > the $@ works like a stack. if you fetch the first argument it will be > removed and then the next one will be the first. if you want to access > the argument more than one time you should use variables to thore them. > > if you want to handle sms by the first word you can create for each word > an own sms-service with the keyword like > > group = sms-service > keyword = xyz > exec = /.../xyz.sh ... > > group = sms-service > keyword = abc > exec = /.../abc.sh ... > > ... > > then %k is the first word > %s is the second one > and %r is the rest of the text. > > possibly it should be an option for you. Thanks a lot! I'll dig into that later/shortly... > to check if a sms comes in from a phone should be done in the script. > for example by a file per vote with the sender numbers... > > the reason that you can see + instead of " " and %2B instead of "+" ... > is the urlencoding... thats not a bug. > here is a list: > http://www.w3schools.com/tags/ref_urlencode.asp > > i would replace the characters in your script. Great, thanks again for your friendly help. I made this perl-script (stole it from google and modified it a bit, perhaps somebody else can use it here): ========== #!/usr/bin/perl use strict; use warnings; my $numArgs = $#ARGV + 1; if ($numArgs == 0) { print "Usage:\n------\n $0 [-E | -D] expression to en-/de-code\n"; print " -E: Encode (URL/Uniform Resource Locator URL Encoding)\n"; print " -D: Decode (make + into space and %hex into ASCII-signs)\n\n"; exit(0) } my $typeEncDec = $ARGV[0]; shift @ARGV; my $input_string; my @input_string_array; if (@ARGV) { $input_string = join(' ',@ARGV); } else { my $line; while ($line = <STDIN>) { # read 1 line from STDIN # chomp($line); # remove trailing "\n" if present push(@input_string_array, $line); } $input_string = join(' ',@input_string_array); } #while (<>) { #my $input_string = join(' ',@ARGV); #} #print "all args: $input_string\n"; if (lc($typeEncDec) eq "-e") { print "Encoding...\n"; print &encode($input_string) . "\n"; } elsif (lc($typeEncDec) eq "-d") { print "Decoding...\n"; print &decode($input_string) . "\n"; } else { print "Wrong input argument, must be -E or -D (encode/decode)...\n"; exit(1) } #----------------------- # Encode a string into urlencoded format sub encode { my($instring) = @_; # Replace all Non-Numerics with HEX Sequence $instring =~ s/[\x00-\x1F\x21-\x2F\x3A-\x40\x5B-\x60\x7B-\xFF]/&hexCodeFromChar($&)/eg; # Replace all spaces with Plus Character $instring =~ s/ /+/g; return($instring); } #----------------------- # Decode a string from urlencoded format sub decode { my($instring) = @_; # Replace all PLUS characters with Spaces $instring =~ tr/+/ /; # Replace Hex Codes with real characters $instring =~ s/%(..)/pack("C",hex($1))/eg; return($instring); } #----------------------- # Function used by both sub hexCodeFromChar { my ($char) = @_; my $asc = ord($char); return(sprintf("%c%02X", 37, $asc)); } ========== This script solved my url-encode / url-decode issue... The rest should be piece of cake I hope (or I'll look into the archive and if something goes back, I'll write back and ask for more help... > an auto-generated receipt is also possible with kannel, i think. but i > can't currently remeber how. No problem, I prefer using the sms.sh script so I can customize everything :-) Thanks a lot for quick and professional help, when I needed it - I'll be in here for a while to see the other posts :-) Regards, Martin
