## SMS Server Tools 3

Home

### General

If you have any comments, ideas, needs or other SMS Server Tools 3 related things, please write them to SMSTools3 Community which is a support forum for this software.

### Coming to the version 3.2.x, not yet released

Estimated release time for following additions was in the past, but the publishing is delayed.

1. SQL database based spooling and message handling. Can be used together with current filesystem based spooling, or instead of it. At least MySQL and PostgreSQL will be supported, likely SQLite3, Mini SQL and Microsoft SQL Server too.

### Version history

03.05.2017 3.1.21

Configuration file (smsd.conf):

1. Added several modem settings for checking the SIM:

   check_sim = yes/no / once
   Default value: no.
   If the device and smsd are started before the SIM is inserted to the device, communication will fail and modem process stops. With some devices modem process can wait until the SIM becomes ready.

   A setting check_sim defines if the SIM is checked every time when a modem is initialized. Value once means that checking is only done when a modem is initialized for the first time.

   All devices are not compatible with this feature. Some tested devices, like Huawei E353 and Neoway M590E do not work if the SIM is not in place when a device is switched on. Telit EZ-10 worked well and any reset was not required. SIM800L also worked well, but RADIO_OFF_ON was required. Some devices like M590E stop the communication if the radio is switched off, so that kind of reset cannot be used. If this feature is going to be used, carefull tests should be done.

   When an error with SIM is detected, modem port is closed while modem process is waiting. USB modem can be disconnected and reconnected, if the port remains the same.

   check_sim_cmd = string
   Default value: AT+CPIN?.
   Defines a command which is used to check the SIM. Default value AT+CPIN? is suitable for most devices. The command should return ERROR when the SIM is not ready.

   check_sim_keep_open = yes/no
   Default value: no.
   Defines if a modem is closed when SIM was not ready and modem process is waiting for retrying.

   check_sim_reset = string / RADIO_OFF_ON / RADIO_OFF_ON_SLOW
   Default value: not used.
   Defines if reset with AT commands is done before retrying after the failure. Special value RADIO_OFF_ON is translated to AT+CFUN=0;+CFUN=1 which sets the radio off and immediately back to on without delays. Value RADIO_OFF_ON_SLOW is translated to AT+CFUN=0[3]AT+CFUN=1[5] where numbers in square brackets defines a delay in seconds. This setting sets the radio off, waits three seconds, sets the radio back on and waits five seconds.

   check_sim_retries = number / forever
   Default value: 10.
   Defines how many times modem process will retry. With a value forever modem process will retry, let's say, forever.

   check_sim_wait = number
   Default value: 30.
   Defines how many seconds modem process will wait until retry.

General:

2. The script sendsms now tries to change the group of outgoing file instead of owner which can be changed only by root. Attributes of a file are set to 0660.

Bug fixes:

3. After a message was sent, modem process crashed on FreeBSD running on Raspberry Pi, because time to send was written inproperly to the log file (time_t vs. integer). This is fixed and similar missing typecasts are added to couple of other places too.

4. If the USSD answer was received from the modem in more than one pieces, only the first piece was handled and the result was broken. This is fixed by waiting for the last quotation mark and comma which are very near to the end of answer.

5. Pre-initialization did not work with all modems. "Echo off" and extended commands are not combined anymore. If pre_init is set to no, "echo off" and "CMEE=1" are not sent to the modem, but "CLIP=1" and/or "CREG=2" are still sent if necessary.

Download

11.04.2017 3.1.20

Sent message file:

1. New header: Sending_time: number of seconds
   Tells how long it took to send the whole message. If the message has multiple parts and receive_before_send is set to yes, time to receive messages is included in this value.

Configuration file (smsd.conf):

2. Special section [communicate] can define shortcuts which can be used when communicating with a modem (e.g. smsd -C GSM1). Possible keys are Alt-0 ... Alt-9, and the syntax is like the following:

   [communicate]
   a0 = ATZ
   a5 = AT+CPMS?

   When communicating starts, available shortcuts are printed to the console. Alt-? also prints available shortcuts. Shortcuts can be used after a modem is opened. Shortcut does not include CR character, it must be pressed by the user.

   Also the Ctrl-Z character can be sent using the Alt-Z key, required when terminating the PDU.

General:

3. Nowadays modems like Huawei are moderately general in simple environments, and list of incoming messages with those devices starts from 0. There is a configuration setting memory_start available, and it defaults to 1 because of backward compatibility. If memory_start is not set, and reading of messages causes an error, notification is written to the log and modem process changes the start to 0 automatically. To avoid future error messages when smsd starts, a configuration setting memory_start = 0 should be applied manually.

4. When a status of PIN is asked from the modem, the answer "+CPIN: READY" is expected. Now also simply "OK" is accepted.

5. When checking if a script is executable, it is also checked if a definition incorrectly points to the directory.

Bug fixes:

6. Even when the outgoing text is UTF-8 encoded, ISO characters are still accepted for backward compatibility. Changes for character conversion in 3.1.16 dropped ISO characters, and this is now fixed.

7. A field Discharge_timestamp in the messabe body of status report was always using the format "%y-%m-%d %H:%M:%S", even when a custom datetime_format was defined in the configuration file. This is fixed.

10.03.2017 3.1.19

Configuration file (smsd.conf):

1. Devices setting: multiple wildcard definitions can be used, together with static names. For example:
   devices = ELISA* 11-15, SONERA* 11-15, GSM1

2. "group" sections can be defined. If the system has devices = ELISA* 11-13, GSM1, DNA33* 1-5, the following groups can be used:

   [ELISA*]
   # Settings for ELISA11, ELISA12 and ELISA13 SIM's
   [DNA*]
   # Settings for DNA331, DNA332 etc. SIM's

   Grouping works with device names which do not start with digit. Asterisk is placed to the position where the first digit exists.

   All modems read [default] section first, if it exists. Next the group section is read, if it exists. Finally the modems own section is read, if it exists.

Other:

3. Wildcard definitions can be used in the suspend file, for example: ELISA*: <reason>. The letters before *: are tested, and if the name of a modem matches with them, suspend is applied.

Bug fixes:

4. In the version 3.1.18 reading of modem settings was restructured and the new code forgot to close the handle of configuration file. This is fixed.

03.03.2017 3.1.18

Configuration file (smsd.conf):

1. New setting for a modem: read_configuration_after_suspend = yes/no
   Default value: no.
   If set to yes, modem process will read the configuration when suspend is going to break or end. Configuration is checked and modem port (device) is tested. If there are any problems, suspend continues. Problems are shown in the log, and after problems are fixed, a signal USR2 must be sent to the modem process. When configuration has no problems, modem process will continue as usual.

   Changes for device settings logfile and loglevel do not apply without restarting smsd.

2. New setting for a modem: read_identity_after_suspend = yes/no
   Default value: yes.
   Defines if IMEI and IMSI are refreshed after the suspend has ended. This is useful if modem was suspended, and the SIM was changed on the fly, without restarting the whole daemon and without reading the whole modem setup.

3. New setting for a modem: delaytime = number
   Default value: use the global part setting.
   Defines how many seconds a modem process sleeps when it has nothing to do. This setting overrides the global delaytime value.

4. New setting for a modem: delaytime_random_start = yes/no
   Default value: no.
   Defines if the first sleep of a modem process is randomized, using a value between 0 and delaytime. With very large number of modems it may be good that all processes are not working at the same time.

5. New global setting: start = filename
   Default value: not in use.
   Defines a script/program which is executed when smsd starts. This should be /path/to/executable only. If any arguments are required, use start_args. If return value of this script is anything else than 0, smsd stops.

6. New global setting: start_args = string
   Default value: empty.
   Defines arguments for start script.

Bug fixes:

7. If smsd was compiled with shared memory (statistics) enabled, and NUMBER_OF_MODEMS in the Makefile was set to 124 or more, there was not enough shared memory available when trying to start smsd. Error message was written to the log and smsd did not start. Calculation of required memory with large setups is fixed, and now hundreds of modems are supported with statistics enabled.

8. If notifier (released in the version 3.1.17) was used, it did not terminate in some environments when smsd terminated. This was because smsd used a signal SIGTERM to terminate it. Now SIGKILL is used.

24.02.2017 3.1.17

General:

1. Main loops are fine-tuned to reduce CPU load and increase the performance of spooling.

   When smsd is spending some delay, for example sleeping after error, it sleeps more and less often, meaning that single sleep in the sleeping loop is raised to 10ms from 100µs.

2. Smsd now respects environment setting TMPDIR or TEMPDIR, if available. Without those variables smsd uses /tmp, as before.

3. When sending large number of messages continuously, regular run of a modem is executed on schedule, without need to use max_continuous_sending setting.

Configuration file (smsd.conf):

4. New global setting: notifier = yes/no
   Default value: no.
   If set to yes, mainspooler creates a child process which will use inotifywait to monitor outgoing directory. As soon as a new file appears in the directory, mainprocess gets a signal SIGCONT and continues immediately. New files are spooled as fast as possible, even when mainprocess has long sleeping times to reduce CPU load.

   This feature is available only on GNU/Linux systems. When compiling smsd on other systems, edit the Makefile and uncomment the line which defines DISABLE_INOTIFY. By default inotify is enabled.

5. New global setting: sleeptime_mainprocess = value
   Default value: 1
   Value is seconds. This setting defines how long mainprocess sleeps when no any messages are spooled. While looping, another smsd is detected, modem processes are listened and statistic files are written. This setting does not affect for picking up new outgoing files, there is another setting delaytime_mainprocess for it. Also notice that if an external child with inotifywait is used, mainprocess will get the signal CONT and continues spooling immediately after a new file exists. Because of this, delaytime can be high to save resources on small systems.

   If it is needed that smsd really sleeps using sleep() while idle, this value can be set to higher than 1. However, in usual systems there is no need for that. Even if value is higher, regular_run script is executed on time, if in use. PID and processes are checked less often, and statistics are written less often if this value is higher than values set to those tasks.

6. New global setting: check_pid_interval = number
   Default value: 10.
   Defines how often mainprocess will check the pidfile, to see if there was another smsd started. If another smsd is started, current smsd will stop immediately. Value 0 disables this checking. Value is seconds.

7. New global setting: child = filename
   Default value: not in use.
   This setting creates a child process to the mainspooler. It starts when smsd starts, and stops when smsd stops. If child has created one or more childs, they are stopped too when smsd stops.

   Child can be used for various purposes, for example feeding spooler from SQL database, taking care that the number of files in the spooler does not grow too much, and feeding is done only when smsd is running.

   Filename must be path/to/executable only, because it is checked when smsd starts. Use the setting child_args if any arguments are required.

8. New global setting: child_args = string
   Default value: empty.
   Defines arguments to the child.

9. New global settings:
   failed_copy = directory
   report_copy = directory
   sent_copy = directory
   Default value: not in use.
   It not empty, copy of all failed / report / sent messages are stored into this directory. Depending on the setting eventhandler_use_copy smsd does not do anything with these files, so external application can use them in whatever way it wants.

   For incoming messages a setting incoming_copy applies, it was released in the version 3.1.16.

10. New global setting: eventhandler_use_copy = yes/no
    Default value: no.
    If a copy of failed / incoming / sent / report message is created, this setting defines if a copied file is given to the eventhandler instead of original file.

11. New setting for a modem: receive_before_send = yes/no
    Default value: no.
    This is now available as a modem setting. Without this setting a value of global setting is used.
    Forces smsd to empty the first SIM card memory before sending SM. This is a workaround for modems that cannot send SM with a full SIM card.

Outgoing message file:

12. Filenames starting with a dot (so called hidden files) and filenames starting with "LOCKED" are now ignored. Filenames ending with ".LOCK" are ignored too, as before.

08.02.2017 3.1.16

Documentation is now updated and this version has no beta status anymore.

01.02.2017 3.1.16beta2

