Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

gammu-smsd-files(7) [debian man page]

GAMMU-SMSD-FILES(7)						       Gammu						       GAMMU-SMSD-FILES(7)

NAME
gammu-smsd-files - gammu-smsd(1) backend using filesystem as a message storage DESCRIPTION
FILES backend stores all data on a filesystem in folders defined by configuration (see gammu-smsdrc for description of configuration options). RECEIVING OF MESSAGES
Received messages are stored in a folder defined by configuration. The filename will be IN<date>_<time>_<serial>_<sender>_<sequence>.<ext>, for example NN20021130_021531_00_+45409000931640979_00.txt. Explanation of fields: <date> date in format YYYYMMDD <time> time in format HHMMSS <sender> sender number <serial> order of a message (in case more messages were received at same time), in format NN <sequence> part of the message for multipart messages, in format NN <ext> txt for text message, 8-bit messages are stored with bin extension, smsbackup for gammu-smsbackup The content of the file is content of the message and the format is defined by configuration directive InboxFormat (see gammu-smsdrc). TRANSMITTING OF MESSAGES
Transmitted messages are read from a folder defined by configuration. The filename should be one of the following formats: o OUT<recipient>.<ext> o OUT<priority>_<recipient>_<serial>.<ext> o OUT<priority><date>_<time>_<serial>_<recipient>_<note>.<ext> Explanation of fields: <recipient> recipient number where to send message <priority> an alphabetic character (A-Z) A = highest priority <ext> txt for normal text SMS, smsbackup for gammu-smsbackup <note> any artibrary text which is ignored For text messages, you can additionally append flags to extension: d delivery report requested f flash SMS b WAP bookmark as name,URL Other fields are same as for received messages. For example OUTG20040620_193810_123_+4512345678_xpq.txtdf is a flash text SMS requesting delivery reports. SMSes will be transmitted sequentially based on the file name. The contents of the file is the SMS to be transmitted (in Unicode or stan- dard character set). The contents of the file is the SMS to be transmitted (in Unicode or standard character set), for WAP bookmarks it is split on as Name,URL, for text messages whole file content is used. Please note that if file is not in Unicode, encoding is detected based on locales, which do not have to be configured if SMSD is running from init script. If this is your case, please add locales definition to init script. AUTHOR
Michal iha <michal@cihar.com> COPYRIGHT
2009-2012, Michal iha <michal@cihar.com> 1.31.90 February 24, 2012 GAMMU-SMSD-FILES(7)

Check Out this Related Man Page

GAMMU-SMSD-RUN(7)						       Gammu							 GAMMU-SMSD-RUN(7)

NAME
gammu-smsd-run - documentation for RunOnReceive directive DESCRIPTION
Gammu SMSD can be configured by RunOnReceive directive (see gammu-smsdrc for details) to run defined program after receiving every message. It can receive single message or more messages, which are parts of one multipart message. This parameter is executed through shell, so you might need to escape some special characters and you can include any number of parameters. Additionally parameters with identifiers of received messages are appended to the command line. The identifiers depend on used service backend, typically it is ID of inserted row for database backends or file name for file based backends. Gammu SMSD waits for the script to terminate. If you make some time consuming there, it will make SMSD not receive new messages. However to limit breakage from this situation, the waiting time is limited to two minutes. After this time SMSD will continue in normal operation and might execute your script again. Note All input and output file descriptors are closed when this program is invoked, so you have to ensure to open files on your own. ENVIRONMENT
program is executed with environment which contains lot of information about the message. You can use it together with NULL service (see gammu-smsd-null) to implement completely own processing of messages. Global variables SMS_MESSAGES Number of physical messages received. DECODED_PARTS Number of decoded message parts. Per message variables The variables further described as SMS_1_... are generated for each physical message, where 1 is replaced by current number of message. SMS_1_CLASS Class of message. SMS_1_NUMBER Sender number. SMS_1_TEXT Message text. Text is not available for 8-bit binary messages. Per part variables The variables further described as DECODED_1_... are generated for each message part, where 1 is replaced by current number of part. Set are only those variables whose content is present in the message. DECODED_1_TEXT Decoded long message text. DECODED_1_MMS_SENDER Sender of MMS indication message. DECODED_1_MMS_TITLE title of MMS indication message. DECODED_1_MMS_ADDRESS Address (URL) of MMS from MMS indication message. DECODED_1_MMS_SIZE Size of MMS as specified in MMS indication message. EXAMPLES
Activating RunOnReceive To activate this feature you need to set RunOnReceive in the gammu-smsdrc. [smsd] RunOnReceive = /path/to/script.sh Processing messages from the files backend Following script (if used as RunOnReceive handler) passes message data to other program. This works only with the gammu-smsd-files. #!/bin/sh INBOX=/path/to/smsd/inbox PROGRAM=/bin/cat for ID in "$@" ; do $PROGRAM < $INBOX/$ID done Passing message text to program Following script (if used as RunOnReceive handler) passes message text and sender to external program. #!/bin/sh PROGRAM=/bin/echo for i in `seq $SMS_MESSAGES` ; do eval "$PROGRAM "${SMS_${i}_NUMBER}" "${SMS_${i}_TEXT}"" done Passing MMS indication parameters to external program Following script (if used as RunOnReceive handler) will write information about each received MMS indication to the log file. Just replace echo command with your own program to do custom processing. #!/bin/sh if [ $DECODED_PARTS -eq 0 ] ; then # No decoded parts, nothing to process exit fi if [ "$DECODED_1_MMS_ADDRESS" ] ; then echo "$DECODED_1_MMS_ADDRESS" "$DECODED_1_MMS_SENDER" "$DECODED_1_MMS_TITLE" >> /tmp/smsd-mms.log fi Processing message text in Python Following script (if used as RunOnReceive handler) written in Python will concatenate all text from received message: #!/usr/bin/python import os import sys numparts = int(os.environ['DECODED_PARTS']) # Are there any decoded parts? if numparts == 0: print('No decoded parts!') sys.exit(1) # Get all text parts text = '' for i in range(1, numparts + 1): varname = 'DECODED_%d_TEXT' % i if varname in os.environ: text = text + os.environ[varname] # Do something with the text print('Number %s have sent text: %s' % (os.environ['SMS_1_NUMBER'], text)) AUTHOR
Michal iha <michal@cihar.com> COPYRIGHT
2009-2012, Michal iha <michal@cihar.com> 1.31.90 February 24, 2012 GAMMU-SMSD-RUN(7)
Man Page