add transfer call tool editor

This commit is contained in:
Abhishek Kumar 2026-02-06 09:45:34 +05:30
parent f77a2afca6
commit 97a44f00ff
6 changed files with 229 additions and 29 deletions

View file

@ -0,0 +1,63 @@
"""add transfer call category
Revision ID: f5db3dfa1f62
Revises: 34c8537dfde5
Create Date: 2026-02-06 09:24:44.887105
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
from alembic_postgresql_enum import TableReference
# revision identifiers, used by Alembic.
revision: str = "f5db3dfa1f62"
down_revision: Union[str, None] = "34c8537dfde5"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_index(
"idx_queued_runs_campaign_state_optimized",
"queued_runs",
["campaign_id", "state"],
unique=False,
postgresql_where=sa.text("state = 'queued'"),
)
op.sync_enum_values(
enum_schema="public",
enum_name="tool_category",
new_values=["http_api", "end_call", "transfer_call", "native", "integration"],
affected_columns=[
TableReference(
table_schema="public", table_name="tools", column_name="category"
)
],
enum_values_to_rename=[],
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.sync_enum_values(
enum_schema="public",
enum_name="tool_category",
new_values=["http_api", "end_call", "native", "integration"],
affected_columns=[
TableReference(
table_schema="public", table_name="tools", column_name="category"
)
],
enum_values_to_rename=[],
)
op.drop_index(
"idx_queued_runs_campaign_state_optimized",
table_name="queued_runs",
postgresql_where=sa.text("state = 'queued'"),
)
# ### end Alembic commands ###

View file

@ -75,8 +75,8 @@ class EndCallToolDefinition(BaseModel):
class TransferCallConfig(BaseModel):
"""Configuration for Transfer Call tools."""
transfer_number: str = Field(description="Number to transfer the call to")
transfer_message: Optional[str] = Field(
transferNumber: str = Field(description="Number to transfer the call to")
transferMessage: Optional[str] = Field(
default=None, description="Message to play before transferring the call"
)

View file

@ -279,7 +279,9 @@ class CustomToolManager:
# Wait for the audio to play or until stopped
try:
await asyncio.wait_for(stop_event.wait(), timeout=duration_secs)
await asyncio.wait_for(
stop_event.wait(), timeout=duration_secs + 1.5
)
break # Stop event was set
except asyncio.TimeoutError:
pass # Continue looping