When communicating with the modem, smsd polls the answer much faster than before, when the expected answer is known. A new setting poll_faster is available, and it's the factor to reduce idle time and increase number of times to listen. The factor defaults to 5, which seems to work well with many modems. Some modems work even faster with greater value, like 30. However, very high values may increase the server load remarkably, so proper value should be measured by device. There is a setting log_read_timing available for tuning purposes.

Handling of alphabets is enhanced and all conversions are now done using internal routines which work well with cyrillic languages too. For backward compatibility, the alphabet of message file still defaults to ISO-8859-15, and this can be changed to UTF-8 in the configuration, or a header Alphabet: UTF can should be used. To receive cyrillic messages directly to UTF-8 character set, use the global settings decode_unicode_text = yes and incoming_utf8 = yes.

When sending text messages, choices are:

Alphabet: ISO

- depending on the global setting outgoing_utf8 (which defaults to yes), UTF-8 is still accepted and converted.
- optical replacement is done, depending on the modem setting cs_convert_optical (which defaults to yes).
- characters are converted to the GSM alphabet, and missing characters are dropped.

Alphabet: UTF

- like with ISO, but if any characters cannot be converted to the GSM alphabet, whole message is converted to the UCS2 alphabet.
- if conversion to UCS2 is done, each message part will have less characters and therefore more parts will be required, but the text delivers as it was written.

National Language Shift Tables are now supported. Languages are (European) Turkish, Spanish and Portuguese, and (Indian) Bengali and Assemese, Gujarati, Hindi, Kannada, Malayalam, Oriya, Punjabi, Tamil, Telugu and Urdu. If you do not need this support, and your computer is some embedded device with low memory, you can disable this support in Makefile. Also there is a definition to support European languages only.

When SMS using shift tables is received, it is always stored using UTF-8 alphabet. When sending SMS, there are headers Language and Language_ext available. Default values can also be set in the configuration. When shift tables are used, text body of SMS should be written using UTF-8 alphabet. Tables of the character sets can be found on the doc directory of a package.

Documentation is not yet updated. It will be done after beta status has gone.

Any feedback is valuable.

Configuration file (smsd.conf):

1. New global setting: alphabet = string.
   Default value: ISO.
   This setting defines how message body of outgoing file is handled, when there is no Alphabet header included. Choices are ISO, Latin or Ansi for ISO-8859-15, and UTF for UTF-8.

2. New global setting: log_read_timing = yes/no.
   Default value: no.
   This setting is for tuning purposes. When testing and searching suitable value for the poll_faster factor, it's important to see how the modem communicates and how much modem process generates server load.

3. New global setting: incoming_copy = string.
   Default value: empty.
   It not empty, copy of all incoming messages are stored into this directory. Smsd does not do anything with these files, so external application can use them in whatever way it wants.

4. New setting for a modem: poll_faster = number.
   Default value: 5.
   This setting speeds up the polling, when it is known what to expect as an answer from the modem. Use the global setting log_read_timing to find out the best performance with your device.

5. New setting for a modem: cs_convert_optical = yes/no.
   Default value: yes.
   If set to yes, when a character cannot be represented in the GSM character set, it can be approximated through one or several similarly looking characters.

6. New setting for a modem: national_toa_unknown = yes/no.
   Default value: no.
   When destination number is national, some operators require that "unknown" format is defined.

7. New setting for a modem: ignore_unexpected_input = string.
   Default value: none.
   If the device continually sends some unexpected input, and there is not other way to get rid of it, suitable phrase can be defined to keep the log clean. Multiple phrases can be defined with multiple settings.

8. New settings for a modem:
   language = string or number.
   Default value: none.
   language_ext = string or number.
   Default value: none.
   These settings set default values for the outgoing message file. For more details see the headers section.

9. New setting for a modem: regular_run_keep_open = yes/no.
   Default value: no.
   This setting defines if a modem is kept open when modem process is executing external regular_run scripts.

10. New setting for a modem: select_pdu_mode = yes/no.
    Default value: yes.
    Defines if PDU mode is selected each time when communication with the modem is started.

11. New setting for a modem: description = string.
    Default value: empty.
    If set, this description is written to each SMS file as an additional header.

12. New setting for a modem: reply_path = yes/no.
    Default value: no.
    Defines a default value for Reply Path (TP-RP) field. Header in the message file overrides this value.

13. New setting for a modem: sentsleeptime = number.
    Default value: 0.
    Some modems may need little delay after each part of SMS is sent. This time is in seconds.

14. New setting for a modem: read_delay = number.
    Default value: 0.
    Some modems may require small delay before reading is started. This time is in milliseconds.

15. New setting for a modem: text_is_pdu_key = string.
    Default value: none.
    In some systems the PDU is generated outside the smsd. As the modem is kept open by smsd, external program cannot use it. In this case external program can create SMS file for smsd, and in this file the message body is PDU in the hex format, and To: number should match with this key.

16. New setting for a modem: notice_ucs2 = number.
    Default value: 2.
    Message written using UTF-8 alphabet is tried to convert to GSM alphabet, to save sending costs. Any character outside the GSM alphabet is reported, if value of notice_ucs2 is 2. If the value is at least 1, total number of missing characters is reported. Each character is presented in the sent message file using NOTICE: header. With cyrillic languages the conversion is always done, and the information is not important. Notification can be disabled with value 0.

17. Modem setting: report = yes/no/disabled.
    This can now have a value disabled, which means that the report is not asked even when the message file has a Report: yes header.

18. More modem settings can now have a special keyword modemname, which is replaced with a name of a modem.
    All of those settings are: device, queues, logfile, eventhandler, eventhandler_ussd, pdu_from_file, regular_run, regular_run_post_run, regular_run_cmdfile, regular_run_logfile and regular_run_statfile.

Outgoing message file:

19. When reading headers, Byte Order Mark is removed, if the file starts with it. Also the EOF character is removed from the end of message body, if cs_convert is set.

20. New headers:
    Language: value
    Language_ext: value
    Value can be number, or variable length string which first macthes.
    Choices are:

    - 0 = basic
    - 1 = Turkish
    - 2 = Spanish
    - 3 = Portuguese
    - 4 = Bengali and Assemese, or Bengali, or Assemese
    - 5 = Gujarati
    - 6 = Hindi
    - 7 = Kannada
    - 8 = Malayalam
    - 9 = Oriya
    - 10 = Punjabi
    - 11 = Tamil
    - 12 = Telugu
    - 13 = Urdu

    Usually it is not necessary to set Language_ext value. When Language is set, Language_ext defaults to the same, and if only Language_ext is defined, Language defaults to basic character set. If nothing is set, default values are taken from the configuration.

21. New header: Text_is_pdu: yes. If this feature is enabled by defining text_is_pdu_key in the configuration, and To: number matches that key, message body is handled as ready made PDU.

( For more information about the next 6 settings, see the 3GPP TS 23.040 standard. )

22. New header: Message_Reference: number. Sets TP-MR field in the PDU. Number can be 0...255.

23. New header: Reject_Duplicates: yes. Sets TP-RD bit in the PDU.

24. New header: Reply_path: yes. Sets TP-RP bit in the PDU.

25. New header: Class: number. Sets the Message Class, 0...3.

26. New header: DCS_hex: value. Sets Data Coding Scheme in the PDU. Note that value must be represented as two hexadecimal digits.

27. New header: Ping: yes. Selects the Short Message Type 0, which is also known as a silent SMS. As this kind of SMS is not stored by the receiving device, report is always requested, even if report was disabled in the configuration.

Bug fixes:

28. When communicating with device, ECHO ON is NOT set automatically when device is socket. This is because network modems may require login and/or password and it is not known when the setting can be made.

08.06.2016 3.1.16beta

The main focus with this version is on Telnet. Most devices need CRLF when communicating, and this is now default. Also subnegotiation is fixed, as it did not work properly in all cases. With these changes SMSTools3 now works well with devices like ConiuGo GPRS GSM Quadband Modem LAN. Thanks to wireless netcontrol GmbH for the test device.

Telnet devices with multiple modules will also work, however this enhancement is not tested by me with such a device. Module selection is based on the patch which was published by the user unterwulf on the support forum on this post.

Documentation is not yet updated. It will be done after beta status has gone.

Any feedback is valuable.

1. New setting for a modem: telnet_crlf = yes/no.
   Default value: yes.
   Defines if CRLF is used instead of LF when communicating with Telnet. This defaults to yes, because many if not all Telnet servers require CRLF.

2. New settings for a modem:
   telnet_cmd_prompt = string.
   Default value: empty.
   telnet_cmd = string.
   Default value: empty.
   Some devices have more than one modem modules, and the Telnet interface wants to know what module to use. The interface may prompt something like "module1, module2, state1, state2, info.", as PORTech MV-372 does. For example the command module1 should be sent to the interface. Use communication mode or some Telnet client to see what exactly is the prompt. Define it as telnet_cmd_prompt, exactly as it was received. Define suitable command as telnet_cmd. Whenever the prompt occurs in traffic, the cmd is sent and wanted module is selected.

3. Multiple socket devices are now allowed to use the same IP and port.

4. New setting for a modem: wakeup_init = string.
   Default value: empty.
   Defines a string or command which is sent to the device when it is initialized, before anything else is done. Any or missing answer is accepted, and smsd continues after a small delay.

5. New header in incoming/sent/failed message files: IMEI: number. Tells the IMEI of a modem which handled the message.

6. New setting for a modem: report_read_timeouts = yes/no.
   Default value: no.
   Defines if all timeout values are written to the log when modem process starts.

7. New setting for a modem: read_timeout_XXX = number.
   Default value: varies.
   Defines a timeout for XXX operation. Use report_read_timeouts = yes to see possible operations (XXX) and current values.

   This is for problematic environments, usually there is no need to change any value. Minimum value is 1. The value defines how many read_timeout's are spent. The setting read_timeout is in seconds and defaults to 5.

8. New setting for a modem: send_retries = number.
   Default value: 2.
   Defines how many times smsd will retry if sending fails.

9. New header in outgoing message file: Retries: number. Defines how many times smsd will retry if sending fails. This overrides send_retries setting.

10. New global setting: log_response_time = yes/no.
    Default value: no.
    With this setting response time in milliseconds is included in the log.

11. New global setting: status_include_uptime = yes/no.
    Default value: no.
    Defines if start timestamp and uptime are printed to the end of status file, with empty line as delimiter. For example:

        Status:     16-06-07 00:16:49, irrri-------
        SONERA:     16-06-07 00:16:45, Idle,      131267, 0, 4666, ssi: -71 dBm (Excellent), ber: < 0.2 %
        ELISA:      16-06-07 00:16:45, Receiving, 133877, 3, 4741, ssi: -79 dBm (Good), ber: < 0.2 %
        DNA:        16-06-07 00:16:47, Receiving, 127181, 0, 4708, ssi: -65 dBm (Excellent), ber: < 0.2 %
        SAUNALAHTI: 16-06-07 00:16:48, Receiving, 128495, 1, 4678, ssi: -79 dBm (Good), ber: < 0.2 %
        SAUNA2:     16-06-07 00:16:45, Idle,      5640,   9, 488,  ssi: -77 dBm (Good), ber: < 0.2 %

        Start:      16-04-03 19:30:38, up 64 days, 4:46

    This setting defaults to no, so that existing external parsers or applications are not affected.

12. When communicating with device, like smsd -C GSM1, alternative for Ctrl-Z can be defined using -zx argument. Single byte character is accepted as x.

13. When communicating with device, ECHO ON is set automatically.

14. When performing outgoing character set conversion with GSM alphabet, Nonbreakable space and Tab are changed to Space.

15. When moving files between directories, fopen failures are logged and smsd retries after a small delay.

16. Empty outgoing files are ignored as before, and now files smaller than 8 bytes are ignored too.

17. If a file has no access, smsd retries once after a small delay.

18. Temporary files are now using TMPDIR or TEMPDIR environment variable for the path, if available.

19. When smsd processes sleeps, they sleep longer time at once and less often to reduce CPU load.

20. Mainspooler will reap stopped (<defunct>) modem processes.

