diff --git a/lib/modem.js b/lib/modem.js index f98ad4a..3be3937 100644 --- a/lib/modem.js +++ b/lib/modem.js @@ -189,6 +189,8 @@ async function registerSignalStrengthBackgroundQuery() { } async function sendSMS(destination, msg) { + if (typeof destination !== 'string' || typeof msg !== 'string' || !destination.trim() || !msg.trim()) return; + await mutex.setLockWaitForCommand(); logger.info('Sending message', { destination, msg }); diff --git a/lib/mutex.js b/lib/mutex.js index cf255bd..677b525 100644 --- a/lib/mutex.js +++ b/lib/mutex.js @@ -36,7 +36,7 @@ function releaseLockWaitForCommand() { } catch (e) { // } - }, 1500); + }, 2000); } exports.setLockWaitForOK = setLockWaitForOK;