Documentation
¶
Overview ¶
Package callsystem provides a Twilio implementation of callsystem.CallSystem.
Index ¶
- type Call
- func (c *Call) Answer(ctx context.Context) error
- func (c *Call) AttachAgent(ctx context.Context, session agent.Session) error
- func (c *Call) DetachAgent(ctx context.Context) error
- func (c *Call) Direction() callsystem.CallDirection
- func (c *Call) Duration() time.Duration
- func (c *Call) From() string
- func (c *Call) Hangup(ctx context.Context) error
- func (c *Call) ID() string
- func (c *Call) SetTransport(conn omnitransport.Connection)
- func (c *Call) StartTime() time.Time
- func (c *Call) Status() callsystem.CallStatus
- func (c *Call) To() string
- func (c *Call) Transport() omnitransport.Connection
- type Option
- type Provider
- func (p *Provider) Close() error
- func (p *Provider) Configure(config callsystem.CallSystemConfig) error
- func (p *Provider) GetCall(ctx context.Context, callID string) (callsystem.Call, error)
- func (p *Provider) HandleIncomingWebhook(callSID, from, to string) (callsystem.Call, string, error)
- func (p *Provider) HandleStatusCallback(callSID, status string)
- func (p *Provider) ListCalls(ctx context.Context) ([]callsystem.Call, error)
- func (p *Provider) MakeCall(ctx context.Context, to string, opts ...callsystem.CallOption) (callsystem.Call, error)
- func (p *Provider) Name() string
- func (p *Provider) OnIncomingCall(handler callsystem.CallHandler)
- func (p *Provider) SendSMS(ctx context.Context, to, body string) (*callsystem.SMSMessage, error)
- func (p *Provider) SendSMSFrom(ctx context.Context, to, from, body string) (*callsystem.SMSMessage, error)
- func (p *Provider) Transport() *transport.Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call struct {
// contains filtered or unexported fields
}
Call implements callsystem.Call for Twilio calls.
func (*Call) AttachAgent ¶
AttachAgent attaches a voice agent to handle the call.
func (*Call) DetachAgent ¶
DetachAgent detaches the voice agent.
func (*Call) Direction ¶
func (c *Call) Direction() callsystem.CallDirection
Direction returns inbound or outbound.
func (*Call) SetTransport ¶
func (c *Call) SetTransport(conn omnitransport.Connection)
SetTransport sets the transport connection (called when Media Streams connects).
func (*Call) Status ¶
func (c *Call) Status() callsystem.CallStatus
Status returns the current call status.
func (*Call) Transport ¶
func (c *Call) Transport() omnitransport.Connection
Transport returns the underlying transport connection.
type Option ¶
type Option func(*options)
Option configures the Provider.
func WithAccountSID ¶
WithAccountSID sets the Twilio Account SID.
func WithAuthToken ¶
WithAuthToken sets the Twilio Auth Token.
func WithPhoneNumber ¶
WithPhoneNumber sets the default outbound phone number.
func WithWebhookURL ¶
WithWebhookURL sets the webhook URL for incoming calls.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements callsystem.CallSystem using Twilio.
func (*Provider) Configure ¶
func (p *Provider) Configure(config callsystem.CallSystemConfig) error
Configure configures the call system.
func (*Provider) HandleIncomingWebhook ¶
HandleIncomingWebhook processes a Twilio incoming call webhook. This should be called from your HTTP handler.
func (*Provider) HandleStatusCallback ¶
HandleStatusCallback processes a Twilio status callback webhook.
func (*Provider) MakeCall ¶
func (p *Provider) MakeCall(ctx context.Context, to string, opts ...callsystem.CallOption) (callsystem.Call, error)
MakeCall initiates an outbound call.
func (*Provider) OnIncomingCall ¶
func (p *Provider) OnIncomingCall(handler callsystem.CallHandler)
OnIncomingCall sets the handler for incoming calls.
func (*Provider) SendSMS ¶
func (p *Provider) SendSMS(ctx context.Context, to, body string) (*callsystem.SMSMessage, error)
SendSMS sends an SMS message using the default phone number.
func (*Provider) SendSMSFrom ¶
func (p *Provider) SendSMSFrom(ctx context.Context, to, from, body string) (*callsystem.SMSMessage, error)
SendSMSFrom sends an SMS message from a specific phone number.