Add smsonlyto config to ignore SMS sent to numbers not on the list
This commit is contained in:
parent
7f8d953f71
commit
70fadb06a0
@ -6,6 +6,7 @@
|
|||||||
"inviteusers": ["@annoyme:matrix.org"],
|
"inviteusers": ["@annoyme:matrix.org"],
|
||||||
"smstoken": "Voxtelesys SMS API persistent token goes here",
|
"smstoken": "Voxtelesys SMS API persistent token goes here",
|
||||||
"smsfrom": "Voxtelesys DID goes here",
|
"smsfrom": "Voxtelesys DID goes here",
|
||||||
|
"smsonlyto": ["14061234567"],
|
||||||
"loglevel": "debug",
|
"loglevel": "debug",
|
||||||
"smsinterval": 15
|
"smsinterval": 15
|
||||||
}
|
}
|
||||||
|
12
main.js
12
main.js
@ -57,10 +57,14 @@ function checkSMS() {
|
|||||||
|
|
||||||
for (var i = 0; i < messages.length; i++) {
|
for (var i = 0; i < messages.length; i++) {
|
||||||
var msg = messages[i];
|
var msg = messages[i];
|
||||||
logger.info("Received SMS from " + msg.from + ": " + msg.body);
|
if (settings.smsonlyto.length > 0 && settings.smsonlyto.indexOf(msg.to) != -1) {
|
||||||
createOrJoinSMSRoom(msg.from, function (roomid) {
|
logger.info("Received SMS from " + msg.from + " for " + msg.to + ": " + msg.body);
|
||||||
sendMatrix(roomid, msg.body, msg.media);
|
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) {
|
} catch (ex) {
|
||||||
logger.error(ex);
|
logger.error(ex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user