Documentation
¶
Overview ¶
Package calling provides a client for the Webex Calling APIs. It includes sub-clients for Call History, Call Settings, Voicemail, and Contacts.
Index ¶
- func ModifySdpForMobius(sdp string) string
- func RoapToSDP(roap *RoapMessage) string
- type Address
- type AudioBridge
- func (ab *AudioBridge) AttachCall(call *Call)
- func (ab *AudioBridge) Close() error
- func (ab *AudioBridge) DetachCall()
- func (ab *AudioBridge) GetCall() *Call
- func (ab *AudioBridge) HandleSignaling(transport SignalingTransport) error
- func (ab *AudioBridge) LocalTrack() *webrtc.TrackLocalStaticRTP
- func (ab *AudioBridge) OnConnectionStateChange(handler func(state webrtc.PeerConnectionState))
- func (ab *AudioBridge) OnICECandidate(handler func(candidate *webrtc.ICECandidate))
- func (ab *AudioBridge) PeerConnection() *webrtc.PeerConnection
- type AudioBridgeConfig
- type AudioTrackWriter
- type BusinessContinuitySetting
- type Call
- func (c *Call) Answer(remoteOffer string) error
- func (c *Call) CompleteTransfer(transferType TransferType, transferCallID, transferTarget string) error
- func (c *Call) Dial() error
- func (c *Call) DoHoldResume() error
- func (c *Call) End() error
- func (c *Call) GetCallID() string
- func (c *Call) GetCorrelationID() string
- func (c *Call) GetDirection() CallDirection
- func (c *Call) GetDisconnectReason() DisconnectReason
- func (c *Call) GetMedia() *MediaEngine
- func (c *Call) GetState() CallState
- func (c *Call) HandleMobiusEvent(event *MobiusCallEvent)
- func (c *Call) Hold() error
- func (c *Call) IsConnected() bool
- func (c *Call) IsHeld() bool
- func (c *Call) IsMuted() bool
- func (c *Call) Mute()
- func (c *Call) PostStatus() error
- func (c *Call) Resume() error
- func (c *Call) SendDigit(tone string) error
- func (c *Call) Unmute()
- type CallConfig
- type CallDetails
- type CallDirection
- type CallEventKey
- type CallForwardAlwaysSetting
- type CallForwardBusySetting
- type CallForwardNoAnswerSetting
- type CallForwardSetting
- type CallForwardingConfig
- type CallHistoryClient
- func (c *CallHistoryClient) DeleteCallHistoryRecords(deleteSessionIDs []EndTimeSessionID) (*DeleteCallHistoryResponse, error)
- func (c *CallHistoryClient) GetCallHistoryData(days, limit int, sort Sort, sortBy SortBy) (*CallHistoryResponse, error)
- func (c *CallHistoryClient) UpdateMissedCalls(endTimeSessionIDs []EndTimeSessionID) (*UpdateMissedCallsResponse, error)
- type CallHistoryResponse
- type CallRecordLink
- type CallRecordOther
- type CallRecordSelf
- type CallSettingResponse
- type CallSettingsClient
- func (c *CallSettingsClient) GetCallForwardAlwaysSetting(directoryNumber string) (*CallSettingResponse, error)
- func (c *CallSettingsClient) GetCallForwardSetting() (*CallSettingResponse, error)
- func (c *CallSettingsClient) GetCallWaitingSetting() (*CallSettingResponse, error)
- func (c *CallSettingsClient) GetDoNotDisturbSetting() (*CallSettingResponse, error)
- func (c *CallSettingsClient) GetVoicemailSetting() (*CallSettingResponse, error)
- func (c *CallSettingsClient) SetCallForwardSetting(setting CallForwardSetting) (*CallSettingResponse, error)
- func (c *CallSettingsClient) SetDoNotDisturbSetting(enabled bool) (*CallSettingResponse, error)
- func (c *CallSettingsClient) SetVoicemailSetting(setting VoicemailSettingConfig) (*CallSettingResponse, error)
- type CallState
- type CallType
- type CallerIDInfo
- type CallingClient
- func (cc *CallingClient) ClearAudioBridge()
- func (cc *CallingClient) ConnectMercury(merc *mercury.Client) error
- func (cc *CallingClient) CreateLine() (*Line, error)
- func (cc *CallingClient) DeregisterAllDevices() (int, error)
- func (cc *CallingClient) DisconnectMercury()
- func (cc *CallingClient) DiscoverMobiusServers() error
- func (cc *CallingClient) GetActiveCalls() map[string]*Call
- func (cc *CallingClient) GetAudioBridge() *AudioBridge
- func (cc *CallingClient) GetConnectedCall() *Call
- func (cc *CallingClient) GetLines() map[string]*Line
- func (cc *CallingClient) GetWDMWebSocketURL() string
- func (cc *CallingClient) HandleMercuryEvent(eventData []byte)
- func (cc *CallingClient) IsMercuryConnected() bool
- func (cc *CallingClient) MakeCall(line *Line, destination *CallDetails) (*Call, error)
- func (cc *CallingClient) SetAudioBridge(bridge *AudioBridge)
- func (cc *CallingClient) SetMobiusServers(primary, backup []string)
- func (cc *CallingClient) Shutdown() error
- type CallingClientConfig
- type CallingSpecifics
- type Client
- type Config
- type Contact
- type ContactGroup
- type ContactResponse
- type ContactType
- type ContactsClient
- func (c *ContactsClient) CreateContact(contact Contact) (*ContactResponse, error)
- func (c *ContactsClient) CreateContactGroup(displayName, encryptionKeyURL string, groupType GroupType) (*ContactResponse, error)
- func (c *ContactsClient) DeleteContact(contactID string) (*ContactResponse, error)
- func (c *ContactsClient) DeleteContactGroup(groupID string) (*ContactResponse, error)
- func (c *ContactsClient) GetContacts() (*ContactResponse, error)
- type DeleteCallHistoryResponse
- type DeviceType
- type DisconnectCode
- type DisconnectReason
- type DisplayInformation
- type Disposition
- type EndTimeSessionID
- type EventEmitter
- type EventHandler
- type GroupType
- type Line
- type LineConfig
- type LineEventKey
- type MediaConfig
- type MediaEngine
- func (me *MediaEngine) AddAudioTrack() (*webrtc.TrackLocalStaticRTP, error)
- func (me *MediaEngine) Close() error
- func (me *MediaEngine) ConnectedCh() <-chan struct{}
- func (me *MediaEngine) CreateAnswer() (string, error)
- func (me *MediaEngine) CreateOffer() (string, error)
- func (me *MediaEngine) GetConnectionState() webrtc.PeerConnectionState
- func (me *MediaEngine) GetLocalTrack() *webrtc.TrackLocalStaticRTP
- func (me *MediaEngine) GetPeerConnection() *webrtc.PeerConnection
- func (me *MediaEngine) GetRemoteTrack() *webrtc.TrackRemote
- func (me *MediaEngine) IsConnected() bool
- func (me *MediaEngine) IsMuted() bool
- func (me *MediaEngine) Mute()
- func (me *MediaEngine) OnICECandidate(handler func(candidate *webrtc.ICECandidate))
- func (me *MediaEngine) OnRemoteTrack(handler func(track *webrtc.TrackRemote))
- func (me *MediaEngine) SetRemoteAnswer(sdp string) error
- func (me *MediaEngine) SetRemoteOffer(sdp string) error
- func (me *MediaEngine) Unmute()
- type MidCallEvent
- type MobiusCallData
- type MobiusCallEvent
- type MobiusCallResponse
- type MobiusDeviceInfo
- type MobiusEventType
- type PersonInfo
- type PhoneNumber
- type RedirectionDetails
- type RegistrationStatus
- type RoapMessage
- type RoapMessageType
- type SessionType
- type SignalingMessage
- type SignalingTransport
- type Sort
- type SortBy
- type ToggleSetting
- type TransferType
- type URIAddress
- type UpdateMissedCallsResponse
- type UserSession
- type VoicemailCallingPartyInfo
- type VoicemailClient
- func (c *VoicemailClient) Delete(messageID string) (*VoicemailResponse, error)
- func (c *VoicemailClient) GetTranscript(messageID string) (*VoicemailResponse, error)
- func (c *VoicemailClient) GetVoicemailContent(messageID string) (*VoicemailResponse, error)
- func (c *VoicemailClient) GetVoicemailList(offset, offsetLimit int, sort Sort) (*VoicemailResponse, error)
- func (c *VoicemailClient) GetVoicemailSummary() (*VoicemailResponse, error)
- func (c *VoicemailClient) MarkAsRead(messageID string) (*VoicemailResponse, error)
- func (c *VoicemailClient) MarkAsUnread(messageID string) (*VoicemailResponse, error)
- type VoicemailContent
- type VoicemailMessage
- type VoicemailResponse
- type VoicemailSettingConfig
- type VoicemailSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ModifySdpForMobius ¶
ModifySdpForMobius cleans up the SDP offer for BroadWorks/Mobius compatibility: - Removes IPv6 candidates (BroadWorks only supports IPv4) - Converts port 9 to 0 in m= line (JS SDK: convertPort9to0) - Removes rtcp-fb lines (BroadWorks doesn't support transport-cc) - Removes extmap lines (BroadWorks doesn't support RTP header extensions) - Removes extmap-allow-mixed
func RoapToSDP ¶
func RoapToSDP(roap *RoapMessage) string
RoapToSDP extracts the SDP from a ROAP message received from Mobius
Types ¶
type Address ¶
type Address struct {
City string `json:"city,omitempty"`
Country string `json:"country,omitempty"`
State string `json:"state,omitempty"`
Street string `json:"street,omitempty"`
ZipCode string `json:"zipCode,omitempty"`
}
Address represents a physical address
type AudioBridge ¶
type AudioBridge struct {
// contains filtered or unexported fields
}
AudioBridge manages a browser-facing WebRTC PeerConnection and bidirectional RTP relay between the browser and a Mobius Call.
Usage:
bridge, err := calling.NewAudioBridge(nil) // Use bridge.PeerConnection() for WebRTC signaling with the browser. // Call bridge.AttachCall(call) when a Call is active. // Call bridge.Close() when done.
func NewAudioBridge ¶
func NewAudioBridge(config *AudioBridgeConfig) (*AudioBridge, error)
NewAudioBridge creates a new AudioBridge with a browser-facing PeerConnection. The PeerConnection is configured with only PCMU/PCMA codecs to match Mobius.
func (*AudioBridge) AttachCall ¶
func (ab *AudioBridge) AttachCall(call *Call)
AttachCall attaches a Call to the bridge, enabling bidirectional audio relay. Can be called before or after the call is connected — the relay goroutines will wait for the call's Mobius PC to reach connected state.
func (*AudioBridge) Close ¶
func (ab *AudioBridge) Close() error
Close stops all relay goroutines and closes the browser PeerConnection.
func (*AudioBridge) DetachCall ¶
func (ab *AudioBridge) DetachCall()
DetachCall removes the current call from the bridge.
func (*AudioBridge) GetCall ¶
func (ab *AudioBridge) GetCall() *Call
GetCall returns the currently attached call, or nil.
func (*AudioBridge) HandleSignaling ¶
func (ab *AudioBridge) HandleSignaling(transport SignalingTransport) error
HandleSignaling runs the WebRTC signaling loop over the given transport. It forwards ICE candidates to the browser, processes incoming SDP offers and ICE candidates, and blocks until the transport returns an error (e.g. connection closed). Call this from your WebSocket handler.
Example with gorilla/websocket:
bridge.HandleSignaling(&gorillaTransport{conn: wsConn})
func (*AudioBridge) LocalTrack ¶
func (ab *AudioBridge) LocalTrack() *webrtc.TrackLocalStaticRTP
LocalTrack returns the local track used to send Mobius audio to the browser.
func (*AudioBridge) OnConnectionStateChange ¶
func (ab *AudioBridge) OnConnectionStateChange(handler func(state webrtc.PeerConnectionState))
OnConnectionStateChange sets the callback for browser PC connection state changes.
func (*AudioBridge) OnICECandidate ¶
func (ab *AudioBridge) OnICECandidate(handler func(candidate *webrtc.ICECandidate))
OnICECandidate sets the callback for when an ICE candidate is gathered on the browser-facing PeerConnection.
func (*AudioBridge) PeerConnection ¶
func (ab *AudioBridge) PeerConnection() *webrtc.PeerConnection
PeerConnection returns the browser-facing PeerConnection for signaling.
type AudioBridgeConfig ¶
type AudioBridgeConfig struct {
// ICEServers for the browser-facing PeerConnection.
// Default: Google STUN server.
ICEServers []webrtc.ICEServer
}
AudioBridgeConfig holds configuration for creating an AudioBridge.
func DefaultAudioBridgeConfig ¶
func DefaultAudioBridgeConfig() *AudioBridgeConfig
DefaultAudioBridgeConfig returns an AudioBridgeConfig with sensible defaults.
type AudioTrackWriter ¶
AudioTrackWriter is an interface for writing audio samples to a track
type BusinessContinuitySetting ¶
type BusinessContinuitySetting struct {
Enabled bool `json:"enabled"`
DestinationVoicemailEnabled *bool `json:"destinationVoicemailEnabled,omitempty"`
Destination string `json:"destination,omitempty"`
}
BusinessContinuitySetting configures forwarding when the line is offline
type Call ¶
type Call struct {
// Events
Emitter *EventEmitter
// contains filtered or unexported fields
}
Call represents an active or pending call with full call control. It manages the Mobius signaling and Pion WebRTC media layer.
func NewCall ¶
func NewCall(core *webexsdk.Client, direction CallDirection, destination *CallDetails, config *CallConfig) (*Call, error)
NewCall creates a new Call instance
func (*Call) Answer ¶
Answer answers an incoming call. It sets the remote SDP offer, creates an answer, and sends it via ROAP.
func (*Call) CompleteTransfer ¶
func (c *Call) CompleteTransfer(transferType TransferType, transferCallID, transferTarget string) error
CompleteTransfer completes a call transfer (blind or consult)
func (*Call) Dial ¶
Dial initiates an outbound call. It creates a WebRTC offer, wraps it in ROAP, and POSTs to Mobius.
func (*Call) GetCorrelationID ¶
GetCorrelationID returns the correlation ID
func (*Call) GetDirection ¶
func (c *Call) GetDirection() CallDirection
GetDirection returns the call direction
func (*Call) GetDisconnectReason ¶
func (c *Call) GetDisconnectReason() DisconnectReason
GetDisconnectReason returns the disconnect reason
func (*Call) GetMedia ¶
func (c *Call) GetMedia() *MediaEngine
GetMedia returns the media engine for direct RTP access
func (*Call) HandleMobiusEvent ¶
func (c *Call) HandleMobiusEvent(event *MobiusCallEvent)
HandleMobiusEvent processes an incoming Mobius WebSocket event for this call
func (*Call) IsConnected ¶
IsConnected returns true if the call is connected
func (*Call) PostStatus ¶
PostStatus sends a call keepalive/status to Mobius
type CallConfig ¶
type CallConfig struct {
// MobiusURL is the active Mobius server URL
MobiusURL string
// DeviceID is the registered Mobius device ID
DeviceID string
// LineID is the line ID this call belongs to
LineID string
// ClientDeviceURI is the Webex device URL
ClientDeviceURI string
// MediaConfig is the WebRTC media configuration
MediaConfig *MediaConfig
}
CallConfig holds configuration for creating a call
type CallDetails ¶
CallDetails contains the destination for an outbound call
type CallDirection ¶
type CallDirection string
CallDirection indicates whether a call is inbound or outbound
const ( CallDirectionInbound CallDirection = "inbound" CallDirectionOutbound CallDirection = "outbound" )
type CallEventKey ¶
type CallEventKey string
CallEventKey identifies the type of call event
const ( CallEventAlerting CallEventKey = "alerting" CallEventProgress CallEventKey = "progress" CallEventConnect CallEventKey = "connect" CallEventEstablished CallEventKey = "established" CallEventDisconnect CallEventKey = "disconnect" CallEventHeld CallEventKey = "held" CallEventResumed CallEventKey = "resumed" CallEventRemoteMedia CallEventKey = "remote_media" CallEventCallerID CallEventKey = "caller_id" CallEventError CallEventKey = "call_error" CallEventHoldError CallEventKey = "hold_error" CallEventResumeError CallEventKey = "resume_error" CallEventTransferError CallEventKey = "transfer_error" )
type CallForwardAlwaysSetting ¶
type CallForwardAlwaysSetting struct {
Enabled bool `json:"enabled"`
RingReminderEnabled *bool `json:"ringReminderEnabled,omitempty"`
DestinationVoicemailEnabled *bool `json:"destinationVoicemailEnabled,omitempty"`
Destination string `json:"destination,omitempty"`
}
CallForwardAlwaysSetting configures always-on call forwarding
type CallForwardBusySetting ¶
type CallForwardBusySetting struct {
Enabled bool `json:"enabled"`
DestinationVoicemailEnabled *bool `json:"destinationVoicemailEnabled,omitempty"`
Destination string `json:"destination,omitempty"`
}
CallForwardBusySetting configures call forwarding when the line is busy
type CallForwardNoAnswerSetting ¶
type CallForwardNoAnswerSetting struct {
Enabled bool `json:"enabled"`
NumberOfRings *int `json:"numberOfRings,omitempty"`
SystemMaxNumberOfRings *int `json:"systemMaxNumberOfRings,omitempty"`
DestinationVoicemailEnabled *bool `json:"destinationVoicemailEnabled,omitempty"`
Destination string `json:"destination,omitempty"`
}
CallForwardNoAnswerSetting configures call forwarding when unanswered
type CallForwardSetting ¶
type CallForwardSetting struct {
CallForwarding CallForwardingConfig `json:"callForwarding"`
BusinessContinuity BusinessContinuitySetting `json:"businessContinuity"`
}
CallForwardSetting is the full call forward configuration
type CallForwardingConfig ¶
type CallForwardingConfig struct {
Always CallForwardAlwaysSetting `json:"always"`
Busy CallForwardBusySetting `json:"busy"`
NoAnswer CallForwardNoAnswerSetting `json:"noAnswer"`
}
CallForwardingConfig groups all call forwarding rules
type CallHistoryClient ¶
type CallHistoryClient struct {
// contains filtered or unexported fields
}
CallHistoryClient provides methods for retrieving and managing call history records.
func (*CallHistoryClient) DeleteCallHistoryRecords ¶
func (c *CallHistoryClient) DeleteCallHistoryRecords(deleteSessionIDs []EndTimeSessionID) (*DeleteCallHistoryResponse, error)
DeleteCallHistoryRecords deletes call history records.
Parameters:
- deleteSessionIDs: An array of EndTimeSessionID identifying the records to delete.
func (*CallHistoryClient) GetCallHistoryData ¶
func (c *CallHistoryClient) GetCallHistoryData(days, limit int, sort Sort, sortBy SortBy) (*CallHistoryResponse, error)
GetCallHistoryData retrieves call history records based on specified parameters.
Parameters:
- days: Number of days to fetch call history data for.
- limit: Maximum number of records to fetch.
- sort: Sort order (ASC or DESC).
- sortBy: Field to sort by (endTime or startTime).
func (*CallHistoryClient) UpdateMissedCalls ¶
func (c *CallHistoryClient) UpdateMissedCalls(endTimeSessionIDs []EndTimeSessionID) (*UpdateMissedCallsResponse, error)
UpdateMissedCalls updates the read state of missed calls.
Parameters:
- endTimeSessionIDs: An array of EndTimeSessionID identifying the missed call records to mark as read.
type CallHistoryResponse ¶
type CallHistoryResponse struct {
StatusCode int `json:"statusCode"`
Message string `json:"message,omitempty"`
Data struct {
UserSessions []UserSession `json:"userSessions,omitempty"`
Error string `json:"error,omitempty"`
} `json:"data"`
}
CallHistoryResponse is the response from call history APIs
type CallRecordLink ¶
type CallRecordLink struct {
LocusURL string `json:"locusUrl,omitempty"`
ConversationURL string `json:"conversationUrl,omitempty"`
CallbackAddress string `json:"callbackAddress"`
}
CallRecordLink contains URLs associated with a call record
type CallRecordOther ¶
type CallRecordOther struct {
OwnerID string `json:"ownerId,omitempty"`
ID string `json:"id"`
Name string `json:"name,omitempty"`
SipURL string `json:"sipUrl,omitempty"`
PrimaryDisplayString string `json:"primaryDisplayString,omitempty"`
SecondaryDisplayString string `json:"secondaryDisplayString,omitempty"`
IsPrivate bool `json:"isPrivate"`
CallbackAddress string `json:"callbackAddress"`
PhoneNumber string `json:"phoneNumber,omitempty"`
Contact string `json:"contact,omitempty"`
Email string `json:"email,omitempty"`
}
CallRecordOther represents the other party in a call record
type CallRecordSelf ¶
type CallRecordSelf struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
PhoneNumber string `json:"phoneNumber,omitempty"`
CucmDN string `json:"cucmDN,omitempty"`
UcmLineNumber int `json:"ucmLineNumber,omitempty"`
}
CallRecordSelf represents the user's own info in a call record
type CallSettingResponse ¶
type CallSettingResponse struct {
StatusCode int `json:"statusCode"`
Message string `json:"message,omitempty"`
Data struct {
CallSetting interface{} `json:"callSetting,omitempty"`
Error string `json:"error,omitempty"`
} `json:"data"`
}
CallSettingResponse is the generic response from call settings APIs
type CallSettingsClient ¶
type CallSettingsClient struct {
// contains filtered or unexported fields
}
CallSettingsClient provides methods for retrieving and updating call settings such as Call Waiting, Do Not Disturb, Call Forwarding, and Voicemail configuration.
func (*CallSettingsClient) GetCallForwardAlwaysSetting ¶
func (c *CallSettingsClient) GetCallForwardAlwaysSetting(directoryNumber string) (*CallSettingResponse, error)
GetCallForwardAlwaysSetting fetches the call forward always setting. The optional directoryNumber parameter is only required for CCUC backends.
func (*CallSettingsClient) GetCallForwardSetting ¶
func (c *CallSettingsClient) GetCallForwardSetting() (*CallSettingResponse, error)
GetCallForwardSetting fetches the call forwarding settings.
func (*CallSettingsClient) GetCallWaitingSetting ¶
func (c *CallSettingsClient) GetCallWaitingSetting() (*CallSettingResponse, error)
GetCallWaitingSetting fetches the call waiting setting for the authenticated user.
func (*CallSettingsClient) GetDoNotDisturbSetting ¶
func (c *CallSettingsClient) GetDoNotDisturbSetting() (*CallSettingResponse, error)
GetDoNotDisturbSetting fetches the Do Not Disturb (DND) setting.
func (*CallSettingsClient) GetVoicemailSetting ¶
func (c *CallSettingsClient) GetVoicemailSetting() (*CallSettingResponse, error)
GetVoicemailSetting fetches the voicemail settings.
func (*CallSettingsClient) SetCallForwardSetting ¶
func (c *CallSettingsClient) SetCallForwardSetting(setting CallForwardSetting) (*CallSettingResponse, error)
SetCallForwardSetting updates the call forwarding settings.
func (*CallSettingsClient) SetDoNotDisturbSetting ¶
func (c *CallSettingsClient) SetDoNotDisturbSetting(enabled bool) (*CallSettingResponse, error)
SetDoNotDisturbSetting enables or disables Do Not Disturb.
func (*CallSettingsClient) SetVoicemailSetting ¶
func (c *CallSettingsClient) SetVoicemailSetting(setting VoicemailSettingConfig) (*CallSettingResponse, error)
SetVoicemailSetting updates the voicemail settings.
type CallState ¶
type CallState string
CallState represents the state of a call in the state machine
type CallType ¶
type CallType string
CallType indicates the type of call address
func NormalizeAddress ¶
NormalizeAddress normalizes a dial address for Mobius/BroadWorks:
- SIP URIs (sip:/sips:) → passed through as-is with CallTypeURI
- tel: URIs → passed through as-is with CallTypeURI
- Phone numbers → sanitized and prefixed with "tel:" with CallTypeURI
Returns the normalized address, call type, and an error if the input is invalid. Matches the JS SDK's VALID_PHONE_REGEX /[\d\s()*#+.-]+/ behavior.
type CallerIDInfo ¶
type CallerIDInfo struct {
From string `json:"from,omitempty"`
PAssertedIdentity string `json:"p-asserted-identity,omitempty"`
XBroadworksRemotePartyInfo string `json:"x-broadworks-remote-party-info,omitempty"`
}
CallerIDInfo contains caller identification info from Mobius
type CallingClient ¶
type CallingClient struct {
// Events
Emitter *EventEmitter
// contains filtered or unexported fields
}
CallingClient is the main orchestrator for Webex Calling call control. It manages line registration with Mobius servers, call creation, and incoming call handling via Mercury WebSocket events.
func NewCallingClient ¶
func NewCallingClient(core *webexsdk.Client, config *Config, clientConfig *CallingClientConfig) *CallingClient
NewCallingClient creates a new CallingClient for managing lines and calls
func (*CallingClient) ClearAudioBridge ¶
func (cc *CallingClient) ClearAudioBridge()
ClearAudioBridge removes the AudioBridge from this CallingClient.
func (*CallingClient) ConnectMercury ¶
func (cc *CallingClient) ConnectMercury(merc *mercury.Client) error
ConnectMercury connects a Mercury WebSocket client and wires it to receive Mobius call events (ROAP answers, call progress, etc.). It uses the WDM WebSocket URL from line registration so events arrive on the correct device.
This is the idiomatic way to set up Mercury for calling — replaces the manual wildcard handler + event routing that consumers previously had to do.
func (*CallingClient) CreateLine ¶
func (cc *CallingClient) CreateLine() (*Line, error)
CreateLine creates and registers a new line with the Mobius servers. Returns the Line object which can be used to make and receive calls.
func (*CallingClient) DeregisterAllDevices ¶
func (cc *CallingClient) DeregisterAllDevices() (int, error)
DeregisterAllDevices attempts to deregister all existing Mobius devices for this user. It does this by attempting a registration POST — if a 403 errorCode 101 is returned, it extracts the existing device list and deletes each one.
func (*CallingClient) DisconnectMercury ¶
func (cc *CallingClient) DisconnectMercury()
DisconnectMercury disconnects the Mercury WebSocket client if connected.
func (*CallingClient) DiscoverMobiusServers ¶
func (cc *CallingClient) DiscoverMobiusServers() error
DiscoverMobiusServers discovers the Mobius servers for the user's region. It follows the same flow as the JS SDK:
- Register a WDM device to get clientDeviceUri and serviceHostMap (Mobius hosts)
- Get region info from the Webex region discovery service
- Query each Mobius host with region/country to get primary/backup URIs
func (*CallingClient) GetActiveCalls ¶
func (cc *CallingClient) GetActiveCalls() map[string]*Call
GetActiveCalls returns all active calls
func (*CallingClient) GetAudioBridge ¶
func (cc *CallingClient) GetAudioBridge() *AudioBridge
GetAudioBridge returns the currently registered AudioBridge, or nil.
func (*CallingClient) GetConnectedCall ¶
func (cc *CallingClient) GetConnectedCall() *Call
GetConnectedCall returns the currently connected (not held) call, if any
func (*CallingClient) GetLines ¶
func (cc *CallingClient) GetLines() map[string]*Line
GetLines returns all registered lines
func (*CallingClient) GetWDMWebSocketURL ¶
func (cc *CallingClient) GetWDMWebSocketURL() string
GetWDMWebSocketURL returns the WebSocket URL from the WDM device registration. This should be used for Mercury connections to ensure events are received on the same device used for Mobius registration.
func (*CallingClient) HandleMercuryEvent ¶
func (cc *CallingClient) HandleMercuryEvent(eventData []byte)
HandleMercuryEvent processes a Mercury WebSocket event that may contain Mobius call signaling data. This should be called when the Mercury client receives a "mobius" scoped event.
func (*CallingClient) IsMercuryConnected ¶
func (cc *CallingClient) IsMercuryConnected() bool
IsMercuryConnected returns whether the Mercury client is connected.
func (*CallingClient) MakeCall ¶
func (cc *CallingClient) MakeCall(line *Line, destination *CallDetails) (*Call, error)
MakeCall creates and dials an outbound call on the specified line
func (*CallingClient) SetAudioBridge ¶
func (cc *CallingClient) SetAudioBridge(bridge *AudioBridge)
SetAudioBridge registers an AudioBridge with this CallingClient. When set, MakeCall() will automatically attach the bridge to new calls and detach it when calls disconnect. This eliminates manual bridge↔call wiring.
func (*CallingClient) SetMobiusServers ¶
func (cc *CallingClient) SetMobiusServers(primary, backup []string)
SetMobiusServers manually sets the primary and backup Mobius server URLs
func (*CallingClient) Shutdown ¶
func (cc *CallingClient) Shutdown() error
Shutdown deregisters all lines, disconnects Mercury, and cleans up resources
type CallingClientConfig ¶
type CallingClientConfig struct {
// ClientDeviceURI is the Webex device URL (from device registration)
ClientDeviceURI string
// MediaConfig is the WebRTC media configuration
MediaConfig *MediaConfig
// DiscoveryRegion overrides the region for Mobius server discovery
DiscoveryRegion string
// DiscoveryCountry overrides the country for Mobius server discovery
DiscoveryCountry string
}
CallingClientConfig holds configuration for the CallingClient
type CallingSpecifics ¶
type CallingSpecifics struct {
RedirectionDetails RedirectionDetails `json:"redirectionDetails"`
}
CallingSpecifics contains calling-specific details for a session
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the top-level Calling client that aggregates all calling sub-clients.
func (*Client) CallHistory ¶
func (c *Client) CallHistory() *CallHistoryClient
CallHistory returns the Call History sub-client for retrieving and managing call history records.
func (*Client) CallSettings ¶
func (c *Client) CallSettings() *CallSettingsClient
CallSettings returns the Call Settings sub-client for managing DND, call waiting, call forwarding, and voicemail settings.
func (*Client) CallingClient ¶
func (c *Client) CallingClient(clientConfig *CallingClientConfig) *CallingClient
CallingClient returns the CallingClient sub-client for real-time call control (line registration, dial, answer, hold, transfer, DTMF) using Mobius signaling and Pion WebRTC for media.
func (*Client) Contacts ¶
func (c *Client) Contacts() *ContactsClient
Contacts returns the Contacts sub-client for managing contacts and contact groups.
func (*Client) Voicemail ¶
func (c *Client) Voicemail() *VoicemailClient
Voicemail returns the Voicemail sub-client for retrieving and managing voicemail messages.
type Config ¶
type Config struct {
// BaseURL overrides the default Webex API base URL (default: https://webexapis.com/v1)
BaseURL string
// RequestTimeout overrides the default HTTP request timeout
RequestTimeout time.Duration
// WDMURL is the Webex Device Management service URL used for Mobius discovery.
// Default: https://wdm-a.wbx2.com/wdm/api/v1/devices
WDMURL string
// RegionDiscoveryURL is the URL for the Webex region discovery service.
// Default: https://ds.ciscospark.com/v1/region
RegionDiscoveryURL string
}
Config holds configuration for the Calling client
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config with sensible defaults
type Contact ¶
type Contact struct {
AddressInfo *Address `json:"addressInfo,omitempty"`
AvatarURL string `json:"avatarURL,omitempty"`
AvatarURLDomain string `json:"avatarUrlDomain,omitempty"`
CompanyName string `json:"companyName,omitempty"`
ContactID string `json:"contactId"`
ContactType ContactType `json:"contactType"`
Department string `json:"department,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Emails []URIAddress `json:"emails,omitempty"`
EncryptionKeyURL string `json:"encryptionKeyUrl"`
FirstName string `json:"firstName,omitempty"`
Groups []string `json:"groups"`
KmsResourceObjectURL string `json:"kmsResourceObjectUrl,omitempty"`
LastName string `json:"lastName,omitempty"`
Manager string `json:"manager,omitempty"`
OwnerID string `json:"ownerId,omitempty"`
PhoneNumbers []PhoneNumber `json:"phoneNumbers,omitempty"`
PrimaryContactMethod string `json:"primaryContactMethod,omitempty"`
Schemas string `json:"schemas,omitempty"`
SipAddresses []URIAddress `json:"sipAddresses,omitempty"`
Resolved bool `json:"resolved"`
}
Contact represents a single contact
type ContactGroup ¶
type ContactGroup struct {
DisplayName string `json:"displayName"`
EncryptionKeyURL string `json:"encryptionKeyUrl"`
GroupID string `json:"groupId"`
GroupType GroupType `json:"groupType"`
Members []string `json:"members,omitempty"`
OwnerID string `json:"ownerId,omitempty"`
}
ContactGroup represents a contact group
type ContactResponse ¶
type ContactResponse struct {
StatusCode int `json:"statusCode"`
Message string `json:"message,omitempty"`
Data struct {
Contacts []Contact `json:"contacts,omitempty"`
Groups []ContactGroup `json:"groups,omitempty"`
Contact *Contact `json:"contact,omitempty"`
Group *ContactGroup `json:"group,omitempty"`
Error string `json:"error,omitempty"`
} `json:"data"`
}
ContactResponse is the response from contacts APIs
type ContactType ¶
type ContactType string
ContactType indicates whether a contact is custom or cloud-synced
const ( ContactTypeCustom ContactType = "CUSTOM" ContactTypeCloud ContactType = "CLOUD" )
type ContactsClient ¶
type ContactsClient struct {
// contains filtered or unexported fields
}
ContactsClient provides methods for managing contacts and contact groups.
func (*ContactsClient) CreateContact ¶
func (c *ContactsClient) CreateContact(contact Contact) (*ContactResponse, error)
CreateContact creates a new contact.
func (*ContactsClient) CreateContactGroup ¶
func (c *ContactsClient) CreateContactGroup(displayName, encryptionKeyURL string, groupType GroupType) (*ContactResponse, error)
CreateContactGroup creates a new contact group with the given display name.
Parameters:
- displayName: The name of the contact group.
- encryptionKeyURL: Optional encryption key URL.
- groupType: The type of group (NORMAL or EXTERNAL).
func (*ContactsClient) DeleteContact ¶
func (c *ContactsClient) DeleteContact(contactID string) (*ContactResponse, error)
DeleteContact deletes a contact by its contactId.
func (*ContactsClient) DeleteContactGroup ¶
func (c *ContactsClient) DeleteContactGroup(groupID string) (*ContactResponse, error)
DeleteContactGroup deletes a contact group by its groupId.
func (*ContactsClient) GetContacts ¶
func (c *ContactsClient) GetContacts() (*ContactResponse, error)
GetContacts fetches the list of contacts and contact groups for the authenticated user.
type DeleteCallHistoryResponse ¶
type DeleteCallHistoryResponse struct {
StatusCode int `json:"statusCode"`
Message string `json:"message,omitempty"`
Data struct {
DeleteStatusMessage string `json:"deleteStatusMessage,omitempty"`
Error string `json:"error,omitempty"`
} `json:"data"`
}
DeleteCallHistoryResponse is the response from deleting call history records
type DeviceType ¶
type DeviceType struct {
DeviceID string `json:"deviceId"`
URI string `json:"uri"`
Status string `json:"status"`
LastSeen string `json:"lastSeen"`
Addresses []string `json:"addresses"`
ClientDeviceURI string `json:"clientDeviceUri"`
}
DeviceType represents a registered Mobius device
type DisconnectCode ¶
type DisconnectCode int
DisconnectCode represents the reason code for a call disconnect
const ( DisconnectCodeNormal DisconnectCode = 0 DisconnectCodeBusy DisconnectCode = 115 DisconnectCodeMediaInactivity DisconnectCode = 131 )
type DisconnectReason ¶
type DisconnectReason struct {
Code DisconnectCode `json:"code"`
Cause string `json:"cause"`
}
DisconnectReason contains the code and cause for a call disconnect
type DisplayInformation ¶
type DisplayInformation struct {
AvatarSrc string `json:"avatarSrc,omitempty"`
Name string `json:"name,omitempty"`
Num string `json:"num,omitempty"`
ID string `json:"id,omitempty"`
}
DisplayInformation represents resolved caller/contact display info
type Disposition ¶
type Disposition string
Disposition indicates the outcome of a call session
const ( DispositionAnswered Disposition = "Answered" DispositionCanceled Disposition = "Canceled" DispositionInitiated Disposition = "Initiated" DispositionMissed Disposition = "MISSED" )
type EndTimeSessionID ¶
type EndTimeSessionID struct {
EndTime string `json:"endTime"`
SessionID string `json:"sessionId"`
}
EndTimeSessionID identifies a call history record by end time and session ID
type EventEmitter ¶
type EventEmitter struct {
// contains filtered or unexported fields
}
EventEmitter provides a simple event pub/sub system
func NewEventEmitter ¶
func NewEventEmitter() *EventEmitter
NewEventEmitter creates a new EventEmitter
func (*EventEmitter) Emit ¶
func (e *EventEmitter) Emit(event string, data interface{})
Emit fires an event, calling all registered handlers
func (*EventEmitter) Off ¶
func (e *EventEmitter) Off(event string)
Off removes all handlers for a specific event type
func (*EventEmitter) On ¶
func (e *EventEmitter) On(event string, handler EventHandler)
On registers an event handler for a specific event type
type EventHandler ¶
type EventHandler func(data interface{})
EventHandler is a callback function for events
type Line ¶
type Line struct {
// Line properties
LineID string
UserID string
MobiusDeviceID string
PhoneNumber string
Extension string
SipAddresses []string
Voicemail string
// Events
Emitter *EventEmitter
// contains filtered or unexported fields
}
Line represents a registered telephony line with a Mobius server. A line must be registered before calls can be made or received.
func NewLine ¶
func NewLine(core *webexsdk.Client, config *Config, lineConfig *LineConfig) *Line
NewLine creates a new Line instance
func (*Line) Deregister ¶
Deregister deregisters this line from the Mobius server
func (*Line) GetActiveMobiusURL ¶
GetActiveMobiusURL returns the active Mobius server URL
func (*Line) GetDeviceID ¶
GetDeviceID returns the Mobius device ID
func (*Line) GetDeviceInfo ¶
func (l *Line) GetDeviceInfo() *MobiusDeviceInfo
GetDeviceInfo returns the device info from Mobius registration
func (*Line) GetStatus ¶
func (l *Line) GetStatus() RegistrationStatus
GetStatus returns the current registration status
func (*Line) IsRegistered ¶
IsRegistered returns true if the line is currently registered
type LineConfig ¶
type LineConfig struct {
// PrimaryMobiusURLs is the list of primary Mobius server URLs
PrimaryMobiusURLs []string
// BackupMobiusURLs is the list of backup Mobius server URLs
BackupMobiusURLs []string
// ClientDeviceURI is the Webex device URL for this client
ClientDeviceURI string
// UserID is the Webex user ID (from device registration)
UserID string
}
LineConfig holds configuration for creating a line
type LineEventKey ¶
type LineEventKey string
LineEventKey identifies the type of line event
const ( LineEventConnecting LineEventKey = "connecting" LineEventRegistered LineEventKey = "registered" LineEventUnregistered LineEventKey = "unregistered" LineEventReconnecting LineEventKey = "reconnecting" LineEventReconnected LineEventKey = "reconnected" LineEventIncomingCall LineEventKey = "incoming_call" LineEventError LineEventKey = "error" )
type MediaConfig ¶
type MediaConfig struct {
// ICEServers is the list of ICE servers (STUN/TURN) to use
ICEServers []webrtc.ICEServer
// AudioCodecs is the list of audio codecs to use (default: opus, PCMU, PCMA)
AudioCodecs []string
}
MediaConfig holds configuration for the media engine
func DefaultMediaConfig ¶
func DefaultMediaConfig() *MediaConfig
DefaultMediaConfig returns a MediaConfig with sensible defaults. STUN is required because the Go server is typically behind NAT and BroadWorks (ice-lite) needs a public srflx candidate to reach us. The JS SDK uses iceServers:[] because the browser handles NAT traversal via ICE connectivity checks, but Pion needs an explicit public candidate.
type MediaEngine ¶
type MediaEngine struct {
// contains filtered or unexported fields
}
MediaEngine manages the WebRTC peer connection and media tracks for a call.
func NewMediaEngine ¶
func NewMediaEngine(config *MediaConfig) (*MediaEngine, error)
NewMediaEngine creates a new WebRTC media engine for a call
func (*MediaEngine) AddAudioTrack ¶
func (me *MediaEngine) AddAudioTrack() (*webrtc.TrackLocalStaticRTP, error)
AddAudioTrack adds a local audio track to the peer connection. Uses PCMU codec since BroadWorks/Mobius consistently selects it.
func (*MediaEngine) Close ¶
func (me *MediaEngine) Close() error
Close closes the peer connection and releases resources
func (*MediaEngine) ConnectedCh ¶
func (me *MediaEngine) ConnectedCh() <-chan struct{}
ConnectedCh returns a channel that is closed when the Mobius PC reaches connected state.
func (*MediaEngine) CreateAnswer ¶
func (me *MediaEngine) CreateAnswer() (string, error)
CreateAnswer creates an SDP answer for the peer connection
func (*MediaEngine) CreateOffer ¶
func (me *MediaEngine) CreateOffer() (string, error)
CreateOffer creates an SDP offer for the peer connection
func (*MediaEngine) GetConnectionState ¶
func (me *MediaEngine) GetConnectionState() webrtc.PeerConnectionState
GetConnectionState returns the current peer connection state
func (*MediaEngine) GetLocalTrack ¶
func (me *MediaEngine) GetLocalTrack() *webrtc.TrackLocalStaticRTP
GetLocalTrack returns the local audio track
func (*MediaEngine) GetPeerConnection ¶
func (me *MediaEngine) GetPeerConnection() *webrtc.PeerConnection
GetPeerConnection returns the underlying Pion PeerConnection for advanced use (e.g. RTP relay)
func (*MediaEngine) GetRemoteTrack ¶
func (me *MediaEngine) GetRemoteTrack() *webrtc.TrackRemote
GetRemoteTrack returns the remote audio track
func (*MediaEngine) IsConnected ¶
func (me *MediaEngine) IsConnected() bool
IsConnected returns true if the Mobius PeerConnection is in the connected state.
func (*MediaEngine) IsMuted ¶
func (me *MediaEngine) IsMuted() bool
IsMuted returns whether the local audio is muted
func (*MediaEngine) OnICECandidate ¶
func (me *MediaEngine) OnICECandidate(handler func(candidate *webrtc.ICECandidate))
OnICECandidate sets the callback for when an ICE candidate is gathered
func (*MediaEngine) OnRemoteTrack ¶
func (me *MediaEngine) OnRemoteTrack(handler func(track *webrtc.TrackRemote))
OnRemoteTrack sets the callback for when a remote audio track is received
func (*MediaEngine) SetRemoteAnswer ¶
func (me *MediaEngine) SetRemoteAnswer(sdp string) error
SetRemoteAnswer sets the remote SDP answer on the peer connection. If the PC is already in stable state (answer already applied), this is a no-op.
func (*MediaEngine) SetRemoteOffer ¶
func (me *MediaEngine) SetRemoteOffer(sdp string) error
SetRemoteOffer sets the remote SDP offer on the peer connection
type MidCallEvent ¶
type MidCallEvent struct {
EventType string `json:"eventType"`
EventData interface{} `json:"eventData"`
}
MidCallEvent represents a mid-call event (e.g., hold state change)
type MobiusCallData ¶
type MobiusCallData struct {
CallProgressData *struct {
Alerting bool `json:"alerting"`
InbandMedia bool `json:"inbandMedia"`
} `json:"callProgressData,omitempty"`
Message *RoapMessage `json:"message,omitempty"`
CallerID *CallerIDInfo `json:"callerId,omitempty"`
MidCallService []MidCallEvent `json:"midCallService,omitempty"`
CallID string `json:"callId"`
CallURL string `json:"callUrl"`
DeviceID string `json:"deviceId"`
CorrelationID string `json:"correlationId"`
EventType MobiusEventType `json:"eventType"`
}
MobiusCallData represents the data payload in a Mobius call event
type MobiusCallEvent ¶
type MobiusCallEvent struct {
ID string `json:"id"`
Data MobiusCallData `json:"data"`
Timestamp int64 `json:"timestamp"`
TrackingID string `json:"trackingId"`
}
MobiusCallEvent is a full Mobius WebSocket event for calls
type MobiusCallResponse ¶
type MobiusCallResponse struct {
StatusCode int `json:"statusCode"`
Body struct {
Device struct {
DeviceID string `json:"deviceId"`
CorrelationID string `json:"correlationId"`
} `json:"device"`
CallID string `json:"callId"`
CallData *struct {
CallState string `json:"callState"`
} `json:"callData,omitempty"`
LocalMedia *struct {
Roap *RoapMessage `json:"roap,omitempty"`
} `json:"localMedia,omitempty"`
} `json:"body"`
}
MobiusCallResponse is the response from Mobius when creating a call
type MobiusDeviceInfo ¶
type MobiusDeviceInfo struct {
UserID string `json:"userId,omitempty"`
Device *DeviceType `json:"device,omitempty"`
KeepaliveInterval int `json:"keepaliveInterval,omitempty"`
CallKeepaliveInterval int `json:"callKeepaliveInterval,omitempty"`
VoicePortalNumber int `json:"voicePortalNumber,omitempty"`
VoicePortalExtension int `json:"voicePortalExtension,omitempty"`
RehomingIntervalMin int `json:"rehomingIntervalMin,omitempty"`
RehomingIntervalMax int `json:"rehomingIntervalMax,omitempty"`
}
MobiusDeviceInfo represents device info returned from Mobius registration
type MobiusEventType ¶
type MobiusEventType string
MobiusEventType identifies the type of Mobius WebSocket event
const ( MobiusEventCallSetup MobiusEventType = "mobius.call" MobiusEventCallProgress MobiusEventType = "mobius.callprogress" MobiusEventCallConnected MobiusEventType = "mobius.callconnected" MobiusEventCallMedia MobiusEventType = "mobius.media" MobiusEventCallDisconnected MobiusEventType = "mobius.calldisconnected" )
type PersonInfo ¶
type PersonInfo struct {
ID string `json:"id"`
Emails []string `json:"emails"`
PhoneNumbers []PhoneNumber `json:"phoneNumbers"`
DisplayName string `json:"displayName"`
NickName string `json:"nickName"`
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
Avatar string `json:"avatar"`
OrgID string `json:"orgId"`
Created string `json:"created"`
LastModified string `json:"lastModified"`
LastActivity string `json:"lastActivity"`
Status string `json:"status"`
Type string `json:"type"`
}
PersonInfo represents a Webex person
type PhoneNumber ¶
type PhoneNumber struct {
Type string `json:"type"`
Value string `json:"value"`
Primary *bool `json:"primary,omitempty"`
}
PhoneNumber represents a phone number with type and primary flag
type RedirectionDetails ¶
type RedirectionDetails struct {
PhoneNumber string `json:"phoneNumber,omitempty"`
SipURL string `json:"sipUrl,omitempty"`
Name string `json:"name,omitempty"`
Reason string `json:"reason"`
UserID string `json:"userId,omitempty"`
IsPrivate bool `json:"isPrivate"`
}
RedirectionDetails contains call redirection info
type RegistrationStatus ¶
type RegistrationStatus string
RegistrationStatus represents the registration state of a line
const ( RegistrationStatusIdle RegistrationStatus = "IDLE" RegistrationStatusActive RegistrationStatus = "active" RegistrationStatusInactive RegistrationStatus = "inactive" )
type RoapMessage ¶
type RoapMessage struct {
Seq int `json:"seq"`
MessageType RoapMessageType `json:"messageType"`
SDP string `json:"sdp,omitempty"`
OffererSessionID string `json:"offererSessionId,omitempty"`
AnswererSessionID string `json:"answererSessionId,omitempty"`
Version string `json:"version,omitempty"`
TieBreaker string `json:"tieBreaker,omitempty"`
ErrorType string `json:"errorType,omitempty"`
}
RoapMessage represents a ROAP signaling message exchanged with Mobius
func SDPToRoapAnswer ¶
func SDPToRoapAnswer(sdp string, seq int) *RoapMessage
SDPToRoapAnswer wraps an SDP string into a ROAP ANSWER message
func SDPToRoapOffer ¶
func SDPToRoapOffer(sdp string, seq int) *RoapMessage
SDPToRoapOffer wraps an SDP string into a ROAP OFFER message
type RoapMessageType ¶
type RoapMessageType string
RoapMessageType identifies the type of ROAP message
const ( RoapMessageOffer RoapMessageType = "OFFER" RoapMessageAnswer RoapMessageType = "ANSWER" RoapMessageOK RoapMessageType = "OK" RoapMessageError RoapMessageType = "ERROR" RoapMessageOfferRequest RoapMessageType = "OFFER_REQUEST" )
type SessionType ¶
type SessionType string
SessionType indicates the type of call session
const ( SessionTypeSpark SessionType = "SPARK" SessionTypeWebexCalling SessionType = "WEBEXCALLING" )
type SignalingMessage ¶
type SignalingMessage struct {
Type string `json:"type"`
SDP string `json:"sdp,omitempty"`
Candidate json.RawMessage `json:"candidate,omitempty"`
}
SignalingMessage is the JSON structure exchanged between the AudioBridge and the browser for WebRTC signaling.
type SignalingTransport ¶
type SignalingTransport interface {
// ReadMessage blocks until a signaling message arrives from the browser.
// Returns the raw JSON bytes or an error (e.g. connection closed).
ReadMessage() ([]byte, error)
// WriteMessage sends a signaling message to the browser.
WriteMessage(data []byte) error
}
SignalingTransport is a transport-agnostic interface for exchanging WebRTC signaling messages (SDP offers/answers, ICE candidates) with a browser. Implement this over WebSocket, gRPC, HTTP polling, etc.
type ToggleSetting ¶
type ToggleSetting struct {
Enabled bool `json:"enabled"`
RingSplashEnabled *bool `json:"ringSplashEnabled,omitempty"`
}
ToggleSetting represents a simple on/off setting with optional ring splash
type TransferType ¶
type TransferType string
TransferType indicates the type of call transfer
const ( TransferTypeBlind TransferType = "BLIND" TransferTypeConsult TransferType = "CONSULT" )
type URIAddress ¶
type URIAddress struct {
Value string `json:"value"`
Type string `json:"type"`
Primary *bool `json:"primary,omitempty"`
}
URIAddress represents a URI-based address (email, SIP, etc.)
type UpdateMissedCallsResponse ¶
type UpdateMissedCallsResponse struct {
StatusCode int `json:"statusCode"`
Message string `json:"message,omitempty"`
Data struct {
ReadStatusMessage string `json:"readStatusMessage,omitempty"`
Error string `json:"error,omitempty"`
} `json:"data"`
}
UpdateMissedCallsResponse is the response from updating missed calls
type UserSession ¶
type UserSession struct {
ID string `json:"id"`
SessionID string `json:"sessionId"`
Disposition Disposition `json:"disposition"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
URL string `json:"url"`
DurationSeconds int `json:"durationSeconds"`
JoinedDurationSeconds int `json:"joinedDurationSeconds"`
ParticipantCount int `json:"participantCount"`
IsDeleted bool `json:"isDeleted"`
IsPMR bool `json:"isPMR"`
CorrelationIDs []string `json:"correlationIds"`
Links CallRecordLink `json:"links"`
Self CallRecordSelf `json:"self"`
DurationSecs int `json:"durationSecs"`
Other CallRecordOther `json:"other"`
SessionType SessionType `json:"sessionType"`
Direction string `json:"direction"`
CallingSpecifics *CallingSpecifics `json:"callingSpecifics,omitempty"`
}
UserSession represents a single call history record
type VoicemailCallingPartyInfo ¶
type VoicemailCallingPartyInfo struct {
Name string `json:"name"`
UserID string `json:"userId,omitempty"`
Address string `json:"address"`
UserExternalID string `json:"userExternalId,omitempty"`
}
VoicemailCallingPartyInfo represents the caller info for a voicemail
type VoicemailClient ¶
type VoicemailClient struct {
// contains filtered or unexported fields
}
VoicemailClient provides methods for retrieving and managing voicemail messages.
func (*VoicemailClient) Delete ¶
func (c *VoicemailClient) Delete(messageID string) (*VoicemailResponse, error)
Delete deletes a voicemail message by its messageId.
func (*VoicemailClient) GetTranscript ¶
func (c *VoicemailClient) GetTranscript(messageID string) (*VoicemailResponse, error)
GetTranscript retrieves the transcript of a voicemail message.
func (*VoicemailClient) GetVoicemailContent ¶
func (c *VoicemailClient) GetVoicemailContent(messageID string) (*VoicemailResponse, error)
GetVoicemailContent retrieves the content of a voicemail message by its messageId.
func (*VoicemailClient) GetVoicemailList ¶
func (c *VoicemailClient) GetVoicemailList(offset, offsetLimit int, sort Sort) (*VoicemailResponse, error)
GetVoicemailList retrieves a list of voicemails with pagination and sorting.
Parameters:
- offset: Number of records to skip.
- offsetLimit: Maximum number of voicemails to retrieve.
- sort: Sort order (ASC or DESC).
func (*VoicemailClient) GetVoicemailSummary ¶
func (c *VoicemailClient) GetVoicemailSummary() (*VoicemailResponse, error)
GetVoicemailSummary retrieves a quantitative summary of voicemails for the user.
func (*VoicemailClient) MarkAsRead ¶
func (c *VoicemailClient) MarkAsRead(messageID string) (*VoicemailResponse, error)
MarkAsRead marks a voicemail message as read.
func (*VoicemailClient) MarkAsUnread ¶
func (c *VoicemailClient) MarkAsUnread(messageID string) (*VoicemailResponse, error)
MarkAsUnread marks a voicemail message as unread.
type VoicemailContent ¶
VoicemailContent represents the content of a voicemail
type VoicemailMessage ¶
type VoicemailMessage struct {
MessageID string `json:"messageId"`
Duration string `json:"duration"`
CallingPartyInfo VoicemailCallingPartyInfo `json:"callingPartyInfo"`
Time int64 `json:"time"`
Read bool `json:"read"`
}
VoicemailMessage represents a single voicemail message
type VoicemailResponse ¶
type VoicemailResponse struct {
StatusCode int `json:"statusCode"`
Message string `json:"message,omitempty"`
Data struct {
VoicemailList []VoicemailMessage `json:"voicemailList,omitempty"`
VoicemailContent *VoicemailContent `json:"voicemailContent,omitempty"`
VoicemailSummary *VoicemailSummary `json:"voicemailSummary,omitempty"`
VoicemailTranscript *string `json:"voicemailTranscript,omitempty"`
Error string `json:"error,omitempty"`
} `json:"data"`
}
VoicemailResponse is the response from voicemail APIs
type VoicemailSettingConfig ¶
type VoicemailSettingConfig struct {
Enabled bool `json:"enabled"`
SendAllCalls *struct {
Enabled bool `json:"enabled"`
} `json:"sendAllCalls,omitempty"`
SendBusyCalls struct {
Enabled bool `json:"enabled"`
Greeting string `json:"greeting,omitempty"`
GreetingUploaded *bool `json:"greetingUploaded,omitempty"`
} `json:"sendBusyCalls"`
SendUnansweredCalls struct {
Enabled bool `json:"enabled"`
Greeting string `json:"greeting,omitempty"`
GreetingUploaded *bool `json:"greetingUploaded,omitempty"`
NumberOfRings int `json:"numberOfRings"`
SystemMaxNumberOfRings *int `json:"systemMaxNumberOfRings,omitempty"`
} `json:"sendUnansweredCalls"`
Notifications struct {
Enabled bool `json:"enabled"`
Destination string `json:"destination,omitempty"`
} `json:"notifications"`
TransferToNumber *struct {
Enabled bool `json:"enabled"`
Destination string `json:"destination"`
} `json:"transferToNumber,omitempty"`
EmailCopyOfMessage struct {
Enabled bool `json:"enabled"`
EmailID string `json:"emailId,omitempty"`
} `json:"emailCopyOfMessage"`
MessageStorage struct {
MWIEnabled bool `json:"mwiEnabled"`
StorageType string `json:"storageType"`
ExternalEmail string `json:"externalEmail,omitempty"`
} `json:"messageStorage"`
FaxMessage *struct {
Enabled bool `json:"enabled"`
PhoneNumber string `json:"phoneNumber,omitempty"`
Extension string `json:"extension,omitempty"`
} `json:"faxMessage,omitempty"`
VoiceMessageForwardingEnabled *bool `json:"voiceMessageForwardingEnabled,omitempty"`
}
VoicemailSettingConfig is the full voicemail configuration