async def attempt_operator_dialout():
        """Attempt to start operator dialout with retry logic."""
        nonlocal retry_count, dialout_successful

        if retry_count < max_retries and not dialout_successful:
            retry_count += 1
            logger.info(
                f"Attempting operator dialout (attempt {retry_count}/{max_retries}) to: {operator_number}"
            )
            await transport.start_dialout(dialout_params)
        else:
            logger.error(f"Maximum retry attempts ({max_retries}) reached for operator dialout.")
            # Notify user that operator connection failed
            content = "I'm sorry, but I'm unable to connect you with a supervisor at this time. Please try again later or contact us through other means."
            message = {"role": "system", "content": content}
            messages.append(message)
            await task.queue_frames([LLMMessagesFrame(messages)])
Attempt to start operator dialout with retry logic.
examples/phone-chatbot/daily-pstn-call-transfer/bot.py