fix: allow cross subdomain cookies at posthog (#243)

This commit is contained in:
Sabiha Khan 2026-04-17 11:47:20 +05:30 committed by GitHub
parent 1d0a7cd2d8
commit 5ecc0d4da9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 39 additions and 7 deletions

View file

@ -315,11 +315,15 @@ class OrganizationUsageClient(BaseDBClient):
total_tokens += dograh_tokens
total_duration_seconds += int(round(call_duration))
# Extract phone number from initial_context
# Outbound calls store it as "phone_number"; inbound calls store it as "caller_number"
phone_number = None
if run.initial_context:
phone_number = run.initial_context.get("phone_number") or run.initial_context.get("caller_number")
# Extract phone number from initial_context based on call_type.
# Inbound runs only have caller_number/called_number; the
# caller_number is the customer. Outbound runs use the
# phone_number key written by the dispatchers.
ic = run.initial_context or {}
if run.call_type == "inbound":
phone_number = ic.get("caller_number")
else:
phone_number = ic.get("phone_number")
# Extract disposition from gathered_context
disposition = None
@ -337,6 +341,7 @@ class OrganizationUsageClient(BaseDBClient):
"recording_url": run.recording_url,
"transcript_url": run.transcript_url,
"phone_number": phone_number,
"call_type": run.call_type,
"disposition": disposition,
"initial_context": run.initial_context,
"gathered_context": run.gathered_context,

View file

@ -48,6 +48,7 @@ class WorkflowRunUsageResponse(BaseModel):
recording_url: Optional[str] = None
transcript_url: Optional[str] = None
phone_number: Optional[str] = None
call_type: Optional[str] = None
disposition: Optional[str] = None
initial_context: Optional[Dict[str, Any]] = None
gathered_context: Optional[Dict[str, Any]] = None