mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
sms-forward: pass phone number and message to hook
These are available as $Phone and $Message in hook.
This commit is contained in:
parent
f6e65dd68c
commit
5fbf584d4c
2 changed files with 4 additions and 2 deletions
|
@ -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
|
* `SmsForwardHooks`: an array with pre-defined hooks, where each hook consists
|
||||||
of `match` (which is matched against the received message), `allowed-number`
|
of `match` (which is matched against the received message), `allowed-number`
|
||||||
(which is matched against the sending phone number or name) and `command`.
|
(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
|
> ℹ️ **Info**: Copy relevant configuration from
|
||||||
> [`global-config`](../global-config.rsc) (the one without `-overlay`) to
|
> [`global-config`](../global-config.rsc) (the one without `-overlay`) to
|
||||||
|
|
|
@ -58,7 +58,8 @@ $WaitFullyConnected;
|
||||||
$LogPrintExit2 info $0 ("Running hook '" . $Hook->"match" . "': " . \
|
$LogPrintExit2 info $0 ("Running hook '" . $Hook->"match" . "': " . \
|
||||||
$Hook->"command") false;
|
$Hook->"command") false;
|
||||||
:do {
|
:do {
|
||||||
[ :parse ($Hook->"command") ];
|
:local Command [ :parse ($Hook->"command") ];
|
||||||
|
$Command Phone=$Phone Message=($SmsVal->"message");
|
||||||
:set Messages ($Messages . "\n\nRan hook '" . $Hook->"match" . "':\n" . \
|
:set Messages ($Messages . "\n\nRan hook '" . $Hook->"match" . "':\n" . \
|
||||||
$Hook->"command");
|
$Hook->"command");
|
||||||
} on-error={
|
} on-error={
|
||||||
|
|
Loading…
Reference in a new issue