Add smsonlyto config to ignore SMS sent to numbers not on the list

master
Skylar Ittner 3 years ago
parent 7f8d953f71
commit 70fadb06a0

@ -6,6 +6,7 @@
"inviteusers": ["@annoyme:matrix.org"],
"smstoken": "Voxtelesys SMS API persistent token goes here",
"smsfrom": "Voxtelesys DID goes here",
"smsonlyto": ["14061234567"],
"loglevel": "debug",
"smsinterval": 15
}

@ -57,10 +57,14 @@ function checkSMS() {
for (var i = 0; i < messages.length; i++) {
var msg = messages[i];
logger.info("Received SMS from " + msg.from + ": " + msg.body);
createOrJoinSMSRoom(msg.from, function (roomid) {
sendMatrix(roomid, msg.body, msg.media);
});
if (settings.smsonlyto.length > 0 && settings.smsonlyto.indexOf(msg.to) != -1) {
logger.info("Received SMS from " + msg.from + " for " + msg.to + ": " + msg.body);
createOrJoinSMSRoom(msg.from, function (roomid) {
sendMatrix(roomid, msg.body, msg.media);
});
} else {
logger.info("Received SMS from " + msg.from + " for " + msg.to + ", ignoring based on smsonlyto list.");
}
}
} catch (ex) {
logger.error(ex);

Loading…
Cancel
Save