21. Smart logging is done even when the loglevel is below 7 (debug).

22. Total time of continuous trouble is logged.

23. "device busy, waiting" is not logged anymore.

24. When a modem is first time initialized, smsd tries to set verbose mode if necessary.

Bug fixes:

25. Fixed a Telnet subnegotiation processing method.

26. When a file is locked, fsync is used instead of sync after close. This caused remarkable delays on large servers when smsd was running as root.

27. When queues are used, queues setting for a modem is no more mandatory if outgoing is disabled.

28. When defining queues or priviledged_numbers for modems, initial values from [default] section are now completely ignored.

21.10.2012 3.1.15

After a long time, some changes and fixes are pending, but in this version only one fix is applied. The bug with lockfiles is very critical, and hopefully the creation of new package is easier for maintainers, when only one fix is done.

Bug fixes:

1. When creating a lockfile, main process used incorrect offset -1 with the table of names of processes. This caused segmentation fault when smsd was compiled using latest compilers.

21.09.2010 3.1.14

1. New setting for a modem: signal_quality_ber_ignore = yes/no.
   Default value: no.
   Some devices do not support Bit Error Rate when signal quality is asked, and this always provides "Bit Error Rate: not known or not detectable" to the log line and to the status file. With this setting ber can be ignored.

2. When logging "SMS sent...", and there has been retries, count of retries is shown in the log line:
   SMS sent, Message_id: 12, To: 358401234567, sending time 34 sec. Retries: 2

3. When logging "SMS received...", and message is a status report, explanation of status is included in the log line:
   SMS received (report, Message_id: 12, Status: 0,Ok,short message received by the SME), From: 358401234567

4. New setting for a modem: verify_pdu = yes/no.
   Default value: no.
   This setting is for testing purposes. When trying to send SMS and modem does not accept the PDU, there may be a communication problem which breaks the sent PDU. With this setting smsd changes "echo on", and verifies the string which is echoed back after the PDU was sent. In case of mismatch "Verify PDU: ERROR" is printed to the log and also both sent and received strings are logged. In case of success "Verify PDU: OK" is printed to the log. After the verification is done, "echo" is changed back to "off".

5. New setting for a modem: loglevel_lac_ci = number/word.
   Default value: LOG_INFO.
   Sets the verbosity of logging the Location area code and Cell ID and their changes. This requires that AT+CREG? returns location information. It is automatically enabled by pre_init using a command CREG=2. After the Location are code or Cell ID changes, quality of signal is also logged. This feature can be disabled with the setting which is more than current loglevel, for example 8.

6. New setting for a modem: log_not_registered_after = number.
   Default value: 0.
   If it's known that the modem gives "not registered" after a message is sent or received, with this setting number of log messages can be avoided.

7. When "MODEM IS NOT REGISTERED, WAITING..." is logged, also alarmhandler is called with a severity LOG_NOTICE.

8. The script email2sms can handle e-mail with multiple recipients.

9. New global settings:
   logtime_ms = yes/no
   Default value: no.
   logtime_us = yes/no
   Default value: no.
   With these settings the timestamp in the log file can have microseconds or milliseconds shown. These settings can be used when a default format for timestamp is in use. Value is shown after seconds and is delimited with a dot.

   If logtime_format is defined, these settings have no effect. Milliseconds or microseconds can be included in customized logtime_format using keywords timeus or timems.

10. When max_continuous_sending time is reached and smsd will do other tasks, number of messages sent in max_continuous_sending time and average time for one message is logged with loglevel LOG_NOTICE.

11. When the sending of SMS fails, trying time and number of retries are logged.

12. New global setting: shell_test = yes/no.
    Default value: yes.
    When executable_check is enabled, testing of the shell can be omitted with this setting.

Bug fixes:

13. When executable_check was enabled, smsd tested the shell using a /tmp directory for the script. This caused failure when /tmp was mounted noexec. Smsd now uses the incoming directory for the test.

14. Handling of headers failed when /tmp directory was on different mount than /var/spool/sms tree. This caused that message file was not moved to the sent or failed directory.

02.09.2010 3.1.12

1. Handling of files in the spooler directory has changed. When large number of modems are serving the same queue, previously more than one modem tried to pick up the same file and in some cases this caused conflicts and performance loss. This new version will avoid conflicts by using the internal list of file candidates.

2. Global setting devices can be given in the shorten form: devices = <prefix>* <first_number> - <last_number>.
   For example: devices = GSM* 101-164 produces the same as devices = GSM101, GSM102, GSM103, etc. ...GSM164.

3. Modem settings device and logfile can have a special keyword modemname, which is replaced with a name of a modem.
   For example:

   devices = USB0, USB1, USB2
   [default]
   device = /dev/ttymodemname produces: device = /dev/ttyUSB0 and so on...
   logfile = /var/log/smstools/GSM-modemname.log produces: logfile = /var/log/smstools/GSM-USB0.log and so on...

4. It is no more mandatory that the modem section exists in the configuration file. If all settings, including device, are set in the default section, modem section can be left out.

5. Handling of timeout has changed. Previously smsd was expecting the whole answer from the modem in the given time, now timeout occurs if nothing is received in the given time.

6. Lock files contain now process ID, and name of a device. This is for monitoring purposes. With large number of lock files in the spooler it is easy to see what modems are sending messages currently.

7. Modem commands +CSQ and +CPIN now allow "echo on". However, in the normal operation "echo" should be set to off.

8. When a quality of signal is logged, it's level is explained: Marginal (-95dBm or lower) / Workable (-85dBm to -95dBm) / Good (-75dBm to -85dBm) / Excellent (above -75dBm).

9. When reading commands from regular_run_cmdfile, the expected answer can be defined in the begin of a line, between square brackets. See the How to configure for details.

10. When reading a file from the spooler and waiting if it is still growing, the time of waiting is reduced from one second to half seconds.

11. New setting for a modem: smsc_pdu = yes/no.
    Default value: no.
    If the number of SMSC is set in the configuration, or in the message file, the number is included in the PDU instead of changing SMSC with a command AT+CSCA. The number can be presented in international format, or in national format starting with 0.

12. New setting for a modem: voicecall_clcc = yes/no.
    Default value: no.
    Defines if AT+CLCC is used to detect when a call is answered. This is required if modem returns OK immediately after the call and voicecall_cpas cannot be used.

13. When check_memory_method is set to use any CMGL method, larger buffer is used for handling the data. In normal cases about 400 messages can be handled. With some problematic devices the status report may contain extra padding which is almost 300 characters. This causes that about 50 status reports can be handled simultaneously. If this limit is reached, use some other than CMGL method.

14. When a device is a socket (network modem) and is using Telnet protocol, smsd uses the Q Method implementation for option negotiation. Simply, every DO command is answered with WONT, and every WILL with DONT. This feature is very simple, and may not work with some devices or with some options. It is recommended to disable Telnet in the modem setup.

15. New setting for a modem: telnet_login = string.
    Default value: empty.
    If a network modem requires telnet login, it can be defined with this setting.

16. New setting for a modem: telnet_login_prompt = string.
    Default value: login:.
    If telnet_login is used, this setting can be used to change the login prompt.

17. New setting for a modem: telnet_login_prompt_ignore = string.
    Default value: Last login:.
    If telnet_login is used and after successful login motd contains a string which is the same as telnet_login_prompt, this setting can be used to define which kind of a string is ignored. For example, telnet_login_prompt can be login: and telnet_login_prompt_ignore could be Last login:.

18. New setting for a modem: telnet_password = string.
    Default value: empty.
    If telnet_login is used and device requires password, it can be defined with this setting.

19. New setting for a modem: telnet_password_prompt = string.
    Default value: Password:.
    If telnet_password is used, this setting can be defined to change the prompt for password.

Bug fixes:

20. A modem setting trust_spool did not work properly. When the spool directory was trusted, smsd did not check existence of lock files and this caused conflicts and slow performance when large number of modems were serving the same queue directory.

21. When headers of SMS file were handled, temporary files were created to the spooler directory. With large number of modems and slow system this caused unnecessary error messages to the log. Temporary files are now placed into the /tmp directory.

22. When a command was read from the regular_run_cmdfile, control characters were removed from the string. This caused that PDU termination (Ctrl-Z) could not be used.

23. Even when modem_disabled = yes was used, smsd tried to initialize modem if incoming = no was used. Also send_startstring and send_stopstring did not check if a modem is disabled.

21.06.2010 3.1.11

1. A modem setting ussd_convert = number can now have a new value: 4. With this value text part from the USSD answer is converted from hexadecimal dump to ASCII.

2. Some cleanup has been done to the code. The fix for "overlapped buffers" bug now uses it's own function containing a simple loop, instead of using memmove().

19.06.2010 3.1.10

Bug fixes:

1. Global settings international_prefixes, national_prefixes and global and modem setting priviledged_numbers did not always work because of an "overlapped buffers" bug. This failure happened on 32bit environments too.

17.06.2010 3.1.9

1. New setting for a modem: trust_spool = yes/no.
   Default value: yes.
   When a modem process is searching for a file from the spooler, it assumes that the file is complete when it exists and it's not locked. This will speed up sending, because one second delay is avoided. If some other process or checkhandler is creating files directly to the spooler, it may be necessary to set this to no.

2. When searching for a file to send, the lock file is created before the one second delay is spent.

3. New global setting: log_read_from_modem = yes/no.
   Default value: no.
   In some cases, when resolving troubles with a modem, it's useful to see exact data which is received from the modem. This setting is similar than log_unmodified, but displays the data as a hexadecimal dump.

4. Programs regular_run and regular_run_post_run now get the device name as a third argument.

5. The script sendsms has automatic detection of character set and creates Unicode messages if necessary.

6. New setting for a modem: send_handshake_select = yes/no.
   Default value: yes.
   Instead of checking the flag TIOCM_CTS, select() function is used when the serial transmitted is busy. If because of some reason the old style should be used, this setting allows it.

7. With a setting trim_text = yes, whitespaces are not removed if the message is going blank. This is because some people, really, need to send a message which contains only single space character.

Bug fixes:

8. When manipulating strings, the coding style assumed that strcpy() and some other functions start copying from the begin of a buffer. That's how those have worked for years, but it's against what the manual of those functions says about overlapped buffers. With 64bit Ubuntu 10.04 running on Intel processor this caused serious failures. The code is reviewed and fixed.

9. When a Sent header was printed to the incoming message file, wrong variable was used causing that only current date was printed.

10. The setting umask did not work properly and that caused the message files became world writable.

05.05.2010 3.1.8

1. Added "init info" for chkconfig to the init.d script sms3.

Bug fixes:

2. When a signal quality was asked from the modem, and it was explained to the log, incorrect severity was used. Changed severity from LOG_NOTICE to LOG_INFO.

02.05.2010 3.1.7

1. When a signal quality is asked from the modem, it's also explained to the log.

2. The sample script sendsms can now use keys for protecting the usage, for example when running with tcpserver over the internet.

3. The name of a global setting datetime is changed to datetime_format. The old name can still be used because of backward compatibility.

4. The init.d script sms3 now uses option -n for setting the process title: ARGS="-n MAINPROCESS -p$PIDFILE -i$INFOFILE". Smsd still works without that option, because of backward compatibility.

Bug fixes:

5. If a setting voicecall_hangup_ath was not defined in the configuration, default value was handled as yes, but it's defined as no.

6. A modem setting status_signal_quality was not parsed and was giving a startup error.

20.04.2010 3.1.7beta7

1. New global setting: suspend = filename.
   Default value: not in use.
   With this file, any modem process can be suspended. When a process is suspended, the modem port is closed and modem process does not do anything.

   The file is checked before smsd starts sending or receiving. If a name of the device is found from the file, suspend will start. The format of a line in file is: <devicename>: <reason>. Colon is needed, but the <reason> is optional. It is printed to the log. A special line ALL: <reason> can also be used, and this affects for all modem processes.

   When a process is suspended, the file is checked every ten seconds, or more frequently if the delaytime value is smaller.

   When a process is suspended, it listens a signal SIGUSR2. If this signal is received, modem process will send and receive messages once.

