17.08.2023, 07:48
It should be combined with the SMS script.
Change udphandler function in the resident script like this:
Then try this script (number should probably start with 00):
Change udphandler function in the resident script like this:
Code:
-- check local udp server for messages to send
udphandler = function(server)
-- check for local sms to send
local msg = server:receive()
-- got no message
if not msg then
return
end
-- split into number and message
local sep = msg:find(' ')
if not sep then
return
end
local num = msg:sub(1, sep - 1)
local txt = msg:sub(sep + 1)
if txt == 'CALL' then
alert('calling: ' .. num)
modem:call(num)
else
alert('sending sms: ' .. msg)
modem:sendsms(num, txt)
end
end
Then try this script (number should probably start with 00):
Code:
require('user.sms')
sendsms('003711234567', 'CALL')