aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/sms-forward.md3
-rw-r--r--sms-forward.rsc3
2 files changed, 4 insertions, 2 deletions
diff --git a/doc/sms-forward.md b/doc/sms-forward.md
index a323157..5967903 100644
--- a/doc/sms-forward.md
+++ b/doc/sms-forward.md
@@ -40,7 +40,8 @@ The configuration goes to `global-config-overlay`, this is the only parameter:
* `SmsForwardHooks`: an array with pre-defined hooks, where each hook consists
of `match` (which is matched against the received message), `allowed-number`
(which is matched against the sending phone number or name) and `command`.
- For `match` and `allowed-number` regular expressions are supported.
+ For `match` and `allowed-number` regular expressions are supported. Actual
+ phone number (`$Phone`) and message (`$Message`) are available for the hook.
> ℹ️ **Info**: Copy relevant configuration from
> [`global-config`](../global-config.rsc) (the one without `-overlay`) to
diff --git a/sms-forward.rsc b/sms-forward.rsc
index 7c6a609..4f2d2e6 100644
--- a/sms-forward.rsc
+++ b/sms-forward.rsc
@@ -58,7 +58,8 @@ $WaitFullyConnected;
$LogPrintExit2 info $0 ("Running hook '" . $Hook->"match" . "': " . \
$Hook->"command") false;
:do {
- [ :parse ($Hook->"command") ];
+ :local Command [ :parse ($Hook->"command") ];
+ $Command Phone=$Phone Message=($SmsVal->"message");
:set Messages ($Messages . "\n\nRan hook '" . $Hook->"match" . "':\n" . \
$Hook->"command");
} on-error={