2. New setting for a modem: phonecalls_error_max = number.
   Default value: 3.
   Specifies the maximum number of errors before phonecalls are ignored.

Bug fixes:

3. Modem setting socket_connection_errorsleeptime (from 3.1.7beta4) did not work because it's name is longer than the code was able to handle.

18.04.2010 3.1.7beta6

1. A modem setting phonecalls = yes/no can now have a new value: clip, or 2. This value could be used with modems which do not support reading of phonebook, or phobebook cannot be used because entries cannot be deleted. Phocecall is detected using the +CLIP Calling line identification report from a modem.

   When phonecalls = clip is used, a setting hangup_incoming_call is automaticatty set to yes. This is because smsd must hangup a call before it's handled. Smsd also initializes a modem with +CLIP=1 automatically to enable this functionality.

2. File of a missed call has now more headers, like file of a received SMS has:

   - Subject: <modemname>
   - Modem: <modemname>
   - Number: <phone number> (if defined in the configuration)
   - IMSI: <string> (if available)

3. The setting date_filename now applies for files of missed calls too.

Bug fixes:

4. When filename_preview was used, creation of modified filename for message file of a missed call caused modem process to freeze.

5. When dialling of a voicecall ended with timeout, the result was taken from the answer of hangup and was "OK". Now it's "Timeout".

16.04.2010 3.1.7beta5

1. When running smsd as an unpriviledged user and group is defined, given group is added to the group access list which is initialized by reading the group database. In the previous versions of smsd the given group was used as only group.

2. New settings for a modem:

   start = modem command.
   Default value: not in use.
   startsleeptime = number.
   Default value: 3.
   stop = modem command.
   Default value: not in use.
   If defined, start command is sent to the modem when a modem process starts. After a command is sent, startsleeptime is spent. When a modem process is stopping, stop command is sent to the modem.

3. When using queues without provider sorting, it's no more necessary to define providers. The number list of each queue defaults to "catch-all", which is the same as "0,1,2,3,4,5,6,7,8,9,s". See the manual for more details and examples.

Bug fixes:

4. In the 3.1.7beta4, when eventhandler_ussd was used and the answer was read back from the file, extra linefeed was included in the answer string. This linefeed was printed to the log and statfile.

11.04.2010 3.1.7beta4

In addition to other changes, this version contains couple of changes which were provided as a patch by yjh, a member of SMSTools3 Community. This topic contains more details. These changes were originally going to the version 3.2, but because it's still delayed, I publish those changes now.

In 3.2, handling of character sets is based on iconv and the code is widely changed. Because the "iconv" patch in 3.1.7 is not very well tested, it's disabled by default. Edit the src/Makefile to enable the patch, if necessary. The patch requires that UTF-8 is used as a locale.

1. New global setting: logtime_format = format string.
   Default value: compatible with previous versions of smsd.
   With this setting a format of the timestamp in the logging can be set. The format string is strftime() compatible.

2. New global setting: use_linux_ps_trick = yes/no.
   Default value: no/yes
   This setting changes the way how smsd processes are shown in the process list. Instead of command line, processes can be shown like "smsd: MAINPROCESS", "smsd: GSM1" etc. In the Makefile there is a definition which sets the default value for this setting. This is a "Linux trick", it's not quaranteed that this can be used in all possible environments.

3. In the outgoing message file, the setting System_message can now have a value 2 or ToSIM for communicating with SIM applications. SMS is sent as SS (no show) and stored (sent) to SIM. Currently this only works with binary messages.

4. If USE_ICONV is defined in the src/Makefile, iconv is used for character set conversions. The current implementation works with Unicode and UTF-8 and could be used with cyrillic languages.

5. New global setting: date_filename_format = format string.
   Default value: compatible with previous versions of smsd.
   With this setting a format of the timestamp in filenames (date_filename >= 0) can be set. The format string is strftime() compatible.

6. New setting for a modem: device_open_retries = number.
   Default value: 1.
   Defines how many times smsd will retry when cannot open a device. When maximum number of retries is reached, modem process will call alarmhandler and stop. With value -1 smsd will retry forever.

7. New setting for a modem: device_open_alarm_after = number.
   Default value: 0.
   After defined number of retries, an alarmhandler is called. Smsd still continues trying, if device_open_retries value is bigger.

8. New setting for a modem: device_open_errorsleeptime = number.
   Default value: 30.
   Defines how many seconds the smsd will sleep after an error with device open.

9. New setting for a modem: socket_connection_errorsleeptime = number.
   Default value: 5.
   Defines how many seconds the smsd will sleep after an error with socket connection.

10. New command line options: -Ex and -Dx.

    - -Ex encodes a given string to the GSM 7bit packed format. The string can be written using ISO or UTF-8 alphabet.
    - -Dx decodes a given string from GSM 7bit packed format. The result uses ISO alphabet, or UTF-8 if incoming_utf8 = yes is defined in the configuration file.

    Both options can used as a helper for USSD message handlers. When these optios are used, smsd does not start as a daemon. Therefore options can be used even when smsd is running as a daemon.

11. New setting for a modem: ussd_convert = number.
    Default value: 0.
    Defines if a text part from incoming USSD message is decoded. Possible values are:

    1 | Unicode format is converted to UTF-8. This requires that USE_ICONV is defined.
    2 | GSM 7bit packed format is converted to ISO or UTF-8.

    Decoded text is appended to the original answer with two slashes and one space character.

12. New setting for a modem: eventhandler_ussd = filename.
    Default value: not in use.
    This setting defines an eventhandler to use with USSD messages. It is possible to use the same script or program which is used as eventhandler, but it's not a default because basically those scripts are not compatible without modifications.
    After an USSD message is received, and probably ussd_convert is done, eventhandler_ussd is called. Smsd checks what is the current character set of a modem and creates a temporary file which contains the USSD answer. Arguments for the eventhandler_ussd are:

    $1 | "USSD" keyword.
    $2 | Filename (which contains the answer).
    $3 | Devicename.
    $4 | Character set.
    $5 | Command what was used to get the USSD answer.

    Eventhandler_ussd can do whatever is needed with the USSD answer. It can also modify the answer, or delete the file. After eventhandler_ussd returns, smsd will check if the file still exists. If it exists, it's first line is taken as a new answer. Modified answer is then logged and probably printed to the regular_run_statfile.

Bug fixes:

13. Removed reasons for compiler warning messages when compiling with -W -Wall under x64.

14. In 3.1.7beta2 socket_connection_retries was counted incorrectly.

30.03.2010 3.1.7beta3

