SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Sun May 19, 2024 21:52
SMSTools3 Community » Help and support Bottom

[answered] More functions to my sms server

  This topic is locked

Page:  1

Author Post
Member
Registered:
Jul 2009
Location: United Kingdom
Hi,

I would like to make my sms server to work with incoming message, the objective the sms server would be able to receive a text, save it on a database an then re forward it to another phone.

At the moment the messages are going to the incoming folder with a weird denomination and extention like GSM1.dhHJ (I can read them in the Text editor though)

Having not shell script active in the shell, the message are getting into the incoming folder, as guess as we talked before when the daemon is up it keep checking for income message.

I know how to work with the database part, but I am not sure about handling the incoming message, how can I open from the incoming folder? I guess this still gone in scrit shell programming, right?

On your files there is something like
#Extract data from the SMS file
FROM=`formail -zx From: < $2 | sed 's/"//g'`
TO=`formail -zx To: < $2`
#Remove plus sign, spaces, minus and short number prefix
TO=`echo "$TO" | sed 's/ //g' | sed 's/+//g' | sed 's/s//g' | sed 's/-//g'`
SUBJECT=`formail -zx Subject: < $2`
SENT=`formail -zx Sent: < $2`
#Text is not used but could be used
#TEXT=`formail -I "" <$2`

May I in the right track??? you said in there

Quote
# Please read the documentation before using this script.

Where?

Please give me some guide lines and point me to example code if you already have,

Thank you in advance,

King Regards

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
peteruk2009 wrote
I guess this still gone in scrit shell programming, right?

Yes, you need to set up an eventhandler: In the global part of smsd.conf file, define:
eventhandler = /usr/local/bin/smsd_eventhandler

Create this file and copy it's content from here: Sample eventhandler to store messages into SQL database.

Quote
May I in the right track??? you said in there
Quote
# Please read the documentation before using this script.

Where?

Anywhere ;)
Okay, that comment is very old and the documentation does not contain very much details about creating scripts...

Please check this: Advanced Bash-Scripting Guide.
About forwarding a message: there is a sample script forwardsms in the scripts directory of a package.

Member
Registered:
Jul 2009
Location: United Kingdom
Topic owner
Quote
Yes, you need to set up an eventhandler: In the global part of smsd.conf file, define:
eventhandler = /usr/local/bin/smsd_eventhandler

Hi, I did include the folder and the suggested code, but its not working fully,

I get in the smsd.conf
Done: eventhandler, excecution time 0 sec., status:256
ALERT problem with eventhandler, result 1

Do you know what does it mean?

additionally I have create a sh file to test the shell script
and in the script folder in the file smsevent you said
Quote
# This is an example how to use an eventhandler with smsd.
# $1 is the type of the event wich can be SENT, RECEIVED, FAILED or REPORT.
# $2 is the filename of the sms.
# $3 is the message id. Only used for SENT messages with status report.

I am trying to test and learn bit about the shell programming
in this sentences
FROM=`formail -zx From: < $2 | sed 's/"//g'`
TO=`formail -zx To: < $2`
where I belive you store the values from and to in the received test message, but the shell is giving this error
$2: ambiguous redirect
as a matter of fast it can not open the file
I did before $2 =/home/.../GSM1.icf0T7
I am trying to test the script in cold so I can learn a bit more about shell programming
I know I am trying to cut conner writing to you, but time is pressure this days :)
There is 2 question in all this, one the error in the smsd.conf file, and two, the way to force $2 (file point name) in order to test the script without the need to keep sending me message, (is this possible). Thanks

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
peteruk2009 wrote
I get in the smsd.conf
Done: eventhandler, excecution time 0 sec., status:256
ALERT problem with eventhandler, result 1

The return value of your script is not zero and this means an error. If you have exit 1 in the script, change it to exit 0. If there is not exit used, insert exit 0 to the end of script.

Quote
..., but the shell is giving this error
$2: ambiguous redirect

You were missing command line arguments. While testing, run the script in this way:
/usr/local/bin/smsd_eventhandler RECEIVED /home/...whatever.../GSM1.icf0T7

Member
Registered:
Jul 2009
Location: United Kingdom
Topic owner
Quote
The return value of your script is not zero and this means an error. If you have exit 1 in the script, change it to exit 0. If there is not exit used, insert exit 0 to the end of script.

Yeap, thanks that was missing the exit 0, that fixed it.

Quote
/usr/local/bin/smsd_eventhandler RECEIVED /home/...whatever.../GSM1.icf0T7

Thanks for this tip too, that was easy debugging, actually nothing was wrong with the script the problem was in the database.

Why FAILED and SENT are in the same condition?

How is the maxing character you can send in a text?

Have you got a all possible sample of the text message fileds you can encounter in sending and receiving?

In the smstest.php there is some text conversion ISO UNICO No conversion, why do I need all this conversion?
I did some test all of them work in my mobile phone network, from one mobile to another one.

Just no conversion take longer this are the result ISO 14 sec, UNICO 15 sec, No conversion 16 sec

At last but not ask least there is a option in the smstest.php that point the the variable flash? could you please elaborate for me why do I need this adjustment, what is actually doing?

Thank you in advance for all your help!

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Quote
Why FAILED and SENT are in the same condition?

Both message types are just using the same SQL statement in the sample eventhandler.

Quote
How is the maxing character you can send in a text?

Maximum number of characters in the single message part is 160 when using GSM character set and 70 when using Unicode.

Long message can be splitted into the 255 parts maximum. Assuming that the concatenation format, which is the default, is used in splitting, maximum number of characters in message part is 153 when using GSM charset and 64 when using Unicode. Maximum length of a long message is then 39015 (GSM) and 16320 (Unicode).

There may be some limitations for maximum number of parts with some operators or some phone devices.

Quote
Have you got a all possible sample of the text message fileds you can encounter in sending and receiving?

All fields of a message are documented here.

Quote
In the smstest.php there is some text conversion ISO UNICO No conversion, why do I need all this conversion?
I did some test all of them work in my mobile phone network, from one mobile to another one.

Just no conversion take longer this are the result ISO 14 sec, UNICO 15 sec, No conversion 16 sec

The script smstest.php was made for testing character set handling. What do you need, depends on your system.

For example, if you are using locale other than UTF-8, you probably need to change the character set to ISO, at least if you are using a checkhandler which extracts some data from the message body. Or if you are sending a message with characters which cannot be represented using the GSM alphabet, you need to use Unicode.

Quote
At last but not ask least there is a option in the smstest.php that point the the variable flash? could you please elaborate for me why do I need this adjustment, what is actually doing?

A Flash SMS appears directly on the phone's screen, without the need to press any buttons on the phone. The script smstest.php has this option to make testing little bit easier, there is no need to open each received message and messages do not fill the inbox.

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.