SMS Server Tools

SMS file format

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

Text SMS

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: 491722056395
Provider: D2
Flash: yes
 
Hello, this is the sms.

The From: , 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 Provider: field specifies the name of the destination provider. 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.

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: Stefans
To: 491722056395
Provider: D2
Binary: true
UDH: true
 
gs2389gnsakj92fs2ujtiegbhewqu2ir9jsdgufh3gjeruqgh87zt243htgerugsqh
3gert324543t43g5jwht934zt743gfjsbfjwr793thruewgfh7328hgtwhg87324hf
hwer32873gert324543t43g5jwht934zt743g

Again the To: 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 160 bytes. Smsd splits ASCII SMS in many parts if the message is to large for one single SM.

Received SMS

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: 491722056395
From_SMSC: 491722270333
Sent: 00-02-21 22:26:23
Received: 02-21-00 22:26:29
Subject: MODEM1
 
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

Status Reports are received from the SMSC if you enable this option in the config file and your modem supports this feature. Example:

From: 491722056395
From_SMSC: 491722270333
Sent: 00-02-21 22:26:23
Subject: MODEM1
 
SMS STATUS REPORT
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.