Skip to content

Outbound telephony agent is not working #42

@hoangtran98

Description

@hoangtran98

Hi team,

I've recently encountered with outbound telephony agent setup with LK v1.x, specifically for make_call example. I've not seen this issue with LK v0.x. The issue is that call is made successfully (callee picks up the phone), agent is unable to join the room due to AgentSession closing.

2025-08-04 14:02:43,549 - INFO calling-agent - Received metadata: {"phone_number": "+xxxx", "question": "Do you prefer chocolate or vanilla ice cream?", "row_index": 1} {"pid": 33261, "job_id": "AJ_bsaq7kkDLPsN"}
2025-08-04 14:02:43,549 - INFO calling-agent - Parsed metadata - phone_number: +xxxx, row_index: 1, question: Do you prefer chocolate or vanilla ice cream? {"pid": 33261, "job_id": "AJ_bsaq7kkDLPsN"}
2025-08-04 14:02:43,667 - DEBUG livekit.agents - http_session(): creating a new httpclient ctx {"pid": 33261, "job_id": "AJ_bsaq7kkDLPsN"}
2025-08-04 14:02:44,226 - ERROR livekit.agents - AgentSession is closing due to unrecoverable error
Traceback (most recent call last):
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/livekit/agents/stt/stt.py", line 251, in _main_task
    return await self._run()
           ^^^^^^^^^^^^^^^^^
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/livekit/plugins/deepgram/stt.py", line 488, in _run
    ws = await self._connect_ws()
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/livekit/plugins/deepgram/stt.py", line 550, in _connect_ws
    ws = await asyncio.wait_for(
         ^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "/opt/homebrew/Cellar/[email protected]/3.13.4/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/tasks.py", line 507, in wait_for
    return await fut
           ^^^^^^^^^
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/aiohttp/client.py", line 1084, in _ws_connect
    raise WSServerHandshakeError(
    ...<5 lines>...
    )
aiohttp.client_exceptions.WSServerHandshakeError: 401, message='Invalid response status', url='wss://api.deepgram.com/v1/listen?model=nova-3&punctuate=true&smart_format=false&no_delay=true&interim_results=true&encoding=linear16&vad_events=true&sample_rate=16000&channels=1&endpointing=25&filler_words=true&profanity_filter=false&numerals=false&mip_opt_out=false&language=en-US' {"pid": 33261, "job_id": "AJ_bsaq7kkDLPsN"}
2025-08-04 14:02:44,232 - ERROR livekit.agents - Error in _stt_task
Traceback (most recent call last):
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/livekit/agents/stt/stt.py", line 367, in __anext__
    val = await self._event_aiter.__anext__()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopAsyncIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/livekit/agents/utils/log.py", line 16, in async_fn_logs
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/livekit/agents/voice/audio_recognition.py", line 452, in _stt_task
    async for ev in node:
    ...<3 lines>...
        await self._on_stt_event(ev)
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/livekit/agents/voice/agent.py", line 352, in stt_node
    async for event in stream:
        yield event
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/livekit/agents/stt/stt.py", line 370, in __anext__
    raise exc  # noqa: B904
    ^^^^^^^^^
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/livekit/agents/stt/stt.py", line 251, in _main_task
    return await self._run()
           ^^^^^^^^^^^^^^^^^
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/livekit/plugins/deepgram/stt.py", line 488, in _run
    ws = await self._connect_ws()
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/livekit/plugins/deepgram/stt.py", line 550, in _connect_ws
    ws = await asyncio.wait_for(
         ^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "/opt/homebrew/Cellar/[email protected]/3.13.4/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/tasks.py", line 507, in wait_for
    return await fut
           ^^^^^^^^^
  File "/Users/hoangtran/GitHub/python-agents-examples/.venv/lib/python3.13/site-packages/aiohttp/client.py", line 1084, in _ws_connect
    raise WSServerHandshakeError(
    ...<5 lines>...
    )
aiohttp.client_exceptions.WSServerHandshakeError: 401, message='Invalid response status', url='wss://api.deepgram.com/v1/listen?model=nova-3&punctuate=true&smart_format=false&no_delay=true&interim_results=true&encoding=linear16&vad_events=true&sample_rate=16000&channels=1&endpointing=25&filler_words=true&profanity_filter=false&numerals=false&mip_opt_out=false&language=en-US' {"pid": 33261, "job_id": "AJ_bsaq7kkDLPsN"}

Please help investigate this issue.

Thanks,

Hoang

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions