Note: In case of binary values you can use "true", "yes" or "1" for positive values. All other words are interpreted as "false".
Text SMS
Binary SMS
Received SMS
Status Reports
An SM file is a text file that contains the message and a header. You have to store all SM you want to send in these files in the outgoing directory. The filename does not matter but it has to be unique. You may use the mktemp command to generate unique filenames.
If you call putsms manually the header is optional because you can enter the destination number in the command line, but smsd needs the header!
From: Stefan
To: 491721234567
SMSC: 491722270333
Provider: D2
Flash: yes
Hello, this is the sms.
The From: , SMSC: , Provider: and Flash fields are optional.
The program does not use the From: field but it appears in the message log. You can use this for charging.
The SMSC: field specifies the SMSC that shall be used to send this message. If you do not set this number, then the default from the configuration file is used. If the configuration file does also not have such a setting, then the dafault setting from the SIM card or modem is used.
The Provider: field specifies the name of the destination provider or queue (which is actually the same). Smsd uses this parameter to decide into wich queue the message belongs. If the field does not exist, the phone number will be compared to the numbers in config file to get the correct provider name.
You can also use the keyword Queue: instead of provider. Both do the same.
If you set Flash: yes the SM is sent as "flash" or class 0. That means that the message is not stored in the simcard on the receiving phone and it is displayed directly.
The To: field is the destination number in international format without a plus. The header ends with one empty line. You may add other fields to the header if you want because smsd ignores all unknown lines. This simplifies the conversion of emails to sms.
All lines must end with \n or \r\n (for Microsoft Windows compatibility).
Binary SMS, Operator Logos, Ringtones
If the SM has binary content it will be sent as 8 Bit with UDH Flag that is useful for operator logos, ring tones, etc. The binary data begins after the empty line and it ends at the file end. If there is no header the binary data begins at the first byte of the file.
Smsd needs to know if you use binary or text content. You have to add the header Binary: true to mark the file as binary.
You can tell smsd if the binary data contains an UDH (user data header, see ETSI TS 100 901 specification). The default is true because most binary SMS have an UDH.
From: Stefan
To: 491721234567
SMSC: 491722270333
Provider: D2
Binary: true
UDH: true
gs2389gnsakj92fs2ujtiegbhewqu2ir9jsdgufh3gjeruqgh87zt243htgerugsqh
3gert324543t43g5jwht934zt743gfjsbfjwr793thruewgfh7328hgtwhg87324hf
hwer32873gert324543t43g5jwht934zt743g
Again the From: , SMSC: and Provider: fields are optional.
Caution: If you call putsms manually think about this: putsms needs the command-line argument -f or -F to distinguish between ascii and binary format. It does not look for the Binary: and UDH: header! If you use smsd it detects this header and calls putsms in the right way.
Binary SM are not splitted by smsd if they are to large. The maximum size is 140 bytes. Smsd splits ASCII SMS in many parts if the message is to large for one single SM.
The received SMS are stored in the same format as described above but they have two additional fields: The sent-date and the SMSC number if the modem reports it. For example:
From: 491721234567
From_SMSC: 491722270333
Sent: 00-02-21 22:26:23
Received: 00-02-21 22:26:29
Subject: GSM1
This is the Text that I sent with my mobile phone.
The header may become larger in future versions. The subject line contains the modem name as you set up in your config file.
The filenames of received SMS are like this:
MODEM1.xyzxyz
They begin with the name of the modem that received the SM followed by dot followed by six random characters.
Status Reports are received from the SMSC if you enable this option in the config file and your modem supports this feature. Example:
From: 491721234567
From_SMSC: 491722270333
Sent: 00-02-21 22:26:23
Received: 00-02-21 22:26:29
Subject: GSM1
SMS STATUS REPORT
Message_id: 117
Discharge_timestamp: 00-02-21 22:27:01
Status: 0,Ok,short message received by the SME
Please take a look into the source code getsms.c if you need a list of all possible status codes.
The Message_id is a number that identifies the prior sent message that this status report belongs to. This number is useful when you want to log the status of sent message in a database. The eventhandler gets the same Message_id as 3rd argument for each sent message. But please note: If a message is longer than 160 characters it will be splittet into many parts and the eventhandler is run only once after the last part was sent. You will receive a status report for each sent part, therefore you may receive more status reports than you expected.