One important feature has been requested, but I forgot to include it in the previous version :(. So here it is:

1. New setting for a modem: regular_run_post_run = filename.
   Default value: not in use.
   This setting can define the second script or program which is executed regularly. The same script with regular_run can be used. The script gets an argument $1 which is PRE_RUN for regular_run and POST_RUN for regular_run_post_run. There is also the second argument $2, which includes a definition of regular_run_statfile.
   This is how the regular_run for a modem currently works:

   - If regular_run is defined, it's executed with arguments PRE_RUN and regular_run_statfile. A modem is closed while the script is running. regular_run_statfile is available from the previous run.
   - regular_run_statfile is deleted.
   - If regular_run_cmdfile is defined and the file exists, commands from this file are sent to the modem. If regular_run_logfile is defined, results are written to the file. If regular_run_statfile is defined, results are written to this file too. NOTE: regular_run_cmdfile is deleted after commands are handled. Use PRE_RUN phase or an external process to create this file.
   - If regular_run_cmd, one or more, is defined, commands are sent to the modem. Results are logged and written to the statfile, if defined.
   - If regular_run_post_run is defined, it's executed with arguments POST_RUN and regular_run_statfile.

29.03.2010 3.1.7beta2

1. Smsd can connect directly to the network modem. This enhancement is provided by Hubert Gilch, SEP Logistik AG.

   A device definition which starts with @ character is handled as a socket. Format for the internet host is: @<host_or_ip>:<port>. Host definition can be name or IP address.

2. New setting for a modem: socket_connection_retries = number.
   Default value: 11.
   Defines how many times smsd will retry when a socket connection fails. When maximum number of retries is reached, modem process will call alarmhandler and stop. With value -1 smsd will retry forever.

3. New setting for a modem: socket_connection_alarm_after = number.
   Default value: 0.
   After defined number of retries, an alarmhandler is called. Smsd still continues trying, if socket_connection_retries value is bigger.

4. New setting for a modem: report_device_details = yes/no.
   Default value: no/yes.
   Defines if a details from device are printed to the log when modem process is starting. With beta versions of smsd this setting defaults to yes, otherwise it defaults to no.

5. New setting for a modem: using_routed_status_report = yes/no.
   Default value: no.
   Smsd can detect routed status reports, but usually it's not recommended to use them. Modems should store status reports as an ordinary messages, which can be read when smsd will need them. However, some modem cannot store status reports, and therefore routing is the only way to get them. With this setting smsd will change some severity and text of a logging.

6. New setting for a modem: routed_status_report_cnma = yes/no.
   Default value: yes.
   Defines if +CNMA acknowledgement is needed to send after routed status report was received.

7. New setting for a modem: phonecalls_purge = yes/no/string.
   Default value: no.
   Usually missed calls are deleted from the device using AT+CPBW=index command. Some modems do not support this command, and have an alternative way to clear Missed Calls storage. With setting yes, this feature uses Siemens compatilbe way for purging: AT^SPBD="MC". Another command can be defined as a string.

8. New setting for a modem: voicecall_vts_quotation_marks = yes/no.
   Default value: no.
   Defines if quotation marks are used when sending VTS command to the modem. NOTE: previously quotation marks were used, now this setting default to no.

9. New setting for a modem: voicecall_cpas = yes/no.
   Default value: no.
   Defines if AT+CPAS is used to detect when a call is answered. This is required if modem returns OK immediately after the call.

10. New setting for a modem: needs_wakeup_at = yes/no.
    Default value: no.
    After being idle, some modems do not answer to the first AT command. For example with BenQ M32, there can be OK answer, but in many times there is not. To avoid error messages, smsd first send AT and read the answer if it's available.

11. New setting for a modem: keep_messages = yes/no.
    Default value: no.
    Defines if messages are not deleted from the device. Unlike a global setting keep_messages, smsd continues running.

12. New global setting: umask = value.
    Default value: empty.
    Effective umask for smsd can be set in the configuration file. Value can be hexadecimal, decimal or octal format.

13. New global setting: log_unmodified = yes/no.
    Default value: no.
    In some cases, when resolving troubles with a modem, it's useful to see what kind of line ends were received from the modem. With this setting spaces and line ends are not removed from the string which is logged. This setting overrides the setting log_single_lines.

14. New global setting: trim_text = yes/no.
    Default value: yes.
    With this setting trailing whitespaces are removed from the outgoing message. Does not effect with messages written using Unicode or GSM alphabet.

15. When a modem process is starting, it's checked if reading of messages is supported. This version will not do the check, if a device is not going to read incoming messages.

16. When checking the PIN, some modems include quotation marks in the answer. Some modems may leave a space away after +CPIN:. Those kind of answers are now handled.

17. When initializing a modem, and it does not respond, after 5 retries the port is closed and reopened.

18. When handling the smsc setting from configuration file, extra + sign is removed from it.

19. Message counter file (for example GSM1.counter) is always created, even when messages are not yet sent.

20. Startup check will check that any modem does not use duplicate device name.

21. Locked files in the spooler: as in the past, *.LOCK files are handled as locked files, and now LOCKED* files are handled as locked too.

22. When using a communication mode, it's no longer necessary that the name of a modem is in the devices list. It's enough that a section for the modem exists. Note, that still no more than one smsd can run at the same time.

23. When sending SMS and From field is not defined, content of a setting number is printed to the log: "Sending SMS from <number> to <destination>". If the setting number is not defined, log line is as before: "Sending SMS from to <destination>".

Bug fixes:

24. When a GMGL list was handled and sorted, older message was not read first. With this fix messages are sorted by the date and time when a message was sent.

25. When reading messages from the modem, some modems return only LF characters, even when both CR and LF should be returned. Some modems may give the answer with double line-ending. Both cases are now handled.

01.02.2010 3.1.7beta

This is not the major version change, it's publishing is still delayed. This version continues 3.1.x and contains some minor features which may be useful for some users.

1. New global setting: ignore_exec_output = yes/no.
   Default value: no.
   Usually eventhandlers should not output anything. If there is some output, it usually means that some error has occurred. These errors are often problematic, because that output cannot be seen and error is therefore not notified. Smsd will print any output from the evenhandlers to the log file. This output can also be used for debugging purposes, but usually debugging should be done by running eventhandler manually. With a setting ignore_exec_output = yes this feature can be disabled.

30.11.2009 3.1.6

This version was released because of a critical bug in the handling of a concatenation storage. Users of version 3.1.5 should upgrade to this version. As a workaround, disable purging of a concatenation storage with a global setting in the smsd.conf: ic_purge_hours = 0. If ic_purge_minutes was set, remove the setting or change it to 0.

1. Outgoing message files with the same timestamp are selected by name.

2. Carriage return characters are removed from the modem response when writing it to the log.

3. Trouble logging is slightly enhanced: if something was printed to the log and trouble is over, "Everything is ok now" is printed to the trouble log.

4. Regular_run_statfile is created using the same mask as the message files.

Bug fixes:

5. Purging of a concatenation storage freezed modem process in some environments. This was caused by too small buffer.

6. With incoming Unicode messages the Euro character was decoded incorrectly.

7. When checkhandler spooled a message and returned a value 2, trouble logging was started.

8. Destination number was accepted even if it contained 's' only.

9. Check_memory_method using CMGL did not accept zero as a message number.

01.06.2009 3.1.5

1. New global setting: smart_logging = yes/no.
   Default value: no.
   This feature is available when file based logging is used. If loglevel is less than 7 (for example "notice" is a good choise with smart_logging), trouble log (with loglevel 7) about whole communication is written to different file if there has been any errors.

   "Whole communication" means sending single SMS, receiving single SMS, and other things what smsd will do after idle time is spent. When communication starts, all possible log lines are collected to internal buffer and only loglevel lines are written to the logfile. If during communication there are any errors, all collected lines are printed to trouble log when communication reaches it's end.

   This feature was made because with loglevel 7 logfile grows very much and fast, and debug level is not usually needed when there was no any errors. In case of errors it's important to see whole communication, not just a single line which says that "something happened".

   File name is created with the rule: if lenght of logfile setting is more than 4 characters and setting ends with ".log", trouble log filename will end with "_trouble.log". If length is less than 4 or setting does not end with ".log", trouble log filename is logfile appended with ".trouble". In usual cases logfile is /var/log/smsd.log and trouble log filename will be /var/log/smsd_trouble.log, or in some (Debian, Ubuntu, ...) distributions: /var/log/smstools/smsd.log and /var/log/smstools/smsd_trouble.log.

2. New setting for a modem: unexpected_input_is_trouble = yes/no
   Default value: yes.
   With smart_logging, this setting defines if unexpected input activates trouble log.

3. New global and modem setting: hangup_incoming_call = yes/no
   Default value: no.
   If set to yes and detected unexpected input contains "RING", incoming call is ended. Use setting voicecall_hangup_ath to define if "ATH" is used to make hangup instead of "AT+CHUP".

4. New setting for a modem: communication_delay = number
   Default value: 0.
   Only some very problematic modems may need this setting. Defines minimum time in milliseconds between latest answer from modem and next command which will be sent to modem.

5. New global setting: status_interval = number.
   Default value: 1.
   If statistics function is enabled and stats directory is defined, smsd writes file named status into this directory. The file contains status of all modems in the first line using Status: header (this is similar than smsd -s outputs to console) and explained status in the next lines using modem's name as a header. Smsd writes status file every status_interval seconds if a status has changed. Value 0 disables this feature.

   For example, the output is like:

       Status:     09-05-27 20:46:17, irir------------
       SONERA:     09-05-27 20:46:09, Idle,      123, 0, 321, ssi: -63 dBm, ber: < 0.2 %
       ELISA:      09-05-27 20:46:12, Receiving, 234, 0, 432, ssi: -73 dBm, ber: < 0.2 %
       DNA:        09-05-27 20:46:06, Idle,      456, 0, 543, ssi: -77 dBm, ber: < 0.2 %
       SAUNALAHTI: 09-05-27 20:46:14, Receiving, 678, 0, 654, ssi: -69 dBm, ber: < 0.2 %

   Timestamp value tells when status is created or modem initialization was last started.

   Status can be: (s) Sending, (r) Receiving, (i) Idle, (b) Blocked, (t) Trouble, (-) Unknown. Trouble -status means that something abnormal has happened and if smart_logging is in use, trouble log will be written.

   Counters are: sent, failed, received. Sent counter is the value from stats/<modemname>.counter file. Smsd does not clear this value. Failed and received counters are from original statistics data and they are cleared each time when stats are stored (stats_interval), or smsd is restarted.

6. New global and modem settings:
   status_include_counters = yes/no
   Default value: yes.
   status_signal_quality = yes/no
   Default value: yes.
   Modem setting overrides global setting. These settings define if message counters and explained signal quality is included in the line of status file.

7. New global and modem setting:
   max_continuous_sending = number
   Default value: 300 (5 min).
   As usual, modem setting overrides global setting. This setting is in seconds and defines how long modem can send messages without doing anything else. After max_continuous_sending time is reached, received messages are checked and other tasks are run.

8. Number of modems can be defined in the src/Makefile. Default value is 64. If you are running SMSTools3 in an embedded device, you can use NUMBER_OF_MODEMS=1 to save memory. This setting also affects the number of provider queues. If you need more provider queues than you have modems, just increase the number of modems value.

9. Modem setting init2 can be used to monitor signal quality. When init2 contains AT+CSQ (uppercase), signal quality is explained in the log file using log level "notice".

10. If shared memory is not in use, global setting stats_no_zeroes defaults to yes.

11. Error message after PDU was sent is changed: Previously: "The modem said ERROR or did not answer.". Now: "The modem did not answer (expected OK)." or "The modem answer was not OK: <the answer what it was>" depending on the answer. This change is because in some cases it's important to see if there was any answer or not.

12. IMSI (International Mobile Subscriber Identity) is now logged with log level "notice". If AT+CIMI query was supported, Product Serial Number is also logged (CGSN).

13. Modem setting voicecall_hangup_ath is now global too.

14. Modem setting queues can be defined using special keyword modemname which is replaced with a name of modem.

15. New section in configuration file: [default]. This section can be used to define default settings for all modems. If setup has large count of similar modems, almost all settings can be defined once in [default] section and only device depended settings like device are required to define in the modem sections. In the future versions this will replace all modem settings which are now defined in the global part of configuration.

    As "default" is now reserved name, it cannot be used as a modem name.

Bug fixes:

16. Smsd did not compile on old GCC because two variables were defined elsewhere than begin of a block.

17. When logged to syslog, modem processes missed the correct program name. Now the program name is always smsd and in addition, MAINPROCESS: title is included in the lines which are from the main process.

18. During the startup check, smsd used file mode 0600 when checking directories. In Cygwin this was not enough when mode 0666 was inherited and directories were 0755. For testing smsd uses now the same mode which is later used to create message files.

11.05.2009 3.1.5beta9

1. Maximum number of provider queues is increased to 64 which is the same as maximum number of modems.

2. New setting for a modem: voicecall_ignore_modem_response = yes/no.
   Default value: no.
   When a voicecall is ringing, some devices give OK answer after couple of seconds even if a call is not yet answered. With this kind of device DTMF tones cannot be sent. If a ringing time is defined in the message file (using TIME: n), the waiting loop is breaked too soon. To avoid this, use voicecall_ignore_modem_response = yes in the modem settings. With this setting call rings n seconds (if not answered) and after this voicecall is over.

3. New setting for a modem: voicecall_hangup_ath = yes/no.
   Default value: no.
   Defines if ATH is used to hangup call instead of AT+CHUP.

Bug fixes:

4. When PDU had no sender address included, decoding failed with an error message "Invalid sender address length: 00".

05.04.2009 3.1.5beta8

1. New setting for a modem: detect_unexpected_input = yes/no
   Default value: yes.
   Before any command is sent to the modem, smsd checks if there is some unexpected input. For example some modem may send new message identification (CMTI) if settings are incorrect. Any unexpected input will be logged.

31.03.2009 3.1.5beta7

1. If signal quality is asked from a modem (when initializing it or when running a regular_run), the result is explained in the log file.
   For example:

       2009-03-17 12:40:05,5, GSM1: CMD: AT+CSQ: +CSQ: 20,0 OK
       2009-03-17 12:40:05,5, GSM1: Signal Strength Indicator: -73 dBm,
       Bit Error Rate: less than 0.2 %

2. New setting for a modem: detect_message_routing = yes/no
   Default value: yes.
   By default smsd tries to detect if a modem is in message routing mode. Before sending a command smsd listens if some data with routed message is available. Also, after a command is sent, smsd checks the answer. In both cases, if there is one or more routed message coming, a notification is written to the log and alarmhandler is called. Routed messages are saved and handled later when smsd can do it.

   NOTE: This checking is done to avoid errors and loss of messages. Routing mode SHOULD NOT BE USED in normal operation. With routing mode it is NOT quaranteed that all messages are delivered. Some devices are in routing mode by default and this feature helps to detect it. Use init = AT+CNMI=... with suitable values to disable routing mode. Values depend on modem, see the manual of a modem for details. All received messages must be stored to the message store which is usually "SM" (SIM card memory).

3. New global setting: shell = filename.
   Default value: /bin/sh.
   Defines which shell is used to run eventhandler and other external scripts.

   During the startup check it is now verified that the shell is accessible and it works. Runtime errors are now logged with details.

4. If running of eventhandler or regular_run fails, an administrative alert is sent (if admin_to is specified). Each process has it's own error status and while the error remains, no more messages are sent unless the problem is first solved.

5. New global setting: adminmessage_device = name.
   Default value: first available device.
   This settings defines which modem is used to send administrative messages when mainspooler detects some trouble.

6. New settings for a modem:
   adminmessage_limit = number
   Default value: 0.
   adminmessage_count_clear = number
   Default value: 0.
   With these settings sending of administrative messsages can be limited. adminmessage_limit, defines a maximum number of messages to be sent. adminmessage_count_clear defines a period to automatically clear the message counter. This value is number of minutes.

7. Timeout for message sending is increased. If your modem still gets timeout, use a modem setting read_timeout = 10 to increase value even more.

8. USSD messages using regular run for a modem feature: You can use a regular_run_cmd = AT+CUSD=1,"*100#",0; to get saldo details of a prepaid SIM. When a command starts with AT+CUSD and the length is more than 9 characters, smsd will wait response which starts with +CUSD: instead of OK string. For example in Finland the response in the log file will be like (here split into three lines):

       2009-03-30 11:56:00,5, GSM1: CMD: AT+CUSD=1,"*100#",0;:
       OK +CUSD: 2,"Liittymäsi saldo on 35.95 EUR ja
       voimassaoloaika päättyy 27.07.2009.",15

9. Sample script sendsms now checks if an user "smsd" is existing, and if it is, ownership of an outgoing file is given to the user "smsd". If you are using some else unpriviledged user to run smsd, change the script variable "smsd_user".

15.03.2009 3.1.5beta6

1. New global settings:
   ic_purge_hours = number
   Default value: 24.
   ic_purge_minutes = number
   Default value: 0.
   ic_purge_read = yes/no
   Default value: yes.
   ic_purge_interval = number
   Default value: 30.
   These settings defines how concatenation storage is purged when internal_combine is used and messages with missing parts are received. Storage is checked every ic_purge_interval minutes. If there are message parts older than defined with ic_purge_hours and/or ic_purge_minutes settings, message parts are deleted. If ic_purge_read is yes, message is stored to the incoming folder. In this case there will be only one part in the file and a header Incomplete: yes indicates that message is broken. Value 0 for both ic_purge_hours and ic_purge_minutes disables this feature.

2. New settings for a modem:
   ms_purge_hours = number
   Default value: 6.
   ms_purge_minutes = number
   Default value: 0.
   ms_purge_read = yes/no
   Default value: yes.
   These settings are used only with SIM600 (or compatible) modems (check_memory_method 5). If multipart message is received with one or more parts missing, incomplete message is removed from the message storage after time defined. Time is calculated from timestamp of first available part. Value 0 for both settings disables this feature. Setting ms_purge_read defines if parts are read before they are deleted. If internal_combine setting is used, parts are stored to the concatenation storage. If missing part(s) are later received, there will be similar timeout before parts are purged. After this the messsage is complete and is stored to the incoming folder.

3. New setting for a modem: read_timeout = number.
   Default value: 5.
   When smsd reads data from a modem, timeout will occur after read_timeout seconds if an acceptable answer is not received. Some very slow devices might need greater value than 5 seconds.

4. A modem setting check_network is enhanced. Possible values are:

   0 no | Network registration is not checked.
   1 yes | Network registration is always checked
   2 | Network registration is checked only when preparing to send messages.

   Default value is 1. If a modem does not support network checking, checking is automatically ignored.
   With value 2 incoming messages are processed faster.

11.03.2009 3.1.5beta5

1. New value for check_memory_method: 5 = CMGL list is used and messages are handled with SIMCOM SIM600 compatible way: Multipart message is handled after all of it's parts are available. After multipart message is handled, only the first part is deleted by the smsd. The modem will delete rest parts by itself.

2. New global and modem settings: priviledged_numbers = list of numbers
   Default values: not in use.
   These lists can be used with check_memory_method values 31, 41, and 5. If a modem setting is defined, it overrides global setting which is default for each modem. List can be comma delimited list of numbers or their parts starting from the left. Maximum 25 priviledged numbers can be defined. When messages are received, messages from priviledged numbers are handled first. First number in the list has highest priority.

09.03.2009 3.1.5beta4

1. New global settings: international_prefixes = value(s)
   and: national_prefixes = value(s).
   Default values: not in use.
   Can be used for automated Type Of Address selection.
   See SMS file (Using Type Of Address selection) for details.

2. New header: To_TOA: value. Can be used for Type Of Address setting. Possible values are unknown, international and national.
   See SMS file for details.

3. If character set conversion incoming_utf8 is used, a header Alphabet: UTF-8 is written to the incoming message file.

4. The script sendsms is enhanced: it now accepts multiple destination numbers. While used from the command line, last argument is taken as a text and all other arguments as numbers. In Debian based distribution scripts can be found from the /usr/share/doc/smstools/examples/scripts/ directory.

5. A function tempnam is not used anymore. It is removed because of a compiler warning which said that "using is dangerous". However, it was used safely but compiler did not know it :). Now there are no any warnings while compiling smstools3. NOTE that after this change there must be /tmp directory available in the system.

