Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Rev AI transcriber not working, abruptly disconnecting #730

Open
raghavjaistra opened this issue Dec 5, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@raghavjaistra
Copy link

Brief Description

When I use Azure as a transcriber, things are working perfectly, but as soon as I change it to RevAI, it is not able to recognise the audio packets and is disconnected in between (got to know after extensive logging)

telephony_server = TelephonyServer(
    base_url=BASE_URL,
    config_manager=config_manager,
    inbound_call_configs=[
        TwilioInboundCallConfig(
            url="/inbound_call",
            agent_config=ChatGPTAgentConfig(
                openai_api_key=OPENAI_API_KEY,
                model_name="gpt-4o",
                initial_message=BaseMessage(text="Hi, I am your customer support agent. How may i help you today?"),
                prompt_preamble="""You are a customer support agent. Your role is to provide resolution to a customer that is on call with you. You can make-up information to play along, to do this conversation. Just make it sound like a real conversation on telephone. Important: Generate short responses.""",
            ),
            twilio_config=TwilioConfig(
                account_sid=os.environ["TWILIO_ACCOUNT_SID"],
                auth_token=os.environ["TWILIO_AUTH_TOKEN"],
            ),
            synthesizer_config=AzureSynthesizerConfig(
                voice_name="en-GB-LibbyNeural",
                sampling_rate=DEFAULT_SAMPLING_RATE,
                audio_encoding=DEFAULT_AUDIO_ENCODING,
            ),
            transcriber_config=RevAITranscriberConfig.from_telephone_input_device(
            ),
        )
    ],
)

Although this plugged in, is working perfectly.

transcriber_config=AzureTranscriberConfig.from_telephone_input_device(
                candidate_languages=["en-US"],
            )

The REV_AI_API_KEY is also set and this is the log I am getting after logging into threv_ai_transcriber.

Rev AI process called
main-telephony-app-1  | Rev AI url:  wss://api.rev.ai/speechtotext/v1/stream?access_token=02Em5IbtqKEgiKZOIN1O7z_hRZ5-M2JPBdMW86tdN1nccJ1ujSFK4ps2JfMuU3-pp9j9rqMq2HYRECvXQsoyHf9PfvMiA&content_type=audio/x-raw;layout=interleaved;rate=16000;format=S16LE;channels=1
main-telephony-app-1  | Processing agent response
main-telephony-app-1  | 1733389100.974085 Processing agent response: message=EndOfTurn() is_interruptible=True is_first=False is_sole_text_chunk=False
main-telephony-app-1  | Sending end of turn
main-telephony-app-1  | Creating interruptible agent response event
main-telephony-app-1  | Processing agent response
main-telephony-app-1  | 1733389100.974721 Processing agent response: message=BaseMessage(text='Traffic Violations Helpline. Please wait while i authenticate you..', trailing_silence_seconds=0.0, cache_phrase=None) is_interruptible=True is_first=False is_sole_text_chunk=False
main-telephony-app-1  | 1733389100.974768 Synthesizing speech for message
main-telephony-app-1  | Creating interruptible agent response event
main-telephony-app-1  | Start sending speech Traffic Violations Helpline. Please wait while i authenticate you.. to output
main-telephony-app-1  | INFO:     10.131.45.73:49124 - "GET / HTTP/1.1" 404 Not Found
main-telephony-app-1  | Traceback (most recent call last):
main-telephony-app-1  |   File "/usr/local/lib/python3.10/site-packages/vocode/streaming/transcriber/rev_ai_transcriber.py", line 102, in receiver
main-telephony-app-1  |     msg = await ws.recv()
main-telephony-app-1  |   File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 568, in recv
main-telephony-app-1  |     await self.ensure_open()
main-telephony-app-1  |   File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 948, in ensure_open
main-telephony-app-1  |     raise self.connection_closed_exc()
main-telephony-app-1  | websockets.exceptions.ConnectionClosedOK: sent 1000 (OK); then received 1000 (OK) Closing connection
main-telephony-app-1  | Received message from Rev AI: {"type":"connected","id":"0g9J1oA4qYmdbqDv"}
main-telephony-app-1  | Received 'connected' message from Rev AI.
main-telephony-app-1  | 1733389101.548895 Finished sending all chunks to Twilio
main-telephony-app-1  | Got error in Rev.AI receiver: sent 1000 (OK); then received 1000 (OK) Closing connection
main-telephony-app-1  | Terminating Rev.AI transcriber receiver

LLM

GPT-4

Transcription Services

RevAI

Synthesis Services

Microsoft Azure

Telephony Services

Twilio

Conversation Type and Platform

No response

Steps to Reproduce

Use this config to setup

telephony_server = TelephonyServer(
    base_url=BASE_URL,
    config_manager=config_manager,
    inbound_call_configs=[
        TwilioInboundCallConfig(
            url="/inbound_call",
            agent_config=ChatGPTAgentConfig(
                openai_api_key=OPENAI_API_KEY,
                model_name="gpt-4o",
                initial_message=BaseMessage(text="Hi, I am your customer support agent. How may i help you today?"),
                prompt_preamble="""You are a customer support agent. Your role is to provide resolution to a customer that is on call with you. You can make-up information to play along, to do this conversation. Just make it sound like a real conversation on telephone. Important: Generate short responses.""",
            ),
            twilio_config=TwilioConfig(
                account_sid=os.environ["TWILIO_ACCOUNT_SID"],
                auth_token=os.environ["TWILIO_AUTH_TOKEN"],
            ),
            synthesizer_config=AzureSynthesizerConfig(
                voice_name="en-GB-LibbyNeural",
                sampling_rate=DEFAULT_SAMPLING_RATE,
                audio_encoding=DEFAULT_AUDIO_ENCODING,
            ),
            transcriber_config=RevAITranscriberConfig.from_telephone_input_device(
            ),
        )
    ],
)

Expected Behavior

RevAI should transcribe and work, but it is not catching anything at all.

Screenshots

No response

@raghavjaistra raghavjaistra added the bug Something isn't working label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant