01.07.2024, 12:22
Modify AT:run() function in the user library as follows and post what you get in LM Logs tab.
Code:
function AT:run()
local res, err, cmd, pos, sms
res, err = self:read()
if err then
if err ~= 'timeout' then
log('run error', err)
end
return err == 'timeout'
end
-- check for incoming command
if res:sub(1, 1) ~= '+' then
return true
end
pos = res:find(':', 1, true)
if not pos then
return true
end
-- get command type
cmd = res:sub(2, pos - 1)
-- check only for incoming sms
if cmd ~= 'CMTI' then
log('run cmd', cmd)
return
end
-- read from sim
sms = self:incsms(res)
-- sms seems to be valid, pass to handler if specified
if sms and self.smshandler then
self.smshandler(sms)
end
return true
end