mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-01 08:59:46 +02:00
transfer call
This commit is contained in:
parent
5d14d17ceb
commit
51adfdda66
41 changed files with 2633 additions and 167 deletions
|
|
@ -80,14 +80,29 @@ def register_event_handlers(
|
|||
@transport.event_handler("on_client_disconnected")
|
||||
async def on_client_disconnected(_transport, _participant):
|
||||
call_disposed = engine.is_call_disposed()
|
||||
transfer_in_progress = getattr(engine, '_transfer_in_progress', False)
|
||||
|
||||
logger.info(f"[TRANSFER-DEBUG] on_client_disconnected triggered")
|
||||
logger.info(f"[TRANSFER-DEBUG] Engine instance ID in event_handler: {id(engine)}")
|
||||
logger.info(f"[TRANSFER-DEBUG] Engine type in event_handler: {type(engine)}")
|
||||
logger.info(f"[TRANSFER-DEBUG] transfer_in_progress attribute exists: {hasattr(engine, '_transfer_in_progress')}")
|
||||
logger.info(f"[TRANSFER-DEBUG] transfer_in_progress value: {transfer_in_progress}")
|
||||
logger.info(f"[TRANSFER-DEBUG] Call disposed: {call_disposed}")
|
||||
|
||||
logger.debug(
|
||||
f"In on_client_disconnected callback handler. Call disposed: {call_disposed}"
|
||||
f"In on_client_disconnected callback handler. Call disposed: {call_disposed}, "
|
||||
f"Transfer in progress: {transfer_in_progress}"
|
||||
)
|
||||
|
||||
# Stop recordings
|
||||
await audio_buffer.stop_recording()
|
||||
|
||||
# End the call
|
||||
# Skip auto hang-up if transfer is in progress
|
||||
if transfer_in_progress:
|
||||
logger.info("Transfer in progress - skipping auto hang-up, letting redirect handle call")
|
||||
return
|
||||
logger.info("Transfer in progress - False, proceeding with hang up")
|
||||
# Normal hang-up logic for non-transfer disconnections
|
||||
await engine.end_call_with_reason(
|
||||
EndTaskReason.USER_HANGUP.value, abort_immediately=True
|
||||
)
|
||||
|
|
|
|||
|
|
@ -71,6 +71,12 @@ def build_pipeline(
|
|||
user_context_aggregator,
|
||||
llm, # LLM
|
||||
pipeline_engine_callback_processor,
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
processors.extend(
|
||||
[
|
||||
tts, # TTS
|
||||
transport.output(), # Transport bot output
|
||||
audio_buffer, # AudioBufferProcessor - records both input and output audio
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ async def run_pipeline_twilio(
|
|||
# Create audio configuration for Twilio
|
||||
audio_config = create_audio_config(WorkflowRunMode.TWILIO.value)
|
||||
|
||||
|
||||
transport = await create_twilio_transport(
|
||||
websocket_client,
|
||||
stream_sid,
|
||||
|
|
@ -125,6 +126,7 @@ async def run_pipeline_twilio(
|
|||
vad_config,
|
||||
ambient_noise_config,
|
||||
)
|
||||
|
||||
await _run_pipeline(
|
||||
transport,
|
||||
workflow_id,
|
||||
|
|
@ -543,6 +545,7 @@ async def _run_pipeline(
|
|||
|
||||
engine = PipecatEngine(
|
||||
llm=llm,
|
||||
transport=transport,
|
||||
workflow=workflow_graph,
|
||||
call_context_vars=merged_call_context_vars,
|
||||
workflow_run_id=workflow_run_id,
|
||||
|
|
@ -552,7 +555,7 @@ async def _run_pipeline(
|
|||
embeddings_base_url=embeddings_base_url,
|
||||
)
|
||||
|
||||
# Create pipeline components with audio configuration
|
||||
# Create pipeline components
|
||||
audio_buffer, context = create_pipeline_components(audio_config)
|
||||
|
||||
# Set the context and audio_buffer after creation
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ from pipecat.transports.websocket.fastapi import (
|
|||
FastAPIWebsocketParams,
|
||||
FastAPIWebsocketTransport,
|
||||
)
|
||||
from loguru import logger
|
||||
|
||||
librnnoise_path = os.path.normpath(
|
||||
str(APP_ROOT_DIR / "native" / "rnnoise" / "librnnoise.so")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue