mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-13 11:22:14 +02:00
refactor: add call strategies, cleanup transfer events
This commit is contained in:
parent
e1d8b52b42
commit
99ebede3e3
9 changed files with 154 additions and 177 deletions
|
|
@ -6,7 +6,6 @@ The ARI WebSocket event listener runs as a separate process (ari_manager.py).
|
|||
"""
|
||||
|
||||
import json
|
||||
import time
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Optional
|
||||
from urllib.parse import urlparse
|
||||
|
||||
|
|
@ -393,20 +392,9 @@ class ARIProvider(TelephonyProvider):
|
|||
from api.services.telephony.call_transfer_manager import (
|
||||
get_call_transfer_manager,
|
||||
)
|
||||
from api.services.telephony.transfer_event_protocol import TransferContext
|
||||
|
||||
# Store transfer context for event correlation
|
||||
# Get call transfer manager for event correlation mapping
|
||||
call_transfer_manager = await get_call_transfer_manager()
|
||||
context = TransferContext(
|
||||
transfer_id=transfer_id,
|
||||
call_sid=None, # Will be updated after channel creation
|
||||
target_number=destination,
|
||||
tool_uuid=kwargs.get("tool_uuid", ""),
|
||||
original_call_sid=kwargs.get("original_call_sid", ""),
|
||||
conference_name=conference_name,
|
||||
initiated_at=time.time(),
|
||||
)
|
||||
await call_transfer_manager.store_transfer_context(context, ttl=timeout + 10)
|
||||
|
||||
# Build SIP endpoint
|
||||
if destination.startswith("SIP/") or destination.startswith("PJSIP/"):
|
||||
|
|
@ -450,12 +438,6 @@ class ARIProvider(TelephonyProvider):
|
|||
await call_transfer_manager.remove_transfer_context(transfer_id)
|
||||
raise Exception("Failed to create destination channel")
|
||||
|
||||
# Update transfer context with destination channel ID
|
||||
context.call_sid = destination_channel_id
|
||||
await call_transfer_manager.store_transfer_context(
|
||||
context, ttl=timeout + 10
|
||||
)
|
||||
|
||||
# Store transfer channel mapping for event correlation
|
||||
await call_transfer_manager.store_transfer_channel_mapping(
|
||||
destination_channel_id, transfer_id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue