Open osering opened 5 months ago
Did you set the admin account credentials, either in the script itself or in a ~/.huawei_router
file?
Sure. I suppose that sending SMS (and some other functions) also requires right credentials (and those works).
Found the problem:
It is in the line:
sms_list_xml="\<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
Proposal; let to enter this value at least as argument to shell script (like $1) with default value: 1 Argument values: 1, 2, 3 - means first, second, third (not one, two, three messages) message - so cut off just last one. But if variable value is -3 (-2), it would mean three (two) messages from last one)
Second argument $2 would be 0 - if mark sms as unread, 1 - if mark sms as read, 2 - leave read/unread mark as is. Default - 1.
Value which have to be changed in email is: \
It should be kept as simple as possible. You can simply paginate by looping over the following code, by reading 50 SMS max at the time, and incrementing the page number, until the last page.
sms_list_xml="<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><PageIndex>1</PageIndex><ReadCount>$count</ReadCount><BoxType>1</BoxType><SortType>0</SortType><Ascending>0</Ascending><UnreadPreferred>0</UnreadPreferred></request>"
request api/sms/sms-list "$sms_list_xml"
echo $response
Or just limit $count
to 50 then delete the SMS you have already read.
After a few run you should not have any SMS left.
Hello.
Great peace of code - clear, concise, accurate and fresh! Moreover pure shell - not requiring any other dependencies. Best one of those including SMS send/receive functionality.
Most commands I tried - worked like a charm (sms sending as well), except this:
./huawei_router.sh read_sms
[huawei_router] Connecting [huawei_router] Requesting api/sms/sms-count [huawei_router] 169 message(s) in the inbox [huawei_router] Requesting api/user/login [huawei_router] Requesting api/sms/sms-list \>\encoding="UTF-8"?>
Another way was not successful as well: ./huawei_router.sh login_request api/sms/sms-list
[huawei_router] Connecting [huawei_router] Requesting api/user/login [huawei_router] Requesting api/sms/sms-list \<?xml version="1.0" encoding="UTF-8"?> \
\\
\
100005\
\Not sure what's the problem.
P.S. README has no info about parameters which can be used for SMS reading (how many to show - the newest/oldest X ones, or which one - number X starting count from last one, or just from unread, or by time frame / sms_id, etc.)
Device specs: 'DeviceName': 'B525s-23a' 'SerialNumber': 'YQD7N19612003409' 'HardwareVersion': 'WL1B520FM' 'SoftwareVersion': '11.190.65.00.00' customized by Dinis.ru 'WebUIVersion': '81.100.31.02.1134'
P.S. Thanks for your contribution to FLOSS!