vocode-python icon indicating copy to clipboard operation
vocode-python copied to clipboard

[Feature]: Vocode Exotel Support

Open arpagon opened this issue 1 year ago • 0 comments

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:

  1. Create a new file exotel_client.py in the client directory:
from .abstract_telephony_client import AbstractTelephonyClient

class ExotelClient(AbstractTelephonyClient):
    # Implement Exotel-specific methods here
    pass
  1. Create a new file exotel_phone_conversation.py in the conversation directory:
from .abstract_phone_conversation import AbstractPhoneConversation

class ExotelPhoneConversation(AbstractPhoneConversation):
    # Implement Exotel-specific conversation handling here
    pass
  1. Modify constants.py to include Exotel-specific constants:
# Add Exotel-specific constants here
EXOTEL_AUDIO_ENCODING = "..."
EXOTEL_SAMPLING_RATE = ...
EXOTEL_CHUNK_SIZE = ...
  1. Update __init__.py to import the new Exotel-related classes and functions.

  2. Modify relevant files in the server directory to handle Exotel-specific routing and API endpoints.

Subtasks

  • [ ] Create ExotelClient class in exotel_client.py
  • [ ] Implement ExotelPhoneConversation class in exotel_phone_conversation.py
  • [ ] Add Exotel-specific constants to constants.py
  • [ ] Update __init__.py with 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"

arpagon avatar Jul 15 '24 20:07 arpagon