blue-account-81612
07/08/2025, 5:24 PMtall-airline-16756
07/08/2025, 5:24 PMtall-airline-16756
07/08/2025, 5:24 PMingress_started
and ingress_ended
events to trigger your backend logic accordingly.
from fastapi import FastAPI
app = FastAPI()
@app.post("/webhook")
async def handle_webhook(event: dict):
event_type = event.get("event")
if event_type == "ingress_started":
# Call started logic
print("Inbound call started")
return {"message": "Call started successfully"}
elif event_type == "ingress_ended":
# Call ended logic
print("Inbound call ended")
return {"message": "Call ended successfully"}
return {"message": "Event processed"}
This way, your backend gets notified immediately when an inbound call starts and ends. Additionally, you can also listen to session agent events like agent_state_changed
to monitor when agents begin or end speaking if you want to handle it within the session.
This setup ensures reliable real-time updates about call status to your backend.
Sources: Webhooks | LiveKit Docs | Turn detection and interruptions | LiveKit Docs