Hi Huong,
You can create a custom action that will check if a Audio Endpoint Device is connected. For details, please take a look on the Audio Endpoint Devices article.
To integrate the custom action in the installer, you can take a look on our How to integrate and debug custom actions article with related information for hints and guidance.
Please let us know if that helped, otherwise give us more details about your specific scenario.
Best regards,
Dan