to_dict (call_log)

OutboundVoiceAI · voice, json-serialization, transcript-handling, enum-conversion

Serializes a CallLog into a JSON-ready dict, converting enums, timestamps, and transcript entries while guarding optional timings to avoid crashes during status broadcasts.

    def to_dict(self) -> dict:
        return {
            "call_id": self.call_id,
            "patient_id": self.patient_id,
            "patient_name": self.patient_name,
            "phone": self.phone,
            "order_id": self.order_id,
            "priority_bucket": self.priority_bucket,
            "started_at": self.started_at.isoformat() if self.started_at else None,
            "ended_at": self.ended_at.isoformat() if self.ended_at else None,
            "duration_seconds": self.duration_seconds,
            "outcome": self.outcome.value,
            "call_status": self.call_status.value,
            "call_disposition": self.call_disposition.value,
            "mock_mode": self.mock_mode,
            "voice_provider": self.voice_provider,
            "transfer_attempted": se

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key