diff --git a/config.example.json b/config.example.json index c4a79f5..4dad00a 100644 --- a/config.example.json +++ b/config.example.json @@ -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 } diff --git a/main.js b/main.js index bf4a03d..ad08bde 100644 --- a/main.js +++ b/main.js @@ -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);