Spaces:
Sleeping
Sleeping
| 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 | |
| async def health(): | |
| return {"status": "healthy"} | |
| async def agent_status(): | |
| # Add logic to check if agent is responding | |
| return {"agent": "connected", "api": "running"} | |
| async def get_call_history(): | |
| # Return recent call history | |
| return [ | |
| { | |
| "number": "+1234567890", | |
| "timestamp": "2024-01-15 10:30:00", | |
| "status": "completed" | |
| }, | |
| # ... more call records | |
| ] | |
| 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) | |