6. Baud rate 460800 is now supported. All other possible rates are supported too. Default baudrate is now 115200 which is good value for many old modems too.

7. The smsd main process checks periodically if it's own pid is still in the pidfile. If it's not, it means that another smsd was started and it's illegal to run more than one daemon at once. To avoid problems, all other than latest smsd will stop with logfile and alarmhandler notice. Usually this kind of usage happens in testing, in productive environments init.d/sms3 script should always be used to start and stop the smsd.

   Update: 3.1.5beta7: this checking is not done in Cygwin, when os_cygwin = yes is defined. This is beacause Windows locks serial ports and another modem process will not start.

8. New global setting: keep_messages = yes/no.
   Default value: no.
   This is for testing purposes. Smsd runs as usual but messages are not removeed from the modem. After all messages are read, smsd will stop. Use this with one modem only.

9. New value for check_memory_method: 4 = CMGL list is used and messages are deleted after all messages are read. There is also some more new values, see the How to configure for details.

10. Default cmgl_value is 4 which is good for most modems.

11. New global and modem setting: internal_combine_binary = no. In this version all multipart messages including binary messages are combined internally. Setting internal_combine now defaults to yes. When a binary message is combined, UDH is removed from the message body and it's shown as a header line.

Bug fixes:

12. While retrieving identification from device, if IMSI was not supported, CGSN was not tried because ERROR text was removed incorrectly.

13. Phonecall reading freezed process if there was incorrect syntax (broken answer) from a modem.

16.02.2009 3.1.5beta3

1. When a modem is first time initialized, support for reading of messages is checked. If it looks like reading is not supported, a notice is written to the log and alarmhandler is called. This is general issue with S60 based phones. See F.A.Q. for more details.

2. Log file size more than 2GB is now supported.

3. When sending or spooling is failed, "Failed: timestamp" header is printed to the message file.

Bug fixes:

4. When a CMGL method (available from 3.1.5beta) was used to check incoming messages, there was a delay when modem did not have any messages.

03.02.2009 3.1.5beta2

1. Modem setting send_delay = number has slightly enhanced:
   Value 0 now means that whole string is sent at once without any delays. This resolves slow communication with LAN based multiport servers, like Digi Portserver II. If, for some reason, "tcdrain" is still needed after sending, use value -1.

30.11.2008 3.1.5beta

1. New setting for a modem: number = string.
   Default value: empty.
   SIM card's telephone number. If not empty, it is stored to the message files using header "Number:".

2. New global setting: delaytime_mainprocess = number.
   Default value: not in use.
   If this value is not set, delaytime setting is used in the main process. With this setting outgoing messages can be checked more frequently than incoming messages.

3. HDR_Modem header is printed to incoming messages too. There is still HDR_Subject header presented for backward compatibility.

4. New command line argument: MAINPROCESS. Each modem process will change this with it's own name. With long modem names underscores like MAINPROCESS___ can be used.

5. Failure with network registration will stop the modem process only if SIM was never registered successfully.

6. Phonecalls are read even if incoming messages are not read.

7. Configuration file: Only whole line comments are now allowed. For example:
   # This comment line is valid.
   devices = GSM1 # This kind of comment is invalid.

8. Queue directory definitions are checked. If there is similar typed definition for more than one queue, it's reported and smsd does not start.

9. New setting for a modem: check_memory_method = number
   Default value: 1.
   Defines how incoming messages are checked:

   0 | CPMS is not supported. Default values are used for used_memory and max_memory.
   1 | CPMS is supported and must work. In case of failure incoming messages are not read.
   2 | CMGD is used to check messages. Some devices does not support this.
   3 | CMGL is used to check messages. Some devices are incompatible with this.

10. New setting for a modem: cmgl_value = string
    Default value: empty.
    If check_memory_method = 3 is used, correct value for AT+CMGL= command must be defined. This value depends on the modem.

Bug fixes:

11. Filename preview for sent and failed files was generated using GMS alphabet version of a message text. Because of this, skandinavian characters were not recognized and underscore was used. This is fixed.

12. When SMSC: was set in the message file, this caused an infinite loop.

11.08.2008 3.1.3

1. New setting for a modem: voicecall_vts_list = yes/no.
   Default value: no.
   Defines how VTS command is used to create DTMF tones: yes = AT+VTS=1,2,3,4,5 (list is used), no = each tone is created with single command like AT+VTS="1";+VTS="2" etc.

Security fix:

2. Tone definition string used to make a voicecall was not checked and it was possible to send user entered AT commands to the modem.

10.08.2008 3.1.2

Bug fixes:

1. Signal handlers are now silent. Previously informative messages were written to the log but at least in some environments this caused process to hang when logging function was called twice. This fix has no effect to the run script like /etc/init.d/sms3.

06.08.2008 3.1.1

1. New setting for a modem: messageids = number.
   Default value: 2.
   Defines how message id's are stored: 1 = first, 2 = last, 3 = all. When all id's are stored, numbers are delimited whith space and there is one space and dot in the end of string.

2. Destination number can have minus characters, like 358-40-111 2222.

3. If a modem is used for sending only, it is initialized when a device spooler is started.

4. Filename preview is applied for sent and failed files too.

5. While checking the network registration status, some modems include extra space character in the answer. All space characters are now removed before second field of answer is checked. The format like "+CREG: 000,001" (Motorola) is now accepted. All additional fields are remove before testing.

6. New global setting: executable_check = yes/no.
   Default value: yes.
   This setting defines if all executables are checked during the startup check. Usually eventhanler, alarmhandler etc. are shell scripts or some other single files which can be executed and therefore checked simply. If using a settings like eventhandler = /usr/local/bin/php -f /usr/local/bin/smsd_eventhandler.php, the check will fail and smsd will not start unless executable_check = no is defined.

7. If stats directory is defined, smsd will store and update message counter files in this directory.

8. If a file which is failed to send is empty, it's deleted even if there is failed folder defined.

9. While checking the network registration, result 3 (registration denied) will stop the modem process after two retries.

10. PIN handling is slightly improved. If a modem needs PIN, but there is no PIN defined in the configuration file, the process will stop.

11. Some modems do not include "OK" in the answer for CPMS query. In this case timeout time will be spent, but after this the answer is accepted if it includes at least 8 commas.

Bug fixes:

12. While reading PDU string from file and directory was defined for pdu_from_file setting, file handle for directory was not closed after finding the PDU file. After a while this caused modem process to stop with error message "Too many open files".

11.05.2008 3.1

General:

1. While running as an unpriviledged user, outgoing files which are not writable for smsd are re-created to fix the permissions.

2. In the log, a process id is now included in the "started" message.

3. Message sending time (how long it took) is logged. Some other changes and enhancements is also applied to the logging.

Outgoing message file:

4. Binary message can now have UDH-DATA defined.

5. New header: System_message: yes. With this setting message is sent as a system message. This kind of message has fixed values 0x40 for Protocol Identifier and 0xF4 for Data Coding Scheme. A message cannot have User Data Header. Maximum length of a message is 140 bytes.

Incoming message file:

5. New header: Flash: yes. This header exists if a message was received as a flash (immediate display). Note that usually phone devices do not save flash messages, they can be saved manually if necessary.

Configuration file (smsd.conf):

6. New global setting: date_filename = number.
   Default value: 0.
   Defines if date is included to the filename of incoming message. With value 1 like 2007-09-02.GSM1.xxxxxx and with value 2 like GSM1.2007-09-02.xxxxxx.

7. Baudrate 4800 is now supported.

8. New global setting: log_single_lines = yes/no.
   Default value: yes.
   Linefeeds are removed from the modem response.

9. New setting for a modem: check_network = yes/no.
   Default value: yes.
   Network checking can be disabled if it's known that a device cannot support it.

10. New settings for a modem: logfile and loglevel.
    Default value: empty.
    Each modem can now have it's own logfile and loglevel setting. If logfile is not defined, global log is used.

15.08.2007 3.1beta7

After 3.1beta was released at march 2007, lot of changes are tested and implemented to the "stable" version of smsd. This new 3.1beta7 contains all changes and features included in the 3.0.10. Because the feature list of beta's was quite long, it's shortened and this new list contains only the changes and additions not included in the 3.0.10. Older beta versions are removed from the download area because there is no reason to use them.

Configuration file (smsd.conf):

1. New global setting: saved = directory.
   Default value: empty.
   If defined, smsd will store concatenation storage's to this directory (otherwise incoming directory is used). At startup check existing concatenation storages are moved from incoming directory to saved directory. Zero sized files are ignored. If both directories has a storage file with data, fatal error is produced and the smsd does not start.

2. New global setting: phonecalls = directory.
   Default value: empty.
   If defined and reporting of phonecalls is used, message files are store to this directory instead of incoming directory.

