[Feature]: Vocode Exotel Support
How to Implement Exotel Support in Vocode
Summary
The objective is to implement Exotel support in Vocode, allowing users to integrate Exotel's telephony services with Vocode's conversational AI capabilities. This will expand Vocode's compatibility with popular telephony platforms and increase its utility for users in regions where Exotel is widely used.
Blockers
- [x] None
Outcome
Enhance Vocode's versatility and market reach by integrating Exotel support, thereby improving developer experience and fostering community growth in regions where Exotel is prevalent.
Technical Details
To implement Exotel support, we need to create new files and modify existing ones in the vocode/streaming/telephony directory. Here's an overview of the changes required:
- Create a new file
exotel_client.pyin the client directory:
from .abstract_telephony_client import AbstractTelephonyClient
class ExotelClient(AbstractTelephonyClient):
# Implement Exotel-specific methods here
pass
- Create a new file
exotel_phone_conversation.pyin theconversationdirectory:
from .abstract_phone_conversation import AbstractPhoneConversation
class ExotelPhoneConversation(AbstractPhoneConversation):
# Implement Exotel-specific conversation handling here
pass
- Modify
constants.pyto include Exotel-specific constants:
# Add Exotel-specific constants here
EXOTEL_AUDIO_ENCODING = "..."
EXOTEL_SAMPLING_RATE = ...
EXOTEL_CHUNK_SIZE = ...
-
Update
__init__.pyto import the new Exotel-related classes and functions. -
Modify relevant files in the
serverdirectory to handle Exotel-specific routing and API endpoints.
Subtasks
- [ ] Create
ExotelClientclass inexotel_client.py - [ ] Implement
ExotelPhoneConversationclass inexotel_phone_conversation.py - [ ] Add Exotel-specific constants to
constants.py - [ ] Update
__init__.pywith new Exotel imports - [ ] Modify server files to handle Exotel routing and API endpoints
- [ ] Implement Exotel authentication and API call methods
- [ ] Add unit tests for Exotel-specific functionality
- [ ] Update documentation to include Exotel integration instructions
For reference, you can check the implementation of Twilio and Vonage in the following files:
import os
from typing import Dict, Optional
import aiohttp
from loguru import logger
from vocode.streaming.models.telephony import TwilioConfig
from vocode.streaming.telephony.client.abstract_telephony_client import AbstractTelephonyClient
from vocode.streaming.telephony.templater import get_connection_twiml
from vocode.streaming.utils.async_requester import AsyncRequestor
class TwilioBadRequestException(ValueError):
pass
class TwilioException(ValueError):
pass
import os
from typing import Any, Dict, List, Optional
from vocode.streaming.models.telephony import VonageConfig
from vocode.streaming.telephony.client.abstract_telephony_client import AbstractTelephonyClient
from vocode.streaming.telephony.constants import VONAGE_CONTENT_TYPE
from vocode.streaming.utils.async_requester import AsyncRequestor
class VonageBadRequestException(ValueError):
pass
class TwilioPhoneConversation(AbstractPhoneConversation[TwilioOutputDevice]):
telephony_provider = "twilio"
class VonagePhoneConversation(AbstractPhoneConversation[VonageOutputDevice]):
telephony_provider = "vonage"