01.07.2024, 14:08
Change the same function as follows and see if it helps.
Code:
function AT:run()
local res, err, cmd, pos, sms
res, err = self:read()
if err then
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
-- 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
end
return true
end