|
|
SMS Server Tools 3 Community |
Welcome, Guest. The forum is currently read-only, but will open soon. |
Thu Mar 13, 2025 09:10 |
Page: 1
Keywords: Mode: All keywords (AND) |
Fri Dec 08, 2023 15:03
|
zwpp:
Thanks for the clear information.
Add the setting keep_open = no to the modem section. It might solve such a situation.
the question is still relevant
|
Wed Nov 29, 2023 11:31
|
zwpp: I did as you told Keke, it got better, now the program worked from 2023-11-27 11:52:00 to 2023-11-28 19:06:36 (about 31 hours), after that the connection to the modem was lost and why then the main process was not terminated. After some time, I manually terminated the process and launched it again, everything worked again. I was already thinking of making a daemon that would restart smstools, but the main process does not terminate, so I don’t even know what to do. Please help me.
getting started
2023-11-27 11:52:00,2, smsd: Smsd v3.1.21 started.
2023-11-27 11:52:00,2, smsd: Running as smsd:dialout (114:20).
2023-11-27 11:52:00,7, smsd: Running startup_check (shell): /var/spool/sms/incoming/smsd_script.8YdLPZ /tmp/smsd_data.SVALU0
2023-11-27 11:52:00,7, smsd: Done: startup_check (shell), execution time 0 sec., status: 0 (0)
2023-11-27 11:52:00,4, smsd: File mode creation mask: 022 (0644, rw-r--r--).
2023-11-27 11:52:00,5, smsd: Outgoing file checker has started. PID: 32982.
2023-11-27 11:52:00,7, smsd: All PID's: 32982,32983
2023-11-27 11:52:00,5, GSM1: Modem handler 0 has started. PID: 32983.
2023-11-27 11:52:00,5, GSM1: Using check_memory_method 1: CPMS is used.
2023-11-27 11:52:00,6, GSM1: Checking device for incoming SMS
2023-11-27 11:52:00,6, GSM1: Checking if modem is ready
2023-11-27 11:52:00,7, GSM1: -> AT
2023-11-27 11:52:00,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-27 11:52:00,7, GSM1: <- OK
2023-11-27 11:52:00,6, GSM1: Pre-initializing modem
2023-11-27 11:52:01,7, GSM1: -> ATE0
2023-11-27 11:52:01,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-27 11:52:01,7, GSM1: <- OK
2023-11-27 11:52:01,7, GSM1: -> AT+CMEE=1;+CREG=2
2023-11-27 11:52:01,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-27 11:52:01,7, GSM1: <- OK
2023-11-27 11:52:01,6, GSM1: Checking if modem needs PIN
2023-11-27 11:52:01,7, GSM1: -> AT+CPIN?
2023-11-27 11:52:01,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-27 11:52:01,7, GSM1: <- +CPIN: READY OK
2023-11-27 11:52:01,7, GSM1: -> AT+CSQ
2023-11-27 11:52:01,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-27 11:52:01,7, GSM1: <- +CSQ: 14,99 OK
2023-11-27 11:52:01,6, GSM1: Signal Strength Indicator: (14,99) -85 dBm (Workable), Bit Error Rate: not known or not detectable
2023-11-27 11:52:01,6, GSM1: Checking if Modem is registered to the network
2023-11-27 11:52:01,7, GSM1: -> AT+CREG?
2023-11-27 11:52:01,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-27 11:52:01,7, GSM1: <- +CREG: 2,5, 7AD0, A48A OK
2023-11-27 11:52:01,6, GSM1: Modem is registered to a roaming partner network
2023-11-27 11:52:01,6, GSM1: Location area code: 7AD0, Cell ID: A48A
2023-11-27 11:52:01,7, GSM1: -> AT+CSQ
2023-11-27 11:52:01,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-27 11:52:01,7, GSM1: <- +CSQ: 14,99 OK
2023-11-27 11:52:01,6, GSM1: Signal Strength Indicator: (14,99) -85 dBm (Workable), Bit Error Rate: not known or not detectable
2023-11-27 11:52:01,6, GSM1: Selecting PDU mode
2023-11-27 11:52:01,7, GSM1: -> AT+CMGF=0
2023-11-27 11:52:01,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-27 11:52:01,7, GSM1: <- OK
2023-11-27 11:52:01,7, GSM1: -> AT+CGSN
2023-11-27 11:52:01,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-27 11:52:01,7, GSM1: <- 356356047001140 OK
2023-11-27 11:52:01,5, GSM1: IMEI: 356357493661140
2023-11-27 11:52:02,7, GSM1: -> AT+CIMI
2023-11-27 11:52:02,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-27 11:52:02,7, GSM1: <- 250621012278553 OK
2023-11-27 11:52:02,5, GSM1: IMSI: 250621012278553
2023-11-27 11:52:02,6, GSM1: Checking if reading of messages is supported
2023-11-27 11:52:02,7, GSM1: -> AT+CPMS?
2023-11-27 11:52:02,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-27 11:52:02,7, GSM1: <- +CPMS: "SM",1,15,"SM",1,15,"SM",1,15 OK
2023-11-27 11:52:02,6, GSM1: Checking memory size
2023-11-27 11:52:02,7, GSM1: -> AT+CPMS?
2023-11-27 11:52:02,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-27 11:52:02,7, GSM1: <- +CPMS: "SM",1,15,"SM",1,15,"SM",1,15 OK
2023-11-27 11:52:02,6, GSM1: Used memory is 1 of 15
2023-11-27 11:52:02,6, GSM1: Trying to get stored message 0
2023-11-27 11:52:02,7, GSM1: -> AT+CMGR=0
2023-11-27 11:52:02,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-27 11:52:02,7, GSM1: <- +CMGR: 0,,22 07919759984617F2040B919790001729F90000321172904493210333590C OK
2023-11-27 11:52:02,5, GSM1: SMS received, From: 79090071929
2023-11-27 11:52:02,6, GSM1: Wrote an incoming message file: /var/spool/sms/incoming/GSM1.5hYqDH
2023-11-27 11:52:02,7, GSM1: Running eventhandler: /usr/local/bin/sms2sql RECEIVED /var/spool/sms/incoming/GSM1.5hYqDH
2023-11-27 11:52:02,7, GSM1: Done: eventhandler, execution time 0 sec., status: 0 (0)
2023-11-27 11:52:02,6, GSM1: Deleting message 0
2023-11-27 11:52:02,7, GSM1: -> AT+CMGD=0
2023-11-27 11:52:02,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-27 11:52:02,7, GSM1: <- OK
end
2023-11-28 19:06:14,6, GSM1: Signal Strength Indicator: (16,99) -81 dBm (Good), Bit Error Rate: not known or not detectable
2023-11-28 19:06:14,6, GSM1: Checking if Modem is registered to the network
2023-11-28 19:06:15,7, GSM1: -> AT+CREG?
2023-11-28 19:06:15,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-28 19:06:15,7, GSM1: <- +CREG: 2,5, 7AD0, A48A OK
2023-11-28 19:06:15,6, GSM1: Modem is registered to a roaming partner network
2023-11-28 19:06:15,6, GSM1: Selecting PDU mode
2023-11-28 19:06:15,7, GSM1: -> AT+CMGF=0
2023-11-28 19:06:15,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-28 19:06:15,7, GSM1: <- OK
2023-11-28 19:06:15,6, GSM1: Checking memory size
2023-11-28 19:06:15,7, GSM1: -> AT+CPMS?
2023-11-28 19:06:15,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-28 19:06:15,7, GSM1: <- +CPMS: "SM",0,15,"SM",0,15,"SM",0,15 OK
2023-11-28 19:06:15,6, GSM1: Used memory is 0 of 15
2023-11-28 19:06:15,6, GSM1: No SMS received
2023-11-28 19:06:25,6, GSM1: Checking device for incoming SMS
2023-11-28 19:06:25,6, GSM1: Checking if modem is ready
2023-11-28 19:06:25,7, GSM1: -> AT
2023-11-28 19:06:25,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-28 19:06:25,7, GSM1: <- OK
2023-11-28 19:06:25,6, GSM1: Pre-initializing modem
2023-11-28 19:06:25,7, GSM1: -> ATE0
2023-11-28 19:06:25,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-28 19:06:25,7, GSM1: <- OK
2023-11-28 19:06:25,7, GSM1: -> AT+CMEE=1;+CREG=2
2023-11-28 19:06:25,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-28 19:06:25,7, GSM1: <- OK
2023-11-28 19:06:25,7, GSM1: -> AT+CSQ
2023-11-28 19:06:25,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-28 19:06:25,7, GSM1: <- +CSQ: 15,99 OK
2023-11-28 19:06:25,6, GSM1: Signal Strength Indicator: (15,99) -83 dBm (Good), Bit Error Rate: not known or not detectable
2023-11-28 19:06:25,6, GSM1: Checking if Modem is registered to the network
2023-11-28 19:06:25,7, GSM1: -> AT+CREG?
2023-11-28 19:06:25,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-28 19:06:25,7, GSM1: <- +CREG: 2,5, 7AD0, A48A OK
2023-11-28 19:06:25,6, GSM1: Modem is registered to a roaming partner network
2023-11-28 19:06:25,6, GSM1: Selecting PDU mode
2023-11-28 19:06:25,7, GSM1: -> AT+CMGF=0
2023-11-28 19:06:25,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-28 19:06:26,7, GSM1: <- OK
2023-11-28 19:06:26,6, GSM1: Checking memory size
2023-11-28 19:06:26,7, GSM1: -> AT+CPMS?
2023-11-28 19:06:26,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-28 19:06:26,7, GSM1: <- +CPMS: "SM",0,15,"SM",0,15,"SM",0,15 OK
2023-11-28 19:06:26,6, GSM1: Used memory is 0 of 15
2023-11-28 19:06:26,6, GSM1: No SMS received
2023-11-28 19:06:36,3, GSM1: Couldn't open serial port /dev/serial/by-id/usb-HUAWEI_Technology_HUAWEI_Mobile-if02-port0, error: No such file or directory, waiting 30 sec.
2023-11-28 19:07:06,3, GSM1: Cannot open serial port /dev/serial/by-id/usb-HUAWEI_Technology_HUAWEI_Mobile-if02-port0, error: Device or resource busy
2023-11-28 19:07:06,2, GSM1: Modem handler 0 terminated. PID: 32983, was started 23-11-27 11:52:00, up 1 day, 7:15.
2023-11-28 19:07:06,2, smsd: Modem handler 0 (GSM1) terminated while mainprocess is still running. Exited, status 127.
2023-11-29 16:09:11,2, smsd: Smsd mainprocess terminated. PID: 32982, was started 23-11-27 11:52:00, up 2 days, 4:17.
|
Thu Nov 23, 2023 17:18
|
zwpp: Operating system name and version: Ubuntu server 22.04 / Linux version 5.15.0-89-generic
Version of smsd: 3.1.21
Smsd installed from: apt-get
Name and model of a modem: Huawei E171
Interface: USB
Hello, I encountered the following problem.
After a few hours of correct operation, the modem stops responding to the smds, but when I stop smsd and start it again, everything works again.
Here is the part of the log where the first errors appear:
2023-11-23 12:29:08,6, GSM1: Signal Strength Indicator: (14,99) -85 dBm (Workable), Bit Error Rate: not known or not detectable
2023-11-23 12:29:08,6, GSM1: Checking if Modem is registered to the network
2023-11-23 12:29:08,7, GSM1: -> AT+CREG?
2023-11-23 12:29:08,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-23 12:29:08,7, GSM1: <- +CREG: 2,5, 7AD0, A48A OK
2023-11-23 12:29:08,6, GSM1: Modem is registered to a roaming partner network
2023-11-23 12:29:08,6, GSM1: Selecting PDU mode
2023-11-23 12:29:09,7, GSM1: -> AT+CMGF=0
2023-11-23 12:29:09,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-23 12:29:09,7, GSM1: <- OK
2023-11-23 12:29:09,6, GSM1: Checking memory size
2023-11-23 12:29:09,7, GSM1: -> AT+CPMS?
2023-11-23 12:29:09,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-23 12:29:09,7, GSM1: <- +CPMS: "SM",0,15,"SM",0,15,"SM",0,15 OK
2023-11-23 12:29:09,6, GSM1: Used memory is 0 of 15
2023-11-23 12:29:09,6, GSM1: No SMS received
2023-11-23 12:29:19,6, GSM1: Checking device for incoming SMS
2023-11-23 12:29:19,6, GSM1: Checking if modem is ready
2023-11-23 12:29:19,7, GSM1: -> AT
2023-11-23 12:29:19,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-23 12:29:19,7, GSM1: <- OK
2023-11-23 12:29:19,6, GSM1: Pre-initializing modem
2023-11-23 12:29:19,7, GSM1: -> ATE0
2023-11-23 12:29:19,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-23 12:29:19,7, GSM1: <- OK
2023-11-23 12:29:19,7, GSM1: -> AT+CMEE=1;+CREG=2
2023-11-23 12:29:19,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-23 12:29:19,7, GSM1: <- OK
2023-11-23 12:29:19,7, GSM1: -> AT+CSQ
2023-11-23 12:29:19,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-23 12:29:19,7, GSM1: <- +CSQ: 16,99 OK
2023-11-23 12:29:19,6, GSM1: Signal Strength Indicator: (16,99) -81 dBm (Good), Bit Error Rate: not known or not detectable
2023-11-23 12:29:19,6, GSM1: Checking if Modem is registered to the network
2023-11-23 12:29:19,7, GSM1: -> AT+CREG?
2023-11-23 12:29:19,7, GSM1: Command is sent, waiting for the answer. (10)
2023-11-23 12:29:19,7, GSM1: <- +CREG: 2,5, 7AD0, A48A OK
2023-11-23 12:29:19,6, GSM1: Modem is registered to a roaming partner network
2023-11-23 12:29:19,6, GSM1: Selecting PDU mode
2023-11-23 12:29:19,7, GSM1: -> AT+CMGF=0
2023-11-23 12:29:19,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-23 12:29:19,7, GSM1: <- OK
2023-11-23 12:29:19,6, GSM1: Checking memory size
2023-11-23 12:29:19,7, GSM1: -> AT+CPMS?
2023-11-23 12:29:19,7, GSM1: Command is sent, waiting for the answer. (5)
2023-11-23 12:29:20,7, GSM1: <- +CPMS: "SM",0,15,"SM",0,15,"SM",0,15 OK
2023-11-23 12:29:20,6, GSM1: Used memory is 0 of 15
2023-11-23 12:29:20,6, GSM1: No SMS received
2023-11-23 12:29:30,6, GSM1: Checking device for incoming SMS
2023-11-23 12:29:30,6, GSM1: Checking if modem is ready
2023-11-23 12:29:30,7, GSM1: -> AT
2023-11-23 12:29:30,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:29:40,6, GSM1: Pre-initializing modem
2023-11-23 12:29:40,7, GSM1: -> ATE0
2023-11-23 12:29:40,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:29:50,7, GSM1: -> AT+CMEE=1;+CREG=2
2023-11-23 12:29:50,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:30:00,7, GSM1: -> AT+CSQ
2023-11-23 12:30:00,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:30:10,6, GSM1: Checking if Modem is registered to the network
2023-11-23 12:30:10,7, GSM1: -> AT+CREG?
2023-11-23 12:30:10,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:30:20,3, GSM1: Error: Unexpected answer from Modem after +CREG?, waiting 1 sec. before retrying
2023-11-23 12:30:21,7, GSM1: -> AT+CSQ
2023-11-23 12:30:21,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:30:31,7, GSM1: -> AT+CREG?
2023-11-23 12:30:31,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:30:41,3, GSM1: Error: Unexpected answer from Modem after +CREG?, waiting 1 sec. before retrying
2023-11-23 12:30:42,7, GSM1: -> AT+CSQ
2023-11-23 12:30:42,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:30:52,7, GSM1: -> AT+CREG?
2023-11-23 12:30:52,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:31:02,3, GSM1: Error: Unexpected answer from Modem after +CREG?, waiting 1 sec. before retrying
2023-11-23 12:31:04,7, GSM1: -> AT+CSQ
2023-11-23 12:31:04,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:31:14,7, GSM1: -> AT+CREG?
2023-11-23 12:31:14,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:31:24,3, GSM1: Error: Unexpected answer from Modem after +CREG?, waiting 1 sec. before retrying
2023-11-23 12:31:25,7, GSM1: -> AT+CSQ
2023-11-23 12:31:25,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:31:35,7, GSM1: -> AT+CREG?
2023-11-23 12:31:35,3, GSM1: write_to_modem: error 5: Input/output error
2023-11-23 12:31:45,3, GSM1: Error: Unexpected answer from Modem after +CREG?, waiting 1 sec. before retrying
2023-11-23 12:31:46,7, GSM1: -> AT+CSQ
2023-11-23 12:31:46,3, GSM1: write_to_modem: error 5: Input/output error
In this case, the smsd does not turn off but continues to work and record errors in the log. SMS messages are not received at this time.
If I enter commands
/etc/init.d/smstools stop
/etc/init.d/smstools start
then everything starts working properly again
Here are the smsd settings:
/etc/smsd.conf
devices = GSM1
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
incoming = /var/spool/sms/incoming
logfile = /var/log/smstools/smsd.log
infofile = /var/run/smstools/smsd.working
pidfile = /var/run/smstools/smsd.pid
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
failed = /var/spool/sms/failed
incoming = /var/spool/sms/incoming
sent = /var/spool/sms/sent
stats = /var/log/smstools/smsd_stats
loglevel = 7
checkhandler=/usr/local/bin/ucsautoconvert
eventhandler = /usr/local/bin/sms2sql
receive_before_send = no
autosplit = 3
decode_unicode_text = yes
incoming_utf8 = yes
[GSM1]
device = /dev/serial/by-id/usb-HUAWEI_Technology_HUAWEI_Mobile-if02-port0
incoming = yes
mode = new
baudrate = 19200
rtscts = yes
cs_convert = yes
memory_start = 0
pdu_from_file = /var/spool/sms/GSM1-PDU
ucsautoconvert
#!/bin/bash
if [ "$1" == "RECEIVED" ]; then
if sed -e '/^$/ q' < "$2" | grep "^Alphabet: UCS2" > /dev/null; then
TMPFILE=`mktemp /tmp/smsd_XXXXXX`
sed -e '/^$/ q' < "$2" | sed -e 's/Alphabet: UCS2/Alphabet: UTF-8/g' > $TMPFILE
sed -e '1,/^$/ d' < "$2" | iconv -f UNICODEBIG -t UTF-8 >> $TMPFILE
mv $TMPFILE "$2"
fi
fi
sms2sql
#!/bin/bash
SQL_HOST=localhost
SQL_USER=user
SQL_PASSWORD="***"
SQL_DATABASE=smsd
SQL_TABLE=sms_log
PATHSMS="/var/spool/sms/incoming";
DATE=`date +"%Y-%m-%d %H:%M:%S"`
#Extract data from the SMS file
FROM=`formail -zx From: < $2 | sed 's/"//g'`
TO=`formail -zx To: < $2`
#Remove plus sign, spaces, minus and short number prefix
TO=`echo "$TO" | sed 's/ //g' | sed 's/+//g' | sed 's/s//g' | sed 's/-//g'`
SUBJECT=`formail -zx Subject: < $2`
SENT=`formail -zx Sent: < $2`
TEXT=`sed -e '1,/^$/ d' < $2`
TEXTSQL=$(echo "$TEXT" | sed 's/\\/\\\\/g' | sed 's/\"/\\\"/g')
#Set some SQL parameters
if [ "$SQL_PASSWORD" != "" ]; then
SQL_ARGS="-p$SQL_PASSWORD";
else
SQL_ARGS="";
fi
SQL_ARGS="-h $SQL_HOST -u $SQL_USER $SQL_ARGS -D $SQL_DATABASE -s -e"
#Insert a new entry into the SQL table
if [ "$1" = "FAILED" ] || [ "$1" = "SENT" ]; then
mysql $SQL_ARGS "insert into $SQL_TABLE (type,sent,sender,receiver,msgid,text) values (\"$1\",\"$DATE\",\"$FROM\",\"$TO\",\"$3\",\"$TEXTSQL\");";
elif [ "$1" = "RECEIVED" ]; then
mysql $SQL_ARGS "insert into $SQL_TABLE (type,sent,received,sender,receiver,text) values (\"RECEIVED\",\"$SENT\",\"$DATE\",\"$FROM\",\"$SUBJECT\",\"$TEXTSQL\");";
elif [ "$1" = "REPORT" ]; then
#Extract more data from the status report file
DISCHARGE=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Discharge_timestamp:`
MSGID=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Message_id:`
STATUS=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Status: | cut -f1 -d,`
if [ "$MSGID" != "" ]; then
ID=`mysql $SQL_ARGS "select id from $SQL_TABLE where receiver=\"$FROM\" and type=\"SENT\" and msgid=\"$MSGID\" order by id desc limit 1;"`
mysql $SQL_ARGS "update $SQL_TABLE set received=\"$DISCHARGE\",status=\"$STATUS\" where id=\"$ID\";"
fi
fi
## delete all sms
rm -f $PATHSMS/*
|
Page: 1
Time in this board is UTC.
|
|
|
 |
|
 |
|