fix: set provider during campaign run (#69)

This commit is contained in:
Abhishek 2025-11-29 06:34:49 +05:30 committed by GitHub
parent 09897cb5d8
commit 8342cd1dda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

View file

@ -365,16 +365,6 @@ async def _process_status_update(
# Mark workflow run as completed
await db_client.update_workflow_run(run_id=workflow_run_id, is_completed=True)
# Publish campaign event if applicable
if workflow_run.campaign_id:
publisher = await get_campaign_event_publisher()
await publisher.publish_call_completed(
campaign_id=workflow_run.campaign_id,
workflow_run_id=workflow_run_id,
queued_run_id=workflow_run.queued_run_id,
call_duration=int(status.duration) if status.duration else 0,
)
elif status.status in ["failed", "busy", "no-answer", "canceled"]:
logger.warning(
f"[run {workflow_run_id}] Call failed with status: {status.status}"

View file

@ -245,6 +245,16 @@ class CampaignCallDispatcher:
workflow_run_id=workflow_run.id,
)
# Store provider type and metadata in gathered_context
# (required for WebSocket handler to route to correct provider)
await db_client.update_workflow_run(
run_id=workflow_run.id,
gathered_context={
"provider": provider.PROVIDER_NAME,
**(call_result.provider_metadata or {}),
},
)
logger.info(
f"Call initiated for workflow run {workflow_run.id}, Call ID: {call_result.call_id}"
)