mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-19 08:28:10 +02:00
fix: ignore completed call status
This commit is contained in:
parent
51adfdda66
commit
e485f649bd
7 changed files with 168 additions and 96 deletions
|
|
@ -1742,12 +1742,11 @@ async def complete_transfer_function_call(tool_call_id: str, request: Request):
|
|||
|
||||
# Note: All transfer coordination now handled via Redis events
|
||||
|
||||
# If this is a "completed" status but we already handled the success case via answer webhook,
|
||||
# we should still publish the COMPLETED event but not override previous results
|
||||
# Skip "completed" status to avoid overriding successful transfer results
|
||||
# The "answered" status already handled the success case
|
||||
if call_status == "completed":
|
||||
# Check if we already published an ANSWERED event
|
||||
logger.info(f"Processing 'completed' status for {tool_call_id}")
|
||||
# We'll still publish COMPLETED event but with different handling
|
||||
logger.info(f"Ignoring 'completed' status for {tool_call_id} to avoid overriding previous results")
|
||||
return {"status": "ignored", "reason": "completed_status_filtered"}
|
||||
|
||||
# Import required event classes
|
||||
from api.services.telephony.transfer_event_protocol import TransferEvent, TransferEventType
|
||||
|
|
@ -1803,15 +1802,6 @@ async def complete_transfer_function_call(tool_call_id: str, request: Request):
|
|||
"call_sid": call_sid,
|
||||
"end_call": True
|
||||
}
|
||||
elif call_status == "completed":
|
||||
# Call completed successfully
|
||||
result = {
|
||||
"status": "completed",
|
||||
"message": "Your call has been completed successfully.",
|
||||
"action": "transfer_completed",
|
||||
"call_sid": call_sid,
|
||||
"end_call": True # End call normally
|
||||
}
|
||||
else:
|
||||
# Intermediate status (ringing, in-progress, etc.), don't complete yet
|
||||
logger.info(f"Received intermediate status {call_status}, waiting for final status")
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import aiohttp
|
|||
from fastapi import HTTPException
|
||||
from loguru import logger
|
||||
from twilio.request_validator import RequestValidator
|
||||
from pipecat.utils.context import set_current_call_sid
|
||||
from pipecat.utils.run_context import set_current_call_sid
|
||||
|
||||
from api.enums import WorkflowRunMode
|
||||
from api.services.telephony.base import (
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import re
|
|||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
import aiohttp
|
||||
import httpx
|
||||
from loguru import logger
|
||||
|
||||
from api.db import db_client
|
||||
|
|
@ -319,7 +320,7 @@ class CustomToolManager:
|
|||
await self._engine.task.queue_frame(TTSSpeakFrame(custom_message))
|
||||
|
||||
# Get original call information from Pipecat context
|
||||
from pipecat.utils.context import get_current_call_sid
|
||||
from pipecat.utils.run_context import get_current_call_sid
|
||||
|
||||
original_call_sid = get_current_call_sid()
|
||||
caller_number = None # Skip caller number for now as requested
|
||||
|
|
@ -352,7 +353,6 @@ class CustomToolManager:
|
|||
}
|
||||
|
||||
# Initialize Redis-based transfer coordination
|
||||
import httpx
|
||||
import time
|
||||
|
||||
# Get backend endpoint URL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue