Gate Access Automation Help

I’m stumped on this and have spent too much time on reading up on dead end implementations so I’m looking for experienced advice on an automation to handle incoming calls from an analog call box at my neighborhood gate. The goal is to have Home Assistant answer the call, prompt the user for a password via STT, and open the gate if the correct password is provided. Here’s a breakdown of the desired functionality:

  1. Call Identification: Home Assistant should answer the call only if the incoming phone number or caller ID matches that of the call box.
  2. Call Answering: If the call is from the call box, Home Assistant should answer the call and use Text-to-Speech (TTS) to provide instructions to the user, prompting them to say the password out loud.
  3. Password Verification: Home Assistant should listen for the user’s spoken password and verify its correctness.
  4. Correct Password: If the password is correct, Home Assistant should reply with a dial tone of the number 9 on the normal keypad. The call box will recognize this dial tone and open the gate.
  5. Incorrect Password: If the password is incorrect, Home Assistant should inform the user and allow up to three attempts. After three failed attempts, Home Assistant should play a final invalid password prompt and end the call with a “goodbye” message.
  6. Call Handling: If the incoming call doesn’t match the call box’s phone number or caller ID, Home Assistant should not answer the call, allowing other people in the house to pick up the call normally.
    I’m seeking advice on the best way to implement this automation within Home Assistant. Specifically, I need guidance on how to handle the analog phone line integration, caller ID recognition, STT prompts, speech recognition for password validation, and triggering the gate opening mechanism using the dial tone.
    Any suggestions, recommended components/hardware/software, or examples of similar setups would be greatly appreciated.