gammu-smsd 不发送短信
gammu-smsd not sending SMS's
我在 Ubuntu 上编译了 gammu-1.42,我可以使用以下命令成功发送短信:
echo "test" | /opt/gammu/bin/gammu --sendsms TEXT "0740...29"
但我需要使用 gammu-smsd 从 Postgresql 数据库发送短信。问题是我看不到任何错误消息,我不知道为什么 gammu-smsd 不发送短信,我从工作服务器复制了配置。
所以配置文件是:
[gammu]
port = /dev/ttyUSB1
connection = at19200
logformat = textall
[smsd]
logfile = syslog
debuglevel = 999
service = sql
driver = native_pgsql
Host = 192.168.1.2
User = sms
Password = xxx
Database = hospital
inboxpath = /var/spool/gammu/inbox/
outboxpath = /var/spool/gammu/outbox/
sentsmspath = /var/spool/gammu/sent/
我这样启动 gammu-smsd:
/opt/gammu/bin/gammu-smsd -c /opt/gammu/gammu-smsdrc
我可以在日志中看到 gammu-smsd 正在使用以下查询读取发件箱 table:
SELECT "ID", "InsertIntoDB", "SendingDateTime", "SenderID" FROM outbox WHERE "SendingDateTime" < now() AND "SendingTimeOut" < now() AND "SendBefore" >= localtime AND "SendAfter" <= localtime AND ( "SenderID" is NULL OR "SenderID" = '' OR "SenderID" = '' ) ORDER BY "Priority" DESC, "InsertIntoDB" ASC LIMIT 1
我 运行 针对 Postgresql 的查询很好,查询 returns 我插入的短信 table.
而且日志很大,我一直在提高调试级别,希望能看到错误但没有运气(我还删除了很多行,因为我触及了 Whosebug 最大值):
Apr 28 20:26:11 caido gammu-smsd[4822]: Using SQL service
Apr 28 20:26:11 caido gammu-smsd[4822]: Configuring Gammu SMSD...
Apr 28 20:26:11 caido gammu-smsd[4822]: SHM token: 0x1001112 (16781586)
Apr 28 20:26:11 caido gammu-smsd[4822]: Warning: No PIN code in /opt/gammu/gammu-smsdrc file
Apr 28 20:26:11 caido gammu-smsd[4822]: CommTimeout=30, SendTimeout=30, ReceiveFrequency=15, ResetFrequency=0, HardResetFrequency=0
Apr 28 20:26:11 caido gammu-smsd[4822]: checks: CheckSecurity=1, CheckBattery=1, CheckSignal=1, CheckNetwork=1
Apr 28 20:26:11 caido gammu-smsd[4822]: mode: Send=1, Receive=1
Apr 28 20:26:11 caido gammu-smsd[4822]: deliveryreport = no
Apr 28 20:26:11 caido gammu-smsd[4822]: phoneid =
Apr 28 20:26:11 caido gammu-smsd[4822]: Connected to database: hospital on 192.168.1.2. Server version: 120006 Protocol: 3
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM gammu LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM inbox LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM sentitems LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM outbox LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM outbox_multipart LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM phones LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT "Version" FROM gammu
Apr 28 20:26:11 caido gammu-smsd[4822]: Database structures version: 17, SMSD current version: 17
Apr 28 20:26:11 caido gammu-smsd[4822]: Connected to Database native_pgsql: hospital on 192.168.1.2
Apr 28 20:26:11 caido gammu-smsd[4822]: Created POSIX RW shared memory at 0x7f1ac0d93000
Apr 28 20:26:11 caido gammu-smsd[4822]: Starting phone communication...
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Gammu - 1.42.0]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Connection - "at19200"]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Connection index - 0]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Model type - ""]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Device - "/dev/ttyUSB1"]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Running on - Linux, kernel 5.4.0-72-generic (#80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021)]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: Serial device: DTR is up, RTS is up, CAR is up, CTS is up
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: Setting speed to 19200
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Module - "auto"]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: Escaping SMS mode
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x02/2
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: 1B |0D ..
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: Sending simple AT command to wake up some devices
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x03/3
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: 41A|54T|0D AT.
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 1 "AT"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 2 "OK"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x09/9
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|0D |0D |0A |4FO|4BK|0D |0A AT...OK..
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Enabling echo
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x05/5
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|45E|311|0D ATE1.
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 1 "ATE1"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 2 "OK"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x0B/11
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|45E|311|0D |0D |0A |4FO|4BK|0D |0A ATE1...OK..
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Trying Motorola mode switch
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0A/10
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|4DM|4FO|44D|45E|3D=|322|0D AT+MODE=2.
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 1 "AT+MODE=2"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 2 "ERROR"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Checking line: ERROR
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: AT reply state: 3
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x13/19
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|4DM|4FO|44D|45E|3D=|322|0D |0D |0A |45E|52R|52R|4FO AT+MODE=2...ERRO
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 52R|0D |0A R..
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Seems not to be supported
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Enabling CME errors
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0A/10
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|4DM|45E|45E|3D=|311|0D AT+CMEE=1.
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 1 "AT+CMEE=1"
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 2 "OK"
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x10/16
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|4DM|45E|45E|3D=|311|0D |0D |0A |4FO|4BK|0D |0A AT+CMEE=1...OK..
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x09/9
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|53S|43C|53S|3F?|0D AT+CSCS?.
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 1 "AT+CSCS?"
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 2 "+CSCS: "GSM""
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x1F/31
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|53S|43C|53S|3F?|0D |0D |0A |2B+|43C|53S|43C|53S AT+CSCS?...+CSCS
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 3A:|20 |22"|47G|53S|4DM|22"|0D |0A |0D |0A |4FO|4BK|0D |0A : "GSM"....OK..
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0A/10
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|53S|43C|53S|3D=|3F?|0D AT+CSCS=?.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT+CSCS=?"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "+CSCS: ("IRA","GSM","UCS2")"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x2F/47
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|53S|43C|53S|3D=|3F?|0D |0D |0A |2B+|43C|53S|43C AT+CSCS=?...+CSC
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 53S|3A:|20 |28(|22"|49I|52R|41A|22"|2C,|22"|47G|53S|4DM|22"|2C, S: ("IRA","GSM",
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 22"|55U|43C|53S|322|22"|29)|0D |0A |0D |0A |4FO|4BK|0D |0A "UCS2")....OK..
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Chosen GSM as normal charset
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Chosen UCS2 as unicode charset
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Getting model
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x08/8
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|47G|4DM|4DM|0D AT+CGMM.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT+CGMM"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "+CGMM: LTE WIRELESS MODEM"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x2B/43
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|47G|4DM|4DM|0D |0D |0A |2B+|43C|47G|4DM|4DM|3A: AT+CGMM...+CGMM:
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 20 |4CL|54T|45E|20 |57W|49I|52R|45E|4CL|45E|53S|53S|20 |4DM|4FO LTE WIRELESS MO
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 44D|45E|4DM|0D |0A |0D |0A |4FO|4BK|0D |0A DEM....OK..
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Unknown model, but it should still work
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: [Model name: `LTE WIRELESS MODEM']
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: [Model data: `']
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: [Model data: `unknown']
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: [Connected model - "LTE WIRELESS MODEM"]
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x08/8
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|47G|4DM|49I|0D AT+CGMI.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT+CGMI"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "OK"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x0E/14
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|47G|4DM|49I|0D |0D |0A |4FO|4BK|0D |0A AT+CGMI...OK..
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Manufacturer info received
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: [Manufacturer: OK]
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking for OBEX support
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0B/11
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|52R|4FO|54T|3D=|3F?|0D AT+CPROT=?.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT+CPROT=?"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "ERROR"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: ERROR
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 3
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x14/20
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|52R|4FO|54T|3D=|3F?|0D |0D |0A |45E|52R|52R AT+CPROT=?...ERR
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 4FO|52R|0D |0A OR..
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking for SYNCML/OBEX support
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0C/12
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|53S|59Y|4EN|43C|4DM|4CL|3D=|3F?|0D AT+SYNCML=?.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT+SYNCML=?"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "ERROR"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: ERROR
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 3
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x15/21
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|53S|59Y|4EN|43C|4DM|4CL|3D=|3F?|0D |0D |0A |45E|52R AT+SYNCML=?...ER
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 52R|4FO|52R|0D |0A ROR..
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0D/13
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|24$|54T|53S|53S|50P|43C|53S|57W|3D=|3F?|0D AT$TSSPCSW=?.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT$TSSPCSW=?"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "ERROR"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: ERROR
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 3
......................
Apr 28 20:26:46 caido gammu-smsd[4822]: gammu: Leaving GSM_GetSMSStatus
Apr 28 20:26:46 caido gammu-smsd[4822]: Execute SQL: SELECT "ID", "InsertIntoDB", "SendingDateTime", "SenderID" FROM outbox WHERE "SendingDateTime" < now() AND "SendingTimeOut" < now() AND "SendBefore" >= localtime AND "SendAfter" <= localtime AND ( "SenderID" is NULL OR "SenderID" = '' OR "SenderID" = '' ) ORDER BY "Priority" DESC, "InsertIntoDB" ASC LIMIT 1
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Entering GSM_GetSecurityStatus
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Getting security code status
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x09/9
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|49I|4EN|3F?|0D AT+CPIN?.
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 1 "AT+CPIN?"
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 2 "+CPIN: READY"
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x1F/31
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|49I|4EN|3F?|0D |0D |0A |2B+|43C|50P|49I|4EN AT+CPIN?...+CPIN
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 3A:|20 |52R|45E|41A|44D|59Y|0D |0A |0D |0A |4FO|4BK|0D |0A : READY....OK..
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Parsing +CPIN: READY with +CPIN: @r
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Grabbed string from reply: "READY" (parsed 5 bytes)
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Parsed raw string "READY"
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Security status received - nothing to enter
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Leaving GSM_GetSecurityStatus
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Entering GSM_GetSMSStatus
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Getting SIM SMS status
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x12/18
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|4DM|53S|3D=|22"|53S|4DM|22"|2C,|22"|53S|4DM AT+CPMS="SM","SM
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 22"|0D ".
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 1 "AT+CPMS="SM","SM""
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 2 "+CPMS: 0,5,0,5,0,5"
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x2E/46
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|4DM|53S|3D=|22"|53S|4DM|22"|2C,|22"|53S|4DM AT+CPMS="SM","SM
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 22"|0D |0D |0A |2B+|43C|50P|4DM|53S|3A:|20 |300|2C,|355|2C,|300 "...+CPMS: 0,5,0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 2C,|355|2C,|300|2C,|355|0D |0A |0D |0A |4FO|4BK|0D |0A ,5,0,5....OK..
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: SMS status received
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsing +CPMS: 0,5,0,5,0,5 with +CPMS: @i, @i, @0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsed int 0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsed int 5
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Used : 0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Size : 5
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Getting phone SMS status
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x12/18
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|4DM|53S|3D=|22"|4DM|45E|22"|2C,|22"|4DM|45E AT+CPMS="ME","ME
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 22"|0D ".
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 1 "AT+CPMS="ME","ME""
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 2 "+CPMS: 0,23,0,23,0,5"
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x30/48
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|4DM|53S|3D=|22"|4DM|45E|22"|2C,|22"|4DM|45E AT+CPMS="ME","ME
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 22"|0D |0D |0A |2B+|43C|50P|4DM|53S|3A:|20 |300|2C,|322|333|2C, "...+CPMS: 0,23,
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 300|2C,|322|333|2C,|300|2C,|355|0D |0A |0D |0A |4FO|4BK|0D |0A 0,23,0,5....OK..
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: SMS status received
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsing +CPMS: 0,23,0,23,0,5 with +CPMS: @i, @i, @0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsed int 0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsed int 23
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Used : 0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Size : 23
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Leaving GSM_GetSMSStatus
我解决了这个问题,这个问题与 gammu-ssmd 无关,但与 postgresql 相关。
postgresql.conf中的时区错误,与服务器的时区不同。
如果我运行“SELECT NOW();”在远程计算机上的 postgres 客户端中,时间是错误的,但如果我运行“SELECT NOW();”在服务器上比时间还好。我不确定为什么会这样,我希望 posgres NOW() 始终提供相同的时区。
无论如何,这导致了 gammu-ssmd 的奇怪行为,因为在 gammu 的发件箱 table 的列 SendingDateTime、SendingTimeOut... 中插入了错误的日期。
所以我更正了时区,重新启动了 postgresql,现在一切正常。
我在 Ubuntu 上编译了 gammu-1.42,我可以使用以下命令成功发送短信:
echo "test" | /opt/gammu/bin/gammu --sendsms TEXT "0740...29"
但我需要使用 gammu-smsd 从 Postgresql 数据库发送短信。问题是我看不到任何错误消息,我不知道为什么 gammu-smsd 不发送短信,我从工作服务器复制了配置。
所以配置文件是:
[gammu]
port = /dev/ttyUSB1
connection = at19200
logformat = textall
[smsd]
logfile = syslog
debuglevel = 999
service = sql
driver = native_pgsql
Host = 192.168.1.2
User = sms
Password = xxx
Database = hospital
inboxpath = /var/spool/gammu/inbox/
outboxpath = /var/spool/gammu/outbox/
sentsmspath = /var/spool/gammu/sent/
我这样启动 gammu-smsd:
/opt/gammu/bin/gammu-smsd -c /opt/gammu/gammu-smsdrc
我可以在日志中看到 gammu-smsd 正在使用以下查询读取发件箱 table:
SELECT "ID", "InsertIntoDB", "SendingDateTime", "SenderID" FROM outbox WHERE "SendingDateTime" < now() AND "SendingTimeOut" < now() AND "SendBefore" >= localtime AND "SendAfter" <= localtime AND ( "SenderID" is NULL OR "SenderID" = '' OR "SenderID" = '' ) ORDER BY "Priority" DESC, "InsertIntoDB" ASC LIMIT 1
我 运行 针对 Postgresql 的查询很好,查询 returns 我插入的短信 table.
而且日志很大,我一直在提高调试级别,希望能看到错误但没有运气(我还删除了很多行,因为我触及了 Whosebug 最大值):
Apr 28 20:26:11 caido gammu-smsd[4822]: Using SQL service
Apr 28 20:26:11 caido gammu-smsd[4822]: Configuring Gammu SMSD...
Apr 28 20:26:11 caido gammu-smsd[4822]: SHM token: 0x1001112 (16781586)
Apr 28 20:26:11 caido gammu-smsd[4822]: Warning: No PIN code in /opt/gammu/gammu-smsdrc file
Apr 28 20:26:11 caido gammu-smsd[4822]: CommTimeout=30, SendTimeout=30, ReceiveFrequency=15, ResetFrequency=0, HardResetFrequency=0
Apr 28 20:26:11 caido gammu-smsd[4822]: checks: CheckSecurity=1, CheckBattery=1, CheckSignal=1, CheckNetwork=1
Apr 28 20:26:11 caido gammu-smsd[4822]: mode: Send=1, Receive=1
Apr 28 20:26:11 caido gammu-smsd[4822]: deliveryreport = no
Apr 28 20:26:11 caido gammu-smsd[4822]: phoneid =
Apr 28 20:26:11 caido gammu-smsd[4822]: Connected to database: hospital on 192.168.1.2. Server version: 120006 Protocol: 3
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM gammu LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM inbox LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM sentitems LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM outbox LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM outbox_multipart LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT * FROM phones LIMIT 1
Apr 28 20:26:11 caido gammu-smsd[4822]: Execute SQL: SELECT "Version" FROM gammu
Apr 28 20:26:11 caido gammu-smsd[4822]: Database structures version: 17, SMSD current version: 17
Apr 28 20:26:11 caido gammu-smsd[4822]: Connected to Database native_pgsql: hospital on 192.168.1.2
Apr 28 20:26:11 caido gammu-smsd[4822]: Created POSIX RW shared memory at 0x7f1ac0d93000
Apr 28 20:26:11 caido gammu-smsd[4822]: Starting phone communication...
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Gammu - 1.42.0]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Connection - "at19200"]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Connection index - 0]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Model type - ""]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Device - "/dev/ttyUSB1"]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Running on - Linux, kernel 5.4.0-72-generic (#80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021)]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: Serial device: DTR is up, RTS is up, CAR is up, CTS is up
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: Setting speed to 19200
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: [Module - "auto"]
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: Escaping SMS mode
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x02/2
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: 1B |0D ..
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: Sending simple AT command to wake up some devices
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x03/3
Apr 28 20:26:11 caido gammu-smsd[4822]: gammu: 41A|54T|0D AT.
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 1 "AT"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 2 "OK"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x09/9
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|0D |0D |0A |4FO|4BK|0D |0A AT...OK..
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Enabling echo
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x05/5
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|45E|311|0D ATE1.
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 1 "ATE1"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 2 "OK"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x0B/11
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|45E|311|0D |0D |0A |4FO|4BK|0D |0A ATE1...OK..
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Trying Motorola mode switch
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0A/10
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|4DM|4FO|44D|45E|3D=|322|0D AT+MODE=2.
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 1 "AT+MODE=2"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 2 "ERROR"
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Checking line: ERROR
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: AT reply state: 3
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x13/19
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|4DM|4FO|44D|45E|3D=|322|0D |0D |0A |45E|52R|52R|4FO AT+MODE=2...ERRO
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 52R|0D |0A R..
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Seems not to be supported
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: Enabling CME errors
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0A/10
Apr 28 20:26:12 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|4DM|45E|45E|3D=|311|0D AT+CMEE=1.
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 1 "AT+CMEE=1"
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 2 "OK"
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x10/16
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|4DM|45E|45E|3D=|311|0D |0D |0A |4FO|4BK|0D |0A AT+CMEE=1...OK..
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x09/9
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|53S|43C|53S|3F?|0D AT+CSCS?.
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 1 "AT+CSCS?"
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 2 "+CSCS: "GSM""
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x1F/31
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|53S|43C|53S|3F?|0D |0D |0A |2B+|43C|53S|43C|53S AT+CSCS?...+CSCS
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 3A:|20 |22"|47G|53S|4DM|22"|0D |0A |0D |0A |4FO|4BK|0D |0A : "GSM"....OK..
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0A/10
Apr 28 20:26:13 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|53S|43C|53S|3D=|3F?|0D AT+CSCS=?.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT+CSCS=?"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "+CSCS: ("IRA","GSM","UCS2")"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x2F/47
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|53S|43C|53S|3D=|3F?|0D |0D |0A |2B+|43C|53S|43C AT+CSCS=?...+CSC
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 53S|3A:|20 |28(|22"|49I|52R|41A|22"|2C,|22"|47G|53S|4DM|22"|2C, S: ("IRA","GSM",
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 22"|55U|43C|53S|322|22"|29)|0D |0A |0D |0A |4FO|4BK|0D |0A "UCS2")....OK..
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Chosen GSM as normal charset
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Chosen UCS2 as unicode charset
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Getting model
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x08/8
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|47G|4DM|4DM|0D AT+CGMM.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT+CGMM"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "+CGMM: LTE WIRELESS MODEM"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x2B/43
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|47G|4DM|4DM|0D |0D |0A |2B+|43C|47G|4DM|4DM|3A: AT+CGMM...+CGMM:
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 20 |4CL|54T|45E|20 |57W|49I|52R|45E|4CL|45E|53S|53S|20 |4DM|4FO LTE WIRELESS MO
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 44D|45E|4DM|0D |0A |0D |0A |4FO|4BK|0D |0A DEM....OK..
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Unknown model, but it should still work
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: [Model name: `LTE WIRELESS MODEM']
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: [Model data: `']
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: [Model data: `unknown']
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: [Connected model - "LTE WIRELESS MODEM"]
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x08/8
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|47G|4DM|49I|0D AT+CGMI.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT+CGMI"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "OK"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x0E/14
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|47G|4DM|49I|0D |0D |0A |4FO|4BK|0D |0A AT+CGMI...OK..
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Manufacturer info received
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: [Manufacturer: OK]
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking for OBEX support
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0B/11
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|52R|4FO|54T|3D=|3F?|0D AT+CPROT=?.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT+CPROT=?"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "ERROR"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: ERROR
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 3
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x14/20
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|52R|4FO|54T|3D=|3F?|0D |0D |0A |45E|52R|52R AT+CPROT=?...ERR
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 4FO|52R|0D |0A OR..
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking for SYNCML/OBEX support
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0C/12
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|53S|59Y|4EN|43C|4DM|4CL|3D=|3F?|0D AT+SYNCML=?.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT+SYNCML=?"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "ERROR"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: ERROR
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 3
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x15/21
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|53S|59Y|4EN|43C|4DM|4CL|3D=|3F?|0D |0D |0A |45E|52R AT+SYNCML=?...ER
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 52R|4FO|52R|0D |0A ROR..
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x0D/13
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 41A|54T|24$|54T|53S|53S|50P|43C|53S|57W|3D=|3F?|0D AT$TSSPCSW=?.
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 1 "AT$TSSPCSW=?"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: 2 "ERROR"
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: Checking line: ERROR
Apr 28 20:26:14 caido gammu-smsd[4822]: gammu: AT reply state: 3
......................
Apr 28 20:26:46 caido gammu-smsd[4822]: gammu: Leaving GSM_GetSMSStatus
Apr 28 20:26:46 caido gammu-smsd[4822]: Execute SQL: SELECT "ID", "InsertIntoDB", "SendingDateTime", "SenderID" FROM outbox WHERE "SendingDateTime" < now() AND "SendingTimeOut" < now() AND "SendBefore" >= localtime AND "SendAfter" <= localtime AND ( "SenderID" is NULL OR "SenderID" = '' OR "SenderID" = '' ) ORDER BY "Priority" DESC, "InsertIntoDB" ASC LIMIT 1
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Entering GSM_GetSecurityStatus
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Getting security code status
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x09/9
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|49I|4EN|3F?|0D AT+CPIN?.
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 1 "AT+CPIN?"
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 2 "+CPIN: READY"
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x1F/31
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|49I|4EN|3F?|0D |0D |0A |2B+|43C|50P|49I|4EN AT+CPIN?...+CPIN
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: 3A:|20 |52R|45E|41A|44D|59Y|0D |0A |0D |0A |4FO|4BK|0D |0A : READY....OK..
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Parsing +CPIN: READY with +CPIN: @r
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Grabbed string from reply: "READY" (parsed 5 bytes)
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Parsed raw string "READY"
Apr 28 20:27:00 caido gammu-smsd[4822]: gammu: Security status received - nothing to enter
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Leaving GSM_GetSecurityStatus
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Entering GSM_GetSMSStatus
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Getting SIM SMS status
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x12/18
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|4DM|53S|3D=|22"|53S|4DM|22"|2C,|22"|53S|4DM AT+CPMS="SM","SM
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 22"|0D ".
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 1 "AT+CPMS="SM","SM""
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 2 "+CPMS: 0,5,0,5,0,5"
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x2E/46
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|4DM|53S|3D=|22"|53S|4DM|22"|2C,|22"|53S|4DM AT+CPMS="SM","SM
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 22"|0D |0D |0A |2B+|43C|50P|4DM|53S|3A:|20 |300|2C,|355|2C,|300 "...+CPMS: 0,5,0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 2C,|355|2C,|300|2C,|355|0D |0A |0D |0A |4FO|4BK|0D |0A ,5,0,5....OK..
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: SMS status received
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsing +CPMS: 0,5,0,5,0,5 with +CPMS: @i, @i, @0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsed int 0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsed int 5
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Used : 0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Size : 5
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Getting phone SMS status
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: SENDING frame type 0x00/length 0x12/18
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|4DM|53S|3D=|22"|4DM|45E|22"|2C,|22"|4DM|45E AT+CPMS="ME","ME
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 22"|0D ".
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 1 "AT+CPMS="ME","ME""
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 2 "+CPMS: 0,23,0,23,0,5"
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 3 "OK"
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Checking line: OK
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: AT reply state: 1
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: RECEIVED frame type 0x00/length 0x30/48
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 41A|54T|2B+|43C|50P|4DM|53S|3D=|22"|4DM|45E|22"|2C,|22"|4DM|45E AT+CPMS="ME","ME
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 22"|0D |0D |0A |2B+|43C|50P|4DM|53S|3A:|20 |300|2C,|322|333|2C, "...+CPMS: 0,23,
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: 300|2C,|322|333|2C,|300|2C,|355|0D |0A |0D |0A |4FO|4BK|0D |0A 0,23,0,5....OK..
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: SMS status received
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsing +CPMS: 0,23,0,23,0,5 with +CPMS: @i, @i, @0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsed int 0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Parsed int 23
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Used : 0
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Size : 23
Apr 28 20:27:01 caido gammu-smsd[4822]: gammu: Leaving GSM_GetSMSStatus
我解决了这个问题,这个问题与 gammu-ssmd 无关,但与 postgresql 相关。
postgresql.conf中的时区错误,与服务器的时区不同。
如果我运行“SELECT NOW();”在远程计算机上的 postgres 客户端中,时间是错误的,但如果我运行“SELECT NOW();”在服务器上比时间还好。我不确定为什么会这样,我希望 posgres NOW() 始终提供相同的时区。
无论如何,这导致了 gammu-ssmd 的奇怪行为,因为在 gammu 的发件箱 table 的列 SendingDateTime、SendingTimeOut... 中插入了错误的日期。
所以我更正了时区,重新启动了 postgresql,现在一切正常。