Documentation
¶
Overview ¶
Package callsystem provides integrations with telephony and meeting platforms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call interface {
// ID returns the call identifier.
ID() string
// Direction returns inbound or outbound.
Direction() CallDirection
// Status returns the current call status.
Status() CallStatus
// From returns the caller ID.
From() string
// To returns the called number.
To() string
// StartTime returns when the call started.
StartTime() time.Time
// Duration returns the call duration.
Duration() time.Duration
// Answer answers an inbound call.
Answer(ctx context.Context) error
// Hangup ends the call.
Hangup(ctx context.Context) error
// Transport returns the underlying transport connection.
Transport() transport.Connection
// AttachAgent attaches a voice agent to handle the call.
AttachAgent(ctx context.Context, session agent.Session) error
// DetachAgent detaches the voice agent.
DetachAgent(ctx context.Context) error
}
Call represents a phone or video call.
type CallDirection ¶
type CallDirection string
CallDirection indicates inbound or outbound call.
const ( // Inbound is an incoming call. Inbound CallDirection = "inbound" // Outbound is an outgoing call. Outbound CallDirection = "outbound" )
type CallHandler ¶
CallHandler is called when a new call arrives.
type CallOption ¶
type CallOption func(*CallOptions)
CallOption configures an outbound call.
func WithAgent ¶
func WithAgent(config *agent.Config) CallOption
WithAgent automatically attaches a voice agent to the call.
func WithMachineDetection ¶
func WithMachineDetection() CallOption
WithMachineDetection enables answering machine detection.
func WithStatusCallback ¶
func WithStatusCallback(url string) CallOption
WithStatusCallback sets a webhook URL for status updates.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) CallOption
WithTimeout sets the call timeout.
func WithWhisper ¶
func WithWhisper(message string) CallOption
WithWhisper sets a whisper message for the agent.
type CallOptions ¶
type CallOptions struct {
From string
Timeout time.Duration
MachineDetect bool
Record bool
Whisper string
AgentConfig *agent.Config
StatusCallback string
}
CallOptions holds parsed options for MakeCall. Exported so provider implementations can access option values.
type CallStatus ¶
type CallStatus string
CallStatus represents the call state.
const ( // StatusRinging indicates the call is ringing. StatusRinging CallStatus = "ringing" // StatusAnswered indicates the call is connected. StatusAnswered CallStatus = "answered" // StatusEnded indicates the call has ended. StatusEnded CallStatus = "ended" // StatusFailed indicates the call failed. StatusFailed CallStatus = "failed" // StatusBusy indicates the line was busy. StatusBusy CallStatus = "busy" // StatusNoAnswer indicates no answer. StatusNoAnswer CallStatus = "no_answer" )
type CallSystem ¶
type CallSystem interface {
// Name returns the call system name.
Name() string
// Configure configures the call system.
Configure(config CallSystemConfig) error
// OnIncomingCall sets the handler for incoming calls.
OnIncomingCall(handler CallHandler)
// MakeCall initiates an outbound call.
MakeCall(ctx context.Context, to string, opts ...CallOption) (Call, error)
// GetCall retrieves a call by ID.
GetCall(ctx context.Context, callID string) (Call, error)
// ListCalls lists active calls.
ListCalls(ctx context.Context) ([]Call, error)
// Close shuts down the call system.
Close() error
}
CallSystem defines the interface for telephony/meeting integrations.
type CallSystemConfig ¶
type CallSystemConfig struct {
// AccountSID is the account identifier (Twilio, etc).
AccountSID string
// AuthToken is the authentication token.
AuthToken string
// APIKey is an API key (alternative to AuthToken).
APIKey string
// APISecret is the API secret.
APISecret string
// WebhookURL is the URL for incoming webhooks.
WebhookURL string
// PhoneNumber is the default outbound caller ID.
PhoneNumber string
// Region is the service region.
Region string
}
CallSystemConfig configures a call system integration.
type Meeting ¶
type Meeting interface {
// ID returns the meeting identifier.
ID() string
// Title returns the meeting title.
Title() string
// Participants returns current participants.
Participants() []Participant
// Transport returns the transport connection.
Transport() transport.Connection
// AttachAgent attaches a voice agent to the meeting.
AttachAgent(ctx context.Context, session agent.Session) error
// DetachAgent detaches the voice agent.
DetachAgent(ctx context.Context) error
// Leave leaves the meeting.
Leave(ctx context.Context) error
}
Meeting represents a video/audio meeting.
type MeetingOption ¶
type MeetingOption func(*meetingOptions)
MeetingOption configures meeting join behavior.
func WithDisplayName ¶
func WithDisplayName(name string) MeetingOption
WithDisplayName sets the bot display name.
func WithMeetingAgent ¶
func WithMeetingAgent(config *agent.Config) MeetingOption
WithMeetingAgent attaches a voice agent to the meeting.
type MeetingSystem ¶
type MeetingSystem interface {
// Name returns the meeting system name.
Name() string
// JoinMeeting joins an existing meeting.
JoinMeeting(ctx context.Context, meetingID string, opts ...MeetingOption) (Meeting, error)
// LeaveMeeting leaves a meeting.
LeaveMeeting(ctx context.Context, meetingID string) error
// ListMeetings lists active meetings.
ListMeetings(ctx context.Context) ([]Meeting, error)
}
MeetingSystem defines the interface for meeting platform integrations.
type Participant ¶
type Participant struct {
// ID is the participant identifier.
ID string
// Name is the participant display name.
Name string
// IsMuted indicates if audio is muted.
IsMuted bool
// IsBot indicates if this is a bot participant.
IsBot bool
}
Participant represents a meeting participant.