Privacyidea 3.9

Hi,

First post, new to privacyidea.

Installed 3.9 on Rocky Linux 9.5 server. As far as I can understand it is working fine.
Using AD integration as resolver which is also working.

I have to use an SMS provider which you have to get a token first, I wrote a bash script to handle sending SMS’s. The script also works manually.

I have put the script in /etc/privacyidea/scripts, it is executable.

config->system->SMS Gateways created a new definiton, entered the script name and privacyidea.lib.smsprovider.ScriptSMSProvider.ScriptSMSProvider as providermodule.

Created a new realm and populated with a test user.

Created a new policy scope authentication actions smstext and smsautosend true.
smstext= Code : (otp)

For the test user enrolled a new token, when I click “Test Token” it calls the script that I provide
but I can only get the phone number, can not get anything from stdin. I have both tried background and wait options.

The code that supposed the get the message is

Read message from stdin

local message=""
if [ -t 0 ]; then
    # If stdin is a terminal, we're probably being tested manually
    message="Your OTP code is: TEST"
    log_message "TESTING: Using test message"
else
    # Read from stdin (normal PrivacyIDEA usage)
    message=$(cat)
fi

if [ -z "$message" ]; then
    log_message "ERROR: No message provided"
    exit 1
fi

Can anyone tell me if my script is wrong or what should I do so that Privacyidea sends the correct message.

Regards,

Aydin