SMS Server Tools 3
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. The forum is currently read-only, but will open soon. Thu Nov 21, 2024 22:52
SMSTools3 Community » Help and support Bottom

[answered] how to reset the modem

  This topic is locked

Page:  1

Author Post
Member
Registered:
Apr 2011
Location: Iran
Operating system name and version: ubuntu 10.04
Version of smsd: 3
Smsd installed from: sources
Name and model of a modem / phone: moxa external modem
Interface: serial / USB / some adapter...

hello

how to reset the modem after (for example) 60 min?
in minicom program i send this command : atz
when i change the (smsd.conf >>> regular_run_cmd = atz) ,between regular run command and GSM1.sh interference is caused.
Quote
2011-06-28 11:46:54,7, GSM1: Done: regular_run_post_run (modem), execution time 0 sec., status: 0 (0)
2011-06-28 11:46:54,3, GSM1: Exec: regular_run_post_run (modem) said something:
2011-06-28 11:46:54,3, GSM1: ! Error while parsing the answer (balance): 2011-06-28 11:46:54,5, GSM1: CMD: atz: OK
2011-06-28 11:46:54,3, GSM1: ! Error while parsing the answer (expiration): 2011-06-28 11:46:54,5, GSM1: CMD: atz: OK
2011-06-28 11:47:03,6, GSM1: Running a regular_run (PRE_RUN)
2011-06-28 11:47:03,7, GSM1: Running regular_run (modem): /var/spool/sms/regular_run/GSM1.sh PRE_RUN "/var/spool/sms/regular_run/GSM1.statfile" GSM1
2011-06-28 11:47:03,7, GSM1: Done: regular_run (modem), execution time 0 sec., status: 0 (0)
2011-06-28 11:47:03,7, GSM1: -> atz
2011-06-28 11:47:03,7, GSM1: Command is sent, waiting for the answer
2011-06-28 11:47:03,7, GSM1: <- OK
2011-06-28 11:47:03,6, GSM1: Running a regular_run POST_RUN
2011-06-28 11:47:03,7, GSM1: Running regular_run_post_run (modem): /var/spool/sms/regular_run/GSM1.sh POST_RUN "/var/spool/sms/regular_run/GSM1.statfile" GSM1

thank you

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
As you have installed smsd from sources, edit the file smsd.c:

  if (result == 1)
  {
    p = DEVICE.dev_rr_cmd;
    while (*p)
    {
      if (!cmd_to_modem(p, ++cmd_number))
      {
        result = 0;
        break;
      }
      p = strchr(p, 0) + 1;
    }
  }

  if (DEVICE.dev_rr_post_run[0])
  {
    p = "POST_RUN";
    if (DEVICE.dev_rr[0] == 0 || strcmp(DEVICE.dev_rr, DEVICE.dev_rr_post_run))
      writelogfile(LOG_INFO, 0, "Running a regular_run_post_run %s", p);
    else
      writelogfile(LOG_INFO, 0, "Running a regular_run %s", p);

    try_closemodem(1);

    // 3.1.9: added devicename.
    snprintf(cmdline, sizeof(cmdline), "%s %s \"%s\" %s", DEVICE.dev_rr_post_run, p, DEVICE.dev_rr_statfile, DEVICE.name);
    i = exec_system(cmdline, EXEC_RR_POST_MODEM);
    if (i)
    {
      if (DEVICE.dev_rr[0] == 0 || strcmp(DEVICE.dev_rr, DEVICE.dev_rr_post_run))
        writelogfile0(LOG_ERR, 0, tb_sprintf("Regular_run_post_run %s %s returned %i", DEVICE.dev_rr_post_run, p, i));
      else
        writelogfile0(LOG_ERR, 0, tb_sprintf("Regular_run %s %s returned %i", DEVICE.dev_rr_post_run, p, i));
      alarm_handler0(LOG_ERR, tb);
    }
  }

  """"""""" MOVE HIGHLIGHTED CODE BLOCK HERE """""""""

  if (modem_was_open)
    try_openmodem();
  else
    try_closemodem(0);
 
'c' Syntax Highlight powered by GeSHi


Then save, recompile and replace smsd executable.

Just wondering, why do you need to perform soft reset periodically for modem? If it really needs it, it could be included in the init string.

Member
Registered:
Apr 2011
Location: Iran
Topic owner
Dear

My modem does not work after one or two day.
When i send atz command to modem , works without any problem.

This is my config file:

Quote
# Example smsd.conf. Read the manual for a description

devices = GSM1
outgoing = /var/spool/sms/outgoing
incoming = /var/spool/sms/incoming
sent= /var/spool/sms/sent
logfile = /var/log/smsd.log
loglevel = 8
failed= /var/spool/sms/failed
keep_filename = yes

stats = /var/spool/sms/stats
stats_interval = 0

[default]
regular_run_cmd = atz
regular_run_interval = 240
regular_run_logfile = /var/log/smsd_regular_run.log

#[queues]
#Q1 = /var/spool/sms/Q1

[GSM1]
device = /dev/ttyS0
baudrate = 115200
rtscts = no
send_delay = 10
keep_open = no
#pin = 111111
regular_run = /var/spool/sms/regular_run/GSM1.sh
regular_run_post_run = /var/spool/sms/regular_run/GSM1.sh
regular_run_cmdfile = /var/spool/sms/regular_run/GSM1.cmdfile
regular_run_statfile = /var/spool/sms/regular_run/GSM1.statfile

Is there a problem?

Thank you for reply

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
If handshaking (rtscts) is disabled, usually lower baudrate is more reliable. But in your case if the communication with modem is not a problem, there is no reason to change anything.

You could use init = ATZ, but if it's sure that after reset the modem will work at least 4 hours, your current setup is good.

The script GSM1.sh is upgraded, and with it no changes are required to the code of smsd.

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.