20 lines
752 B
Plaintext
20 lines
752 B
Plaintext
# --- Define Local Variables ---
|
|
:local status "up"
|
|
:local serverUrl "http://localhost/webhook-test.php"
|
|
:local apiKey "MySuperSecretToken123!"
|
|
|
|
# --- Fetch PPP System Variables safely ---
|
|
:local u $"user"
|
|
:local lip $"local-address"
|
|
:local rip $"remote-address"
|
|
:local cid $"caller-id"
|
|
:local iface $"interface"
|
|
|
|
:local msg ("PPP session " . $status . " on interface " . $iface)
|
|
|
|
# --- Construct JSON Body ---
|
|
:local jsonBody "{\"user\":\"$u\", \"local_ip\":\"$lip\", \"ip\":\"$rip\", \"caller_id\":\"$cid\", \"interface\":\"$iface\", \"status\":\"$status\", \"msg\":\"$msg\"}"
|
|
|
|
# --- Send Webhook ---
|
|
/tool fetch url=$serverUrl http-method=post http-header-field="Content-Type: application/json,X-API-Key: $apiKey" http-data=$jsonBody keep-result=no
|