3. New setting for a modem: phonecalls = yes/no.
   Default value: no.
   Report phonecalls. Currently only missed calls are reported.
   When a phonecall entry is read from the phone, eventhandler is executed with argument $1 = CALL. This event can be used to make some actions after an unanswered phonecall is received.

4. New global setting: language_file = filename.
   Default value: empty.
   Message files can be written using localized headers. See the localizing for details.

5. New setting for a modem: keep_open = yes/no.
   Default value: yes
   If this is changed to no, a modem is closed while it's not used.

6. Regular_run for a modem: Like in the global part, it is possible to define an external script or program which is executed regularly within a given interval. A modem is available for script and command definitions as well as logging can be defined. See the How to configure for details.

7. New global setting: datetime = format string.
   Default value: compatible with previous versions of smsd.

8. Defining loglevels and alarmlevel, can use string value like LOG_NOTICE or "notice".

9. New command line argument -a (ask). In the configuration file there can be multiple choices for values and selections can be done while the smsd is starting.

10. Primary_memory and Secondary_memory settings can now have multiple parameters defined, like SM,SM,SM. Double-quotation marks are not necessary to use in the string.

11. All yes/no values are checked, also the "no" value should be typed correctly. Previously all incorrect values were interpreted as "no". This might have an effect if you have errors in the current setup. Possible errors are reported at startup and the smsd does not start spooling.

12. Device names are checked. Only alphanumeric characters, underline, minus-sign and dot are allowed.

13. All errors are reported, not just the first one found.

14. Numbers for the provider sorting can be given in the grouped format. (3.1beta4).

15. New global setting report = directory. This can be used to define where status report files are stored. By default they are stored to the Incoming Folder. (3.1beta3).

16. New global settings: keep_filename and store_original_filename to select file naming convention when files are moved between directories. (3.1beta).

17. New global settings: regular_run = filename and regular_run_interval = number. It is possible to define an external script or program which is executed regularly within a given interval. See an usage sample on How to run/use. (3.1beta).

18. Whitelist can specify a queue to be used with a list of numbers. See more details. (3.1beta).

19. New global setting: admin_to, destination number for administrative messages. Messages are sent without using the filesystem. (3.1beta).

20. New modem settings: message_limit, defines a maximum number of messages to be sent. message_count_clear defines a period to automatically clear the message counter. This value is number of minutes. (3.1beta).

21. New global setting: filename_preview = number. Defines how many characters of message text is concatenated to the name of messsage file. Currently works with incoming message files. (3.1beta).

Outgoing message file:

22. New header: Include: filename. Some parts of a message can be read from different file. If an included file contains only text part, it should begin with one empty line.

23. New header: Macro: definition. Works like macros usually do. See the SMS file format for details.

24. Binary message can be automatically splitted to the concatenated messages. With Autosplit value of 0 message is not sent if it does not fit in the single message. All other Autosplit values cause concatenated UDH part to be inserted to the message parts. If a message starts with UDH data (which is the default for binary messages), concatenation header is inserted to the existing user data header. If there is no UDH by the user, a new header is created.

25. Unicode messages can now have part numbering as text (Autosplit: 2).

26. Priority: HIGH accepted case insensitive, all which means "yes" is accepted too (including localized strings).

27. Voicecall can now have TIME: number defined, where number is number of seconds to keep modem calling. After a time has reached, hang up is done. If a call is answered before a time is reached, normal sound playing is done. NOTE that this time counting starts after a command is given to the modem and there will be some delay before receiving device starts ringing. You should test this with your own handset to find a reasonable time which works fine in the network you are using.

28. To: number is accepted in the grouped format, like 358 12 345 6789. The number can also contain * and # character(s). (3.1beta3).

29. While smsd reads the message, all string length's are checked to prevent possible buffer overflows. (3.1beta).

Incoming message file:

30. New header: Length: number. Length of text / data. With Unicode text number of Unicode characters. If non-Unicode text message is stored using UTF-8, number of bytes may differ.

General:

31. While retrieving identification from device, CGSN is tried if IMSI is not supported.

32. Dirty patch for Wavecom SR memory bug is included in the PDU handling. If PDU starts with "000000FF00", first 8 bytes are removed and zeros are catenated to the PDU until it's length is enough. Because of missing information, the Status Report cannot be really fixed. With this patch the SR still can be handled, but all result codes are assumed to be "ok, message delivered".

33. Incoming PDU checking: content of a broken PDU is shown as much as possible.

34. Very simple communication feature is included in this version. If you need to communicate with a device, but do not have any terminal program available, you can start the smsd with a communicate option -C devicename, for example smsd -C GSM1. This runs smsd in terminal mode which can be breaked with Ctrl-C. (3.1beta3).

35. Smsd processes are listening SIGCONT signal to break an idle loops. When the mainspooler has moved a file to the outgoing folder, SIGCONT is sent to all modem processes. This causes a new message to be immediately handled and sent. This is especially important when a delaytime is long (for a modem and directory polling). (3.1beta2).

36. Execution order of checkhandler has changed: When the mainspooler finds a message file, checkhandler is executed first before anything else is done. This allows checkhandler to make changes to the message file, for example queue selecting or "nickname to phonenumber" replacing. The smsd can also be notified with return code 2, if checkhandler has spooled a message by itself. (3.1beta).

37. Execution order of eventhandler has changed: eventhandler is executed after a file is moved to it's final location. File will then have it's final directory and name, and the smsd does not do any prosessing with a file after an eventhanler was called. (3.1beta).

38. When the modem is initialized and modem answers ERROR to some command, an errorsleeptime is spent and a command is tried once again. If a program is going to terminate while the modem is initialized, initializing is interrupted immediately. (3.1beta).

39. Concatenated id start's from the random value between 1 ... 255. (3.1beta).

40. Modem is blocked only if sending has failed because of a modem related reason. (3.1beta).

41. "SMS sent" log information includes a message id and part information (while sending multipart messsages). (3.1beta).

42. Status report log information includes a message id and status value. (3.1beta).

Bug fixes:

43. If both received and sent PDU's were stored to the messsage files, some sent PDU's were lost if a message was received while the smsd was sending a multipart message. This is because the same buffer was used to store PDU's and receiving side cleaned it. Receiving and sending side now uses their own buffer to store PDU's.

18.07.2007 3.0.10

Configuration file (smsd.conf):

1. New global setting: os_cygwin = yes/no. Default value is no. Defines if the smsd is running on Cygwin environment. This information is needed when some process creates outgoing files with incorrect permissions for smsd. If smsd has no write access to the file, it tries to get it using chmod 766.

Bug fixes:

2. Command line argument -t had no effect. This terminal mode is useful when running smsd under Cygwin as a Windows service as it prevents one error message.

3. In QNX, the OS libraries include already an unlock() function, causing a name conflict. The unlock() function of smsd is therefore renamed.

06.07.2007 3.0.9

General:

1. Minor changes to the PDU checking.

   - An incorrect sender number produces only a warning.
   - It now shows error position in the message file.
   - All possible data is checked (unused too) to detect invalid characters and a broken and/or incompatible PDU.

2. Replace: usage is ignored while sending multipart message.

3. Character set conversion now converts incoming "currency symbol" (0x24 GSM) to € character (0xA4 ISO). This can easily be changed in top of charset.c if necessary (should not be any reason).
   The smsd does not send 0x24 while messages are written using ISO/UTF-8 character set.

4. Documentation is updated. Sample configuration files are not, see the How to configure for details of new features.

NOTE for users running smsd with very heavy load:

Current version of smsd moves files between spooler directories using the original file name. If outgoing files are created using a fixed filename (which is not recommended) and lot of files using the same name are created within a short period, it's possible that previous file and it's .LOCK file are still existing in the spooler directory. In this case a new file cannot be moved to the spool. Previously the smsd stopped with a fatal error in this case. Now an alarmhandler is called and after it has returned a file moving is retried. If a file still cannot be moved, the smsd will stop with a fatal error.
The alarmhandler can be used to help with a file moving conflict. The script can wait until a spooler can be used, or it can wait some fixed time like 5 seconds. It can also produce some notices to the administration, if necessary.
In some cases this kind of conflict is a result of a previously happened error in the system which creates outgoing files to send. In this case it's better to let smsd stop, instead of sending couple of thousand messages to somewhere...
In the conflict case the alarmhandler will get following arguments (as an example):

- $1=ALARM
- $2=2007-07-06
- $3=12:00:00
- $4=2
- $5=smsd
- $6=Conflict with .LOCK file in the spooler: /var/spool/sms/outgoing/test_file /var/spool/sms/checked

Thank's for all users who have provided feedback, idea's, code and fixes.

28.06.2007... 3.0.9beta2

General:

1. All incoming PDU's are checked comprehensively. If there is some illegal values in the content or illegal characters in the string or some characters are missing, a problem is reported and handling of a broken PDU is aborted. However, all possible junk cannot be detected because the PDU does not have any checksums.

   - In case of errors a new header Error: explanation is printed to the message file. With existense of this header it's easy to detect that there is no usual message content in the file. Text part will tell more details of errors found.
   - In the successfully processed message file there can be one or more Warning: explanation headers telling that some minor issues has detected, but the message is still processed.

2. If an incoming PDU does not match to the mode setting defined in the smsd.conf file, alternative mode is tried before error is reported and handling is aborted. This means that the mode setting is now automatic for PDU's of incoming messages. Note that the outgoing side works like before and you have to use correct mode -setting in the configuration file.

3. Number of devices is increased to 64.

4. While reading a PDU from file, a first line starting with PDU: and space is taken if any exists.

5. There is a simple script smstest.php included in the scripts directory. This script can be used to create sms files using a web browser. The script demonstrates a character set conversion made with PHP and can be used for testing purposes.

6. Installation / uninstallation: path of executables can now be defined in the Makefile.

7. Startup check: permission check for executable scripts is changed. Previously this check required mode 750 for scripts. Now owner and group settings are examined and permission is checked like a shell does.

8. International Mobile Subscriber Identity (IMSI) is asked once from the modem when it's first time initialized. If a device supports this query, information is printed to each incoming message file as a new header: IMSI: 123456789.
   This header is also inserted to sent and failed files.

9. Running as an unpriviledged user: if user is set but group is unset, that user's normal groups (e.g. from /etc/groups) are used. This means you can allow other users on the system access to write messages to the outgoing spool without giving them direct access to the serial port.

10. When finding files from the spooler directories, the oldest file is selected.

11. If a file in the spool directory cannot be handled because of file mode or ownership, error message is printed to the log and alarm handler is called. As soon as the problem is fixed, a file is processed normally. If a file is deleted (outside of smsd), the smsd forgets past problems with it and in the future a file with the same name is processed as usual.

Outgoing message file:

12. New header: Replace: code. Code can be a number from 1 to 7. If a receiving device and SIM supports "Replace Short Message Type n" -feature, a previously received message with the same code is replaced with a new message. Only the messages sent from the same originating address can be replaced. If there is nothing to replace, a message is stored in the normal way.
    Note that the smsd does not use this value while sending concatenated (multipart) message. This is because some phones do not understand concatenated message as a single message and therefore a previously received part might become overwritten if a replace code is used.

13. SMSC setting is allowed only if there is a smsc set in the config file.

Incoming message file:

14. New header: From_TOA: string. Includes a Type Of Address definition with short explanation, like: "From_TOA: 91 international, ISDN/telephone".

15. New header: Report: yes/no. Tells if a status report is going to be returned to the SME.

16. New header: Replace: number. This header is included if a message has a Replace Short Message Type 1..7 (number) defined.

Configuration file (smsd.conf):

17. Setting: pdu_from_file = filename / dirname/ is slightly enhanced. The original setting style will work when it points to the file which is read and then deleted. If this setting ends with a slash and a directory with that name exists, file(s) are read from this directory (and deleted after processing). All files found from the given directory are processed one by one, expect hidden files (name begins with a dot). When this setting points to the directory, no dot's are allowed in any position of a path. Be very careful with this setting while it will delete the content of a whole directory.

