MohamedFahim's picture
Update app.py
1b82c5c verified
Raw
History Blame Contribute Delete
1.11 kB
from fastapi import FastAPI
from src.api import outbound_caller
app = FastAPI()
# Include routes from the route file
app.include_router(outbound_caller.router)
# Add a health endpoint if you don't have one
@app.get("/health")
async def health():
return {"status": "healthy"}
@app.get("/agent-status")
async def agent_status():
# Add logic to check if agent is responding
return {"agent": "connected", "api": "running"}
@app.get("/call-history")
async def get_call_history():
# Return recent call history
return [
{
"number": "+1234567890",
"timestamp": "2024-01-15 10:30:00",
"status": "completed"
},
# ... more call records
]
@app.get("/call-stats")
async def get_call_stats():
# Return call statistics
return {
"total_calls": 150,
"successful_calls": 142,
"failed_calls": 8,
"avg_duration": "2m 34s"
}
if __name__ == "__main__":
import uvicorn
# uvicorn.run(app, host="127.0.0.1", port=8000)
uvicorn.run(app, host="0.0.0.0", port=9101, timeout_keep_alive=220)