{"id":24884160,"url":"https://github.com/steinathan/telephony-server","last_synced_at":"2025-07-11T07:37:35.181Z","repository":{"id":275037053,"uuid":"924842401","full_name":"steinathan/telephony-server","owner":"steinathan","description":"Telephony Server is a powerful bridge that connects telephony providers (Twilio, Vonage, Plivo, etc.) with real-time communication platforms (LiveKit, Jay.so, Pipecat, etc.). It enables seamless call routing, robust metrics collection, and observability features for enhanced telephony operations.","archived":false,"fork":false,"pushed_at":"2025-01-30T19:54:31.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T20:37:38.590Z","etag":null,"topics":["agent","jay","langchain","llm","multimodal","pilvo","pipecat","pydantic","telephony","telephonymanager","twilio","vad","vocode","voice","voiceai","vonage"],"latest_commit_sha":null,"homepage":"https://buymeacoffee.com/navicstein","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steinathan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-30T18:43:03.000Z","updated_at":"2025-01-30T20:04:31.000Z","dependencies_parsed_at":"2025-01-30T20:47:52.231Z","dependency_job_id":null,"html_url":"https://github.com/steinathan/telephony-server","commit_stats":null,"previous_names":["steinathan/telephony-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinathan%2Ftelephony-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinathan%2Ftelephony-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinathan%2Ftelephony-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinathan%2Ftelephony-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steinathan","download_url":"https://codeload.github.com/steinathan/telephony-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245815783,"owners_count":20676972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","jay","langchain","llm","multimodal","pilvo","pipecat","pydantic","telephony","telephonymanager","twilio","vad","vocode","voice","voiceai","vonage"],"created_at":"2025-02-01T14:19:37.887Z","updated_at":"2025-03-27T09:25:05.950Z","avatar_url":"https://github.com/steinathan.png","language":"Python","funding_links":["https://www.buymeacoffee.com/navicstein"],"categories":[],"sub_categories":[],"readme":"# Telephony Server\n\n## Overview \u0026 Idea\n\n\u003e This project is inspired by Vocode\n\n**Telephony Server** is a powerful bridge that connects telephony providers ([Twilio](https://www.twilio.com), [Vonage](https://www.vonage.com), [Plivo](https://www.plivo.com), etc.) with real-time communication platforms ([LiveKit](https://www.livekit.io), [Jay.so](https://www.jay.so), [Pipecat](https://www.pipecat.ai), etc.). It enables seamless call routing, robust metrics collection, and observability features for enhanced telephony operations.\n\n## Features\n\n- **Call Routing**: Intelligent call forwarding and routing between providers and communication platforms.\n- **Multi-Provider Support**: Seamless integration with Twilio, Vonage, Plivo, and more.\n- **Real-time Communication**: Connects with services like LiveKit, Jay.so, and Pipecat.\n- **Metrics \u0026 Observability**: Capture call analytics, monitor system health, and track call quality.\n- **Scalability**: Built for high-performance and scalable architectures.\n- **Webhooks \u0026 Event Handling**: Customizable event-driven architecture.\n\n## Installation\n\n### Prerequisites\n\nEnsure you have the following installed:\n\n- **Docker** (Recommended for deployment)\n- **Twilio, Vonage, or Plivo Accounts**\n- **LiveKit, Jay.so, or Pipecat Accounts**\n\n### Clone the Repository\n\n```bash\ngit clone https://github.com/steinathan/telephony-server.git\ncd telephony-server\n```\n\n### Environment Variables\n\nCreate a `.env` file and configure your credentials:\n\n```env\nBASE_URL=6s6sgpwn-1338.uks1.devtunnels.ms\nTWILIO_ACCOUNT_SID=\nTWILIO_AUTH_TOKEN=\nDEEPGRAM_API_KEY=\nOPENAI_API_KEY=\nELEVENLABS_API_KEY=\n\n\nTO_PHONE=\nFROM_PHONE=\n```\n\n### Installation Steps\n\n```bash\nuv sync --frozen\n```\n\n## Usage (Work In Progress)\n\nMake an outbound phone call\n\n```python\nimport os\nfrom dotenv import load_dotenv\n\n\nfrom streaming_providers.models import BaseMessage\nfrom streaming_providers.pipecat.pipecat import PipecatStreamingConfig\nfrom telephony.config_manager.redis_config_manager import RedisConfigManager\nfrom telephony.models.telephony import TwilioConfig\nfrom telephony.outbound_call import OutboundCall\n\n\nfrom telephony.utils.strings import create_conversation_id\n\nload_dotenv()\n\n\nBASE_URL = os.environ[\"BASE_URL\"]\n\n\nagent_name = \"Navi\"\nsystem_prompt = \"\"\"\nYou are {agent_name}, an AI-powered taxi dispatcher handling customer calls 24/7 with accuracy and professionalism. You assist customers in booking rides, managing driver availability, and resolving inquiries in a natural, efficient, and friendly manner.\n\nYou prioritize clear communication, confirming pickup details, estimating wait times, and ensuring a smooth booking experience. If a request cannot be fulfilled, offer alternative solutions or politely escalate to a human agent.\n\nMaintain a warm, professional, and helpful tone. If a user is frustrated, reassure them and offer to help resolve their issue. Always confirm key details and minimize friction in the booking process.\n\n---\nYou will be penalized if you don't follow the conversation stages below:\n\n## Example Conversation Stages:\n\n1. Greeting \u0026 Intent Detection\nCustomer: \"Hi, I need a taxi.\"\n{agent_name}: \"Sure! Where would you like to be picked up from?\"\n\nCustomer: \"I want to check my booking.\"\n{agent_name}: \"Of course! Can you provide your booking reference or phone number?\"\n\nCustomer: \"How much to the airport?\"\n{agent_name}: \"I can check that for you. What’s your pickup location?\"\n\n---\n\n2. Booking a Ride\n{agent_name}: \"Where would you like to go?\"\nCustomer: \"To the airport.\"\n{agent_name}: \"Got it. What’s your pickup location?\"\nCustomer: \"123 Main Street.\"\n{agent_name}: \"Thanks! A taxi will arrive in 10 minutes. Would you like me to send a confirmation text?\"\n\n---\n\n3️⃣ Handling Ride Inquiries\nCustomer: \"Where’s my taxi?\"\n{agent_name}: \"Let me check. Your driver is 3 minutes away in a white Toyota Corolla. Would you like me to share the driver’s contact details?\"\n\nCustomer: \"I need to cancel my ride.\"\n{agent_name}: \"I can help with that. Just to confirm, you’d like to cancel your ride from 123 Main Street to the airport?\"\n\n---\n\n4️. Escalation to Human Agent\nIf the you cannot resolve the request (e.g., lost item, special assistance request, driver complaints), it should politely escalate:\n{agent_name}: \"I’ll transfer you to a live agent who can assist you further. Please hold for a moment.\"\n\"\"\".format(agent_name=agent_name)\n\n\nasync def main():\n    config_manager = RedisConfigManager()\n\n    outbound_call = OutboundCall(\n        conversation_id=create_conversation_id(\"outbound\"),\n        base_url=BASE_URL,\n        to_phone=os.environ[\"TO_PHONE\"],\n        from_phone=os.environ[\"FROM_PHONE\"],\n        config_manager=config_manager,\n        telephony_config=TwilioConfig(\n            account_sid=os.environ[\"TWILIO_ACCOUNT_SID\"],\n            auth_token=os.environ[\"TWILIO_AUTH_TOKEN\"],\n        ),\n        telephony_params={\n            \"Record\": \"false\",\n        },\n        streaming_provider_config=PipecatStreamingConfig(\n            deepgram_api_key=os.environ[\"DEEPGRAM_API_KEY\"],\n            openai_api_key=os.environ[\"OPENAI_API_KEY\"],\n            elevenlabs_api_key=os.environ[\"ELEVENLABS_API_KEY\"],\n            llm_model=\"gpt-4o-mini\",\n            greeting_message=BaseMessage(\n                message=\"Thanks for calling, I'm Navi, your AI-powered taxi dispatcher. How can I help you today?\"\n            ),\n            prompt_premble=BaseMessage(message=system_prompt),\n        ),\n    )\n\n    input(\"Press enter to start call...\")\n    await outbound_call.start()\n\n\nif __name__ == \"__main__\":\n    import asyncio\n\n    asyncio.run(main())\n```\n\nYou'd need to run the server before making the call, also make sure redis is working locally\n\n```sh\n$ uvicorn apps.telephony_app.main:app --port 1338\n```\n\nThen make an outbound call\n\n```sh\n$ python -m apps.telephony_app.outbound_call\n```\n\n## Deployment\n\nYou can deploy using Docker:\n\n```bash\ndocker-compose up --build -d\n```\n\n## Observability \u0026 Monitoring (soon)\n\n- **Prometheus \u0026 Grafana** for call metrics visualization.\n- **Logging with ELK Stack (Elasticsearch, Logstash, Kibana)**.\n\n## Contribution\n\nWe welcome contributions! Feel free to open issues and submit pull requests.\n\n## License\n\nMIT License\n\n---\n\n\u003e Psst, I'm looking for a good job in the AI-ish, voice AI space, if you're hiring, kindly reach out to me on linkedin\n\n**Author:** Navicstein Chinemerem \u003cbr/\u003e\n**Contact:** navicsteinrotciv@gmail.com \u003cbr/\u003e\n**Linkedin:**: https://www.linkedin.com/in/navicstein \u003cbr/\u003e\n**Buy Me a Coffee:** [buymeacoffee.com/navicstein](https://www.buymeacoffee.com/navicstein)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteinathan%2Ftelephony-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteinathan%2Ftelephony-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteinathan%2Ftelephony-server/lists"}