18. New setting: log_charconv = yes/no. Default is no. With this setting a details of character set conversions (outgoing UTF-8 to ISO conversion and incoming GSM/ISO to UTF-8 conversion) is printed to the log. If smsd is compiled using DEBUGMSG definition, details are also printed to the console. Logging feature can be useful if you have some troubles with characters and like to know what exactly happens inside the smsd.

19. New setting for a modem: modem_disabled = yes/no. Default is no. This is for testing purposes. Whole messaging system including eventhandlers etc. can be tested without any working modem existing. Sending of messages is simulated in the similar way than with sending_disabled setting. Incoming messages are taken only from the file, if pdu_from_file is defined. No any communication is made between smsd and modem, but a device setting should still exist because smsd wants to open and close a device. If in you testing environment you do not have a priviledges to the usual modem device, like /dev/ttyS0, you can use a definition like device = /tmp/modemfile. If this file exists and is writable for the process owner, it's enough for smsd.

20. Startup check will now report if there is a queue defined but no provider numbers for it.

21. New global setting: store_sent_pdu = value. Default is 1. Possible values are: 0 = no PDU's are stored, 1 = failed (to send) PDU's are stored, 2 = failed PDU's and PDU's of binary/Unicode messages are stored, 3 = all PDU's are stored.

22. Validity period setting now accepts keywords typed mixed/upcase. Keyword can now be given without any numbers, like month means the same than 1 month. This same applies to the outgoing message files. When the smsd is started, a validity period setting is reported to the log if the setting used is less than maximum.

23. Each provider can now have up to 64 numbers defined.

24. Queue, provider and device/queues settings are checked. If there is too much definitions, an error message is displayed and the daemon does not start.

25. stats_interval defaults to 3600 (1 hour).

26. New setting: blockafter = number. Defines number of errors which will cause modem to be blocked. Default value is 3.

27. New setting for a modem: outgoing = yes/no. Default is yes. If set to no, a modem does not handle any outgoing message(s).

Bug fixes:

28. The smsd accepted definition of providers only if it was written as [provider] in the configuration file. Now singular/plural does not matter anymore, you can use [provider] or [providers]. This same applies to the queues: both definitions [queue] and [queues] are accepted.

29. When alphanumeric senders had length more than 9 characters, garbage was appended to the sender's name.

30. Setting of validity period did not accept clean numeric value, like 204 (for 12 weeks). An error message was produced and a default value (maximum possible time) was used. Validity setting also calculated some values incorrectly, like "3 months" produced a maximum time (63 weeks).

31. SMSC setting in the message file did not work. However, usually this setting should not be used.

20.06.2007 3.0.9beta

Outgoing message file:

1. When sending ISO coded message, all characters which cannot be transferred using the GSM character set are replaced with their alternatives. For example Ê becomes E, õ becomes o and so on. In the previous versions of smsd there was a replacement made only for few characters.

Configuration file (smsd.conf):

2. New setting: outgoing_utf8 = yes/no. Default is yes. With this setting automatic UTF-8 to ISO conversion of outgoing files can be switched off, if necessary.

Bug fixes:

3. Internal decoding of Unicode message was not done if a message contained only single part and no user data header including concatenation information. (Some devices include contatenation header even if there is only one part).

03.06.2007 3.0.8

General:

1. Some modem(s), probably because of the firmware bug, gives an "OK" answer while trying to read a message from the empty memory space. This causes an additional five seconds delay to the process, because an "ERROR" answer is expected. New version of smsd accepts both messages without any additional delay.

2. While a PIN code status is asked from the modem, some modems do not include "OK" result code in the response. This has caused an additional delay with those modems. Handling of response is changed to avoid delays. Also some informative message logging is added to the modem initialization.

3. If a modem does not accept the PIN code, the modem process will terminate immediately. Previously it tried to use the same incorrect PIN again and again, and this caused SIM card to be locked and the PUK code was then required.

4. When a message is sent successfully, possible previous errors with a modem are forgotten.

5. Logging of character set conversation problems is changed from LOG_INFO to LOG_NOTICE. Log lines have now name of a modem.

Configuration file (smsd.conf):

6. New setting: incoming_utf8 = yes/no. Incoming message files with ISO or GSM alphabet can be saved using UTF-8 character set. Default is no.

7. If a modem needs some idle time after a PIN is entered, new setting pinsleeptime can be used to produce that. This value is seconds.

8. New setting for a modem: pre_init = yes/no. This settting defaults to "yes" and causes "echo off" and "CMEE=1" commands to be sent to the modem before anything else is done.

Outgoing message file:

9. When an alphabet is ISO or GSM, smsd can also read files stored using the UTF-8 character set.

10. Autosplit works now with Unicode messages. If a message text is longer than 70 Unicode (16-bit) characters, multiple messages are created. Autosplit value 2 (text numbers) is not in use, with this setting a message is splitted as with setting 3, to multiple part with an UDH numbering.
    Please note that while creating a text part for message file, a coding UCS-2BE should be used (not UCS-2).

Bug fixes:

11. Storage for startup error strings was not initialized properly.

12. If a message file in the spooler is readable, but some program is still keeping it open to write, smsd tried to spool the file and failed because the file cannot be deleted. As a fix, the smsd first checks if the message file is writable.

18.05.2007 3.0.7

General:

1. If smsd is compiled without a support for status monitor, command line option -s is not useable.

Bug fixes:

2. Incorrectly written message file without an empty line between the header part and text part caused modem process to scratch if there was previously sent a message with less header lines or message text containing an empty line.

14.03.2007 3.0.6

General:

1. New header Modem: devicename is automatically inserted to the SENT/FAILED message files.

2. Message_id: n and Sent: timestamp headers are inserted to the message file before eventhandler is executed.

20.02.2007 3.0.5

General:

1. Termination handling is changed. Previously the main process sent SIGTERM to the whole process group. With sh shell it was possible that incorrect processes were killed because they were running in the same process group. Also processes started from the eventhandler received SIGTERM and eventhandler was terminated before the job was completelly done. New version of smsd sends SIGTERM to the modem processes only. This allows smooth shutdown to the eventhandlers. If there is some eventhandlers running while the smsd gets a termination signal, an information is written to the logfile and main process will wait until all modem processes are terminated.

2. If smsd is running on terminal (foreground), smsd shuts down when a terminal window is closed.

3. Internal combine can now handle 16-bit message reference numbers too.

4. Log line titles are now completely process based. For example the "SMS received" message tells now which one process (=modem) received that SMS.

22.01.2007 3.0.4

Bug fixes:

1. Incoming PDU was not handled correctly when there was no SMSC information in the PDU string.
   Also note that in this case there will not be From_SMSC: field in the message file, which should be notified by the event handler.

11.01.2007 3.0.3

#### The major change is done to daemonizing:

When smsd is started to background (which is default), it forks itself before running processes are created. This solves some issues when the smsd is started from the sh shell.

It is no more necessary to use the & sign at the end of a starting command line.

There is a command line switch -t available to force smsd to run in terminal (foreground). If logging or debugging messages are printed to the terminal, smsd runs in foreground by default. There is also TERMINAL keyword available in the Makefile to force smsd to run in foreground.

The start-stop script sms3 is updated. The smsd now removes possible infofile and *.LOCK files at startup, it is no more necessary to take care of them in the script.
New script can be used with most operating systems.

See more details on How to run/use.

General:

1. The smstools uses ISO character set in message files. If a locale is set to UTF-8, smsd does not handle outgoing message files correctly. There is sample scripts checkhandler-utf-8 and eventhandler-utf-8 in the scripts directory to demonstrate how character set conversation can be made using checkhandler and eventhandler.

2. While smsd reads the configuration, all string length's are checked to prevent possible buffer overflows.

3. More checks are done at startup. Fatal errors while reading the config are written to the log and starting the daemon is prevented. Executable permissions of eventhandler(s) are checked.

4. Lockfile is detected by finding ".LOCK" from the end of filename instead of the whole string.

5. A logfile setting can be made using the command line argument -l (ell). This overrides the config file setting.

6. If received SMS is status report, log line starts with "SMS received (Report)".

7. It's no more necessary to define user=root to get smsd running as a root.

NOTE for Windows users: If you are running smsd as a Windows service, you need to update settings of cygrunsrv. The smsd should be run in terminal mode and --neverexits option should not be used anymore. See more details on instructions for Windows.

30.11.2006 3.0.2

General:

1. The smsd can be defined to run without root priviledges.

2. System check is performed at startup to avoid some potential problems with permissions of directory structure and some other settings.

3. If a config file cannot be read, the smsd does not stay running.

4. Only the process id of a main process is written to the pid file.

5. Some code cleaning is done to avoid compiler warnings on Solaris 10 (6/06 x86) with gcc.

6. mypath setting is not used anymore.

Configuration file (smsd.conf):

7. user = username and group = groupname settings to change priviledges for the smsd.

8. infofile = filename and pidfile = filename settings to change file locations, needed when the smsd is not running as a root.

These settings can be overridden by the command line arguments.
See the How to configure for details and How to run/use for more details.

Bug fixes:

9. Sample script mysmsd did not read status report correctly while storing it to the MySQL database.

14.11.2006 3.0.1

General:

1. When syslog is used to logging, a modem name is presented in the log line.

2. Outgoing PDU: Data Coding Scheme uses message class bits only when message is sent as an alert (flash).

3. Some code has 'cleaned' to avoid compiler warning messages.

Bug fixes:

4. Syslog call is now made using a format string.

5. There was two compiler warnings (with gcc >= 4) because blacklist.c and whitelist.c missed prototypes of exit() function.

6. Buffer used to store received PDU's was not initialized correctly. This caused a runtime error while concatenating multipart messages on latest Ubuntu releases.

02.11.2006 3.0

Bug fixes:

1. Blacklist and Whitelist handling: fixed incorrect log message when the file was not readable. Also fixed the program termination in those cases.

2. If write_to_modem failed, for example because the modem was not clear to send, put_command did not free the memory used by regexp.

3. While reading a configuration file there was stack misuse which caused device_list become empty while running on ubuntu 6.10.

25.09.2006 3.0beta

This version is based to the SMS Server Tools version 2.2.8.

Some of new features were previously published as an enhancements to the 2.x version. Now these features are officially maintained in this new 3.x version of smstools.

#### New features:

Configuration file (smsd.conf):

1. Received PDU's can be stored to the incoming message file. It's possible to select which kind of PDU's will be stored.

2. Message validity time can be selected for default.

3. Incoming Unicode message can be decoded internally.

4. Incoming multipart message can be combined internally.

5. Dual memory handler: it's possible to read messages from both memories (SIM and Mobile Equipment).

6. Incoming PDU string can be read from the file. This is for testing purposes.

7. Sending can be disabled. This is for testing purposes.

See the How to configure for more details.

Outgoing message file:

8. Priority can be set to high. This also works while the Provider Queue is used.

9. Message validity time can be selected for the message.

10. It's possible to make a voice call with DTMF tones.

11. Binary messages can be presented as a Hex in the message file. There is a Wap Push demo using this feature.

12. After a message is sent, Message_id is stored to the file if a status report was requested.

See the SMS file format for more details.

General:

13. A new sms3 script is available (in the scripts directory) as an alternative for the original sms script. This new script handles some special issues, including a smoother shutdown, multiple instance prevention and force-stop ability.

14. If a modem reading reaches timeout, it will be reported to the log file.

15. If for some reason the file moving fails, destination lock is removed.

16. While creating a log file, file access permissions are limited to 640 (-rw-r-----).

17. Provider definition can now have 's' for short numbers. For example: "FINLAND = 358, s". If this is not defined to any provider, outgoing message file must have a provider queue setting while sending to short number.

Bug fixes:

18. In the outgoing message file the "UDH: yes/no" setting did not work correctly. However using this setting is not necessary because this value defaults to true when it's needed.

19. Short number preceeding with 's' caused number become empty and sending failed.