fix: missing call_id in gathered_context (#165)

This commit is contained in:
Sabiha Khan 2026-02-18 21:13:28 +05:30 committed by GitHub
parent 9ce5a8e5e2
commit 13b41437e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View file

@ -425,7 +425,6 @@ async def _create_inbound_workflow_run(
"caller_number": normalized_data.from_number,
"called_number": normalized_data.to_number,
"direction": "inbound",
"call_id": call_id,
"account_id": normalized_data.account_id,
"provider": provider,
"data_source": data_source,
@ -433,6 +432,9 @@ async def _create_inbound_workflow_run(
"to_country": normalized_data.to_country,
"raw_webhook_data": normalized_data.raw_data,
},
gathered_context={
"call_id": call_id,
},
)
logger.info(
@ -1273,11 +1275,11 @@ async def handle_vobiz_hangup_callback_by_workflow(
try:
db_client = WorkflowRunClient()
async with db_client.async_session() as session:
# Fetch workflow run with matching call_id in initial_context
# Fetch workflow run with matching call_id in gathered_context
query = text("""
SELECT id FROM workflow_runs
WHERE workflow_id = :workflow_id
AND CAST(initial_context AS jsonb) @> CAST(:call_id_json AS jsonb)
AND CAST(gathered_context AS jsonb) @> CAST(:call_id_json AS jsonb)
ORDER BY created_at DESC
LIMIT 1
""")