[GH-ISSUE #16] Empty list in "Received Messages" #18

Closed
opened 2026-03-04 12:10:14 +03:00 by kerem · 3 comments
Owner

Originally created by @Nowaker on GitHub (Mar 25, 2022).
Original GitHub issue: https://github.com/4IceG/luci-app-sms-tool/issues/16

image

sms_tool sees the messages:

# sms_tool -d /dev/ttyUSB2 -s SM recv
MSG: 0
From: 7535
Date/Time: 03/22/22 18:23:23
AT&T Free Msg: Paperless Billing was requested to start for acct # ending in [SNIPPED]. If done in error, call 800-331-0500 or 611 from your wireless phone.

MSG: 1
From: 7535
Date/Time: 03/22/22 18:48:35
AT&T FREE MSG: AutoPay Enrollment Processed. Please submit payments until you see confirmation of your enrollment on the first page of your bill.

MSG: 2
From: 7535
Date/Time: 03/23/22 10:27:59
AT&T FREE MSG: AutoPay Enrollment Processed. Please submit payments until you see confirmation of your enrollment on the first page of your bill.

MSG: 3
From: 7535
Date/Time: 03/25/22 09:03:51
Reference number: 116
SMS segment 1 of 2
AT&T Free Msg: Your data use this month has reached 16.5GB. If you exceed 22GB before your next cycle on 04/21/2022, you can still use unlimited data ho

MSG: 4
From: 7535
Date/Time: 03/25/22 09:03:51
Reference number: 116
SMS segment 2 of 2
wever your speeds may be reduced in areas with network congestion. Wi-Fi helps avoid reduced speeds. Visit att.com/datainfo for more info.

luci-app-sms-tool config:

# uci export sms_tool
package sms_tool

config sms_tool 'general'
        option ledtimeon '1'
        option ledtimeoff '5'
        option lednotify '0'
        option checktime '10'
        option information '1'
        option ussd '0'
        option pdu '0'
        option storage 'SM'
        option prestart '6'
        option ledtype 'D'
        option readport '/dev/ttyUSB2'
        option sendport '/dev/ttyUSB2'
        option ussdport '/dev/ttyUSB2'
        option atport '/dev/ttyUSB2'
        option mergesms '1'
        option pnumber '1'
        option prefix '1'
Originally created by @Nowaker on GitHub (Mar 25, 2022). Original GitHub issue: https://github.com/4IceG/luci-app-sms-tool/issues/16 ![image](https://user-images.githubusercontent.com/611746/160167747-6019b83b-0bb7-4e65-96ab-d404788fdd8d.png) `sms_tool` sees the messages: ``` # sms_tool -d /dev/ttyUSB2 -s SM recv MSG: 0 From: 7535 Date/Time: 03/22/22 18:23:23 AT&T Free Msg: Paperless Billing was requested to start for acct # ending in [SNIPPED]. If done in error, call 800-331-0500 or 611 from your wireless phone. MSG: 1 From: 7535 Date/Time: 03/22/22 18:48:35 AT&T FREE MSG: AutoPay Enrollment Processed. Please submit payments until you see confirmation of your enrollment on the first page of your bill. MSG: 2 From: 7535 Date/Time: 03/23/22 10:27:59 AT&T FREE MSG: AutoPay Enrollment Processed. Please submit payments until you see confirmation of your enrollment on the first page of your bill. MSG: 3 From: 7535 Date/Time: 03/25/22 09:03:51 Reference number: 116 SMS segment 1 of 2 AT&T Free Msg: Your data use this month has reached 16.5GB. If you exceed 22GB before your next cycle on 04/21/2022, you can still use unlimited data ho MSG: 4 From: 7535 Date/Time: 03/25/22 09:03:51 Reference number: 116 SMS segment 2 of 2 wever your speeds may be reduced in areas with network congestion. Wi-Fi helps avoid reduced speeds. Visit att.com/datainfo for more info. ``` luci-app-sms-tool config: ``` # uci export sms_tool package sms_tool config sms_tool 'general' option ledtimeon '1' option ledtimeoff '5' option lednotify '0' option checktime '10' option information '1' option ussd '0' option pdu '0' option storage 'SM' option prestart '6' option ledtype 'D' option readport '/dev/ttyUSB2' option sendport '/dev/ttyUSB2' option ussdport '/dev/ttyUSB2' option atport '/dev/ttyUSB2' option mergesms '1' option pnumber '1' option prefix '1' ```
kerem closed this issue 2026-03-04 12:10:14 +03:00
Author
Owner

@Nowaker commented on GitHub (Mar 25, 2022):

It appears to be an in-browser JavaScript error.

Uncaught SyntaxError: Unexpected token ':'

image

Seems related to the SIM card capacity logic. sms_tool is doing fine:

# sms_tool -d /dev/ttyUSB2 status
Storage type: SM, used: 5, total: 5

XHR request to readsim also works fine, regardless of whether I configure SIM card or memory storage area - but only when done independently of the UI:

% curl 'http://XXX/cgi-bin/luci/admin/modem/sms/readsim?XXX' \
  -H 'Connection: keep-alive' \
  -H 'User-Agent: XXX' \
  -H 'DNT: 1' \
  -H 'Accept: */*' \
  -H 'Referer: http://XXX/cgi-bin/luci/admin/modem/sms/readsms' \
  -H 'Accept-Language: en-US,en;q=0.9,pl;q=0.8' \
  -H 'Cookie: sysauth=XXX' \
  --compressed \
  --insecure
{"all":"255","use":"0"}

% curl 'http://192.168.10.1/cgi-bin/luci/admin/modem/sms/readsim?XXX' \
  -H 'Connection: keep-alive' \
  -H 'User-Agent: XXX' \
  -H 'DNT: 1' \
  -H 'Accept: */*' \
  -H 'Referer: http://XXX/cgi-bin/luci/admin/modem/sms/readsms' \
  -H 'Accept-Language: en-US,en;q=0.9,pl;q=0.8' \
  -H 'Cookie: sysauth=XXX' \
  --compressed \
  --insecure
{"all":"5","use":"5"}

It's worth noting that when memory storage is set up, the UI doesn't throw any in-browser exceptions, and the capacity is correctly shown as 0/255.

image

<!-- gh-comment-id:1079242930 --> @Nowaker commented on GitHub (Mar 25, 2022): It appears to be an in-browser JavaScript error. ``` Uncaught SyntaxError: Unexpected token ':' ``` ![image](https://user-images.githubusercontent.com/611746/160169536-99c8c7ff-8473-4b1c-9083-bbe19c00c661.png) Seems related to the SIM card capacity logic. `sms_tool` is doing fine: ``` # sms_tool -d /dev/ttyUSB2 status Storage type: SM, used: 5, total: 5 ``` XHR request to `readsim` also works fine, regardless of whether I configure SIM card or memory storage area - but only when done independently of the UI: ``` % curl 'http://XXX/cgi-bin/luci/admin/modem/sms/readsim?XXX' \ -H 'Connection: keep-alive' \ -H 'User-Agent: XXX' \ -H 'DNT: 1' \ -H 'Accept: */*' \ -H 'Referer: http://XXX/cgi-bin/luci/admin/modem/sms/readsms' \ -H 'Accept-Language: en-US,en;q=0.9,pl;q=0.8' \ -H 'Cookie: sysauth=XXX' \ --compressed \ --insecure {"all":"255","use":"0"} % curl 'http://192.168.10.1/cgi-bin/luci/admin/modem/sms/readsim?XXX' \ -H 'Connection: keep-alive' \ -H 'User-Agent: XXX' \ -H 'DNT: 1' \ -H 'Accept: */*' \ -H 'Referer: http://XXX/cgi-bin/luci/admin/modem/sms/readsms' \ -H 'Accept-Language: en-US,en;q=0.9,pl;q=0.8' \ -H 'Cookie: sysauth=XXX' \ --compressed \ --insecure {"all":"5","use":"5"} ``` It's worth noting that when memory storage is set up, the UI doesn't throw any in-browser exceptions, and the capacity is correctly shown as 0/255. ![image](https://user-images.githubusercontent.com/611746/160170880-bc16a7cf-2925-42ec-bc15-c1470fd86532.png)
Author
Owner

@Nowaker commented on GitHub (Mar 25, 2022):

Okay, found the bug:

	local statusb = luci.util.exec("sms_tool -s" .. smsmem .. " -d ".. devv .. " status")
	local all = string.sub (statusb, -4)

The code assumes the number has 3 digits. Well. Mine has one. Smarter parsing of sms_tool status is needed.

<!-- gh-comment-id:1079248067 --> @Nowaker commented on GitHub (Mar 25, 2022): Okay, found the bug: ``` local statusb = luci.util.exec("sms_tool -s" .. smsmem .. " -d ".. devv .. " status") local all = string.sub (statusb, -4) ``` The code assumes the number has 3 digits. Well. Mine has one. Smarter parsing of `sms_tool status` is needed.
Author
Owner

@Nowaker commented on GitHub (Mar 25, 2022):

Fix:

        local all = statusb:match('[^: ]+$')
<!-- gh-comment-id:1079258540 --> @Nowaker commented on GitHub (Mar 25, 2022): Fix: ``` local all = statusb:match('[^: ]+$') ```
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/luci-app-sms-tool#18
No description provided.