Following this line, we see that you're using a custom ttl. You can fetch the duration from the decision fetched from crowdsec.
We have are using this lua code to parse the duration for the TTL in another lua remediation component, you can use it as inspiration.