Documentation
¶
Overview ¶
Package rtpengine provides functionality for interacting with an RTP engine proxy, including connection management, command encoding/decoding, and parameter structures for RTP session control.
It defines types for requests and responses, as well as various parameter structs for configuring RTP engine operations. The package supports both TCP and UDP connections and uses bencode for message serialization.
Main types and functions:
- Engine: Manages connection and configuration to the RTP engine proxy.
- RequestRtp, ResponseRtp: Structures for command requests and responses.
- ParamsOptString, ParamsOptInt, ParamsOptStringArray: Parameter structs for RTP operations.
- Conn, ConnUDP: Methods to open TCP/UDP connections to the RTP engine.
- EncodeComando: Encodes a command request with a cookie using bencode.
- DecodeResposta: Decodes a response from the RTP engine, validating the cookie.
The package relies on external libraries for bencode serialization, UUID generation, structured logging, and mapstructure decoding.
Index ¶
- func EncodeComando(cookie string, command *RequestRtp) ([]byte, error)
- type AddressFamily
- type Client
- type ClientOption
- type Codecs
- type Connection
- type CryptoSuite
- type DTLS
- type DTLSFingerprint
- type DTLSReverse
- type DtlsHash
- type Engine
- type ICE
- type OSRTP
- type ParamFlags
- type ParamMoh
- type ParamRTCPMux
- type ParamReplace
- type ParametrosOption
- type ParamsOptInt
- type ParamsOptString
- type ParamsOptStringArray
- type ParamsSdpAttrCommands
- type ParamsSdpAttrSections
- type Record
- type RequestRtp
- func (c *RequestRtp) DeleteSDES(cript []CryptoSuite) ParametrosOption
- func (c *RequestRtp) DisablesSDES() ParametrosOption
- func (c *RequestRtp) EnableSDES(cript []CryptoSuite) ParametrosOption
- func (c *RequestRtp) ICEForce() ParametrosOption
- func (c *RequestRtp) ICERemove() ParametrosOption
- func (c *RequestRtp) RecordNo() ParametrosOption
- func (c *RequestRtp) RecordOff() ParametrosOption
- func (c *RequestRtp) RecordOn() ParametrosOption
- func (c *RequestRtp) RecordYes() ParametrosOption
- func (c *RequestRtp) SetAttrChange(sdpAttr *ParamsSdpAttrSections) ParametrosOption
- func (c *RequestRtp) SetCodecEncoder(codecs []Codecs) ParametrosOption
- func (c *RequestRtp) SetCodecExcept(codecs []Codecs) ParametrosOption
- func (c *RequestRtp) SetCodecMask(codecs []Codecs) ParametrosOption
- func (c *RequestRtp) SetCodecStrip(codecs []Codecs) ParametrosOption
- func (c *RequestRtp) SetFlags(flags []ParamFlags) ParametrosOption
- func (c *RequestRtp) SetMediaAddress(Address string) ParametrosOption
- func (c *RequestRtp) SetMohFile(file string) ParametrosOption
- func (c *RequestRtp) SetPtimeCodecAnswer(ptime int) ParametrosOption
- func (c *RequestRtp) SetPtimeCodecOffer(ptime int) ParametrosOption
- func (c *RequestRtp) SetReceivedFrom(addressFamily AddressFamily, Address string) ParametrosOption
- func (c *RequestRtp) SetReplace(replace []ParamReplace) ParametrosOption
- func (c *RequestRtp) SetRtcpMux(rtcpmux []ParamRTCPMux) ParametrosOption
- func (c *RequestRtp) SetTransportProtocol(proto TransportProtocol) ParametrosOption
- func (c *RequestRtp) SetViaBranchTag(branch string) ParametrosOption
- type ResponseRtp
- type SDES
- type TotalRTP
- type TransportProtocol
- type TypeCommands
- type ValuesRTP
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeComando ¶
func EncodeComando(cookie string, command *RequestRtp) ([]byte, error)
EncodeComando encodes a command into bencode format and prepends the cookie. This function marshals the RequestRtp struct into bencode and combines it with the cookie.
Parameters:
cookie - a string used for identifying the request. command - a pointer to the RequestRtp struct containing the command data.
Returns:
[]byte - the encoded command with the cookie. error - an error if encoding fails.
Types ¶
type AddressFamily ¶
type AddressFamily string
AddressFamily defines the IP address families supported for RTP engine operations. These values specify whether IPv4 or IPv6 is used for media and signaling transport.
const ( // AddressFamilyIP4 represents the IPv4 address family. AddressFamilyIP4 AddressFamily = "IP4" // AddressFamilyIP6 represents the IPv6 address family. AddressFamilyIP6 AddressFamily = "IP6" )
type Client ¶
type Client struct {
*Engine // Embedded Engine instance providing core functionalities.
// contains filtered or unexported fields
}
Client represents a network client that interacts with an underlying Engine. It encapsulates connection details, logging capabilities, and timeout configurations.
func NewClient ¶
func NewClient(rtpengine *Engine, options ...ClientOption) (*Client, error)
NewClient creates and initializes a new Client instance using the provided Engine and optional configuration functions. It sets default values for the URL, port, logger, and timeout, and applies any additional ClientOption functions. It also establishes a connection based on the protocol defined in the Engine.
Parameters:
- rtpengine: Pointer to an Engine instance used by the Client.
- options: Variadic list of ClientOption functions for custom configuration.
Returns:
- *Client: A pointer to the initialized Client instance.
- error: An error if any configuration or connection step fails.
func (*Client) Close ¶
Close terminates the active connection held by the Client. If a UDP connection is active, it closes that connection. Otherwise, it closes the standard connection.
Returns:
- error: Any error encountered while closing the connection.
func (*Client) ComandoNG ¶
func (c *Client) ComandoNG(cookie string, comando *RequestRtp) error
ComandoNG sends a command to the RTP engine formatted in bencode. It encodes the command along with a unique cookie, logs the operation, and writes the message to the appropriate connection (UDP or TCP).
Parameters:
- cookie: A unique identifier used to correlate the command and its response.
- comando: A pointer to a RequestRtp struct containing the command details.
Returns:
- error: An error if encoding fails or if the message cannot be sent over the network.
func (*Client) NewComando ¶
func (c *Client) NewComando(comando *RequestRtp) *ResponseRtp
NewComando sends a command to the RTP engine and retrieves the corresponding response. It generates a unique cookie, sends the command using ComandoNG, and then attempts to read the response using RespostaNG.
Parameters:
- comando: A pointer to a RequestRtp struct containing the command to be sent.
Returns:
- *ResponseRtp: A pointer to the response received from the RTP engine. If an error occurs during command execution or response retrieval, an empty ResponseRtp instance is returned.
func (*Client) RespostaNG ¶
func (c *Client) RespostaNG(cookie string) (*ResponseRtp, error)
RespostaNG receives and decodes the response from the ngcp-rtpengine server. It reads raw data from the active connection (UDP or TCP), waits briefly to ensure the response is ready, and then decodes the response using the provided cookie.
Parameters:
- cookie: A unique identifier used to match the response with the original command.
Returns:
- *ResponseRtp: A pointer to the decoded response object.
- error: An error if reading from the connection fails.
func (*Client) SetLogLevel ¶ added in v0.2.1
SetLogLevel updates the logging level of the Client's logger. This method allows dynamic adjustment of the verbosity of log output based on the provided level.
Parameters:
- level: An int8 value representing the desired logging level. Valid levels are defined by zerolog.Level (e.g., DebugLevel, InfoLevel, WarnLevel, ErrorLevel).
type ClientOption ¶
ClientOption defines a function type that modifies a Client instance. It allows for flexible configuration of the Client during initialization. Each option function receives a pointer to the Client and returns an error if the configuration fails.
func WithClientDns ¶
func WithClientDns(dns string) ClientOption
WithClientDns sets the DNS resolver for the RTP engine service and resolves its IP address. It returns a ClientOption function that configures a custom DNS resolver using Google's public DNS (8.8.8.8), performs an IPv4 lookup for the specified domain, and updates the Client's URL with the resolved IP.
Parameters:
- dns: The domain name of the RTP engine service to resolve.
Returns:
- ClientOption: A function that applies the DNS resolution and updates the Client's URL.
func WithClientHostname ¶
func WithClientHostname(hostname string) ClientOption
WithClientHostname sets the default hostname for the Client and resolves its IPv4 address. It returns a ClientOption function that updates the Client's IP field based on the resolved address.
Parameters:
- hostname: The hostname to resolve (e.g., "localhost", "example.com").
Returns:
- ClientOption: A function that applies the hostname resolution to the Client.
func WithClientIP ¶
func WithClientIP(host string) ClientOption
WithClientIP sets the default IP address for the Client. It returns a ClientOption function that parses the provided IP string and assigns it to the Client's IP field.
Parameters:
- host: A string representing the IP address to be used.
Returns:
- ClientOption: A function that applies the IP configuration to the Client.
func WithClientPort ¶
func WithClientPort(port int) ClientOption
WithClientPort allows setting a custom default port for the Client. It returns a ClientOption function that updates both the Client's port and the associated Engine's port.
Parameters:
- port: The port number to be set.
Returns:
- ClientOption: A function that applies the port configuration to the Client.
func WithClientProto ¶
func WithClientProto(proto string) ClientOption
WithClientProto sets the default protocol for the Client. It returns a ClientOption function that assigns the specified protocol string to the Client's proto field.
Parameters:
- proto: A string representing the desired protocol (e.g., "udp", "tcp").
Returns:
- ClientOption: A function that applies the protocol configuration to the Client.
func WithClientTimeout ¶ added in v0.2.0
func WithClientTimeout(t int) ClientOption
WithClientTimeout sets the connection timeout duration for the Client. It returns a ClientOption function that converts the provided integer value into a time.Duration and assigns it to the Client's timeout field.
Parameters:
- t: Timeout value in milliseconds.
Returns:
- ClientOption: A function that applies the timeout configuration to the Client.
type Codecs ¶
type Codecs string
Codecs defines the supported audio codecs for RTP media sessions. These codecs determine the format and compression used for audio transmission.
const ( // CODEC_PCMU represents the G.711 µ-law codec, commonly used in North America and Japan. CODEC_PCMU Codecs = "PCMU" // CODEC_PCMA represents the G.711 A-law codec, commonly used in Europe and international systems. CODEC_PCMA Codecs = "PCMA" // CODEC_G729 represents the G.729 codec, a low-bitrate codec suitable for VoIP applications. CODEC_G729 Codecs = "G729" // CODEC_G729a represents the G.729a codec, a variant of G.729 with reduced complexity. CODEC_G729a Codecs = "G729a" // CODEC_OPUS represents the Opus codec, a versatile and high-quality codec for both voice and audio. CODEC_OPUS Codecs = "opus" // CODEC_G722 represents the G.722 codec, offering wideband audio quality. CODEC_G722 Codecs = "G722" // CODEC_G723 represents the G.723 codec, used for low-bitrate voice compression. CODEC_G723 Codecs = "G723" // CODEC_ILBC represents the iLBC (Internet Low Bitrate Codec), designed for robust voice transmission over IP. CODEC_ILBC Codecs = "iLBC" // CODEC_SPEEX represents the Speex codec, an open-source codec optimized for speech. CODEC_SPEEX Codecs = "speex" )
type Connection ¶ added in v0.1.8
type Connection string
Connection defines the types of media connection behaviors used in RTP engine operations.
const ( // MohConnection represents a "zero" connection, typically used for Music on Hold (MOH) scenarios. // This setting may indicate that the media stream should be silenced or replaced with a placeholder, // such as music, during call hold states. MohConnection Connection = "zero" )
type CryptoSuite ¶
type CryptoSuite string
CryptoSuite defines the supported SRTP (Secure Real-time Transport Protocol) cryptographic suites. These suites specify the encryption and authentication algorithms used to secure RTP media streams.
const ( // SRTP_AEAD_AES_256_GCM uses AES-256 in Galois/Counter Mode (GCM) for encryption and authentication. SRTP_AEAD_AES_256_GCM CryptoSuite = "AEAD_AES_256_GCM" // SRTP_AEAD_AES_128_GCM uses AES-128 in Galois/Counter Mode (GCM) for encryption and authentication. SRTP_AEAD_AES_128_GCM CryptoSuite = "AEAD_AES_128_GCM" // SRTP_AES_256_CM_HMAC_SHA1_80 uses AES-256 in Counter Mode (CM) with HMAC-SHA1 authentication (80-bit). SRTP_AES_256_CM_HMAC_SHA1_80 CryptoSuite = "AES_256_CM_HMAC_SHA1_80" // SRTP_AES_256_CM_HMAC_SHA1_32 uses AES-256 in Counter Mode (CM) with HMAC-SHA1 authentication (32-bit). SRTP_AES_256_CM_HMAC_SHA1_32 CryptoSuite = "AES_256_CM_HMAC_SHA1_32" // SRTP_AES_192_CM_HMAC_SHA1_80 uses AES-192 in Counter Mode (CM) with HMAC-SHA1 authentication (80-bit). SRTP_AES_192_CM_HMAC_SHA1_80 CryptoSuite = "AES_192_CM_HMAC_SHA1_80" // SRTP_AES_192_CM_HMAC_SHA1_32 uses AES-192 in Counter Mode (CM) with HMAC-SHA1 authentication (32-bit). SRTP_AES_192_CM_HMAC_SHA1_32 CryptoSuite = "AES_192_CM_HMAC_SHA1_32" // SRTP_AES_CM_128_HMAC_SHA1_80 uses AES-128 in Counter Mode (CM) with HMAC-SHA1 authentication (80-bit). SRTP_AES_CM_128_HMAC_SHA1_80 CryptoSuite = "AES_CM_128_HMAC_SHA1_80" // SRTP_AAES_CM_128_HMAC_SHA1_32 uses AES-128 in Counter Mode (CM) with HMAC-SHA1 authentication (32-bit). SRTP_AAES_CM_128_HMAC_SHA1_32 CryptoSuite = "AES_CM_128_HMAC_SHA1_32" // SRTP_F8_128_HMAC_SHA1_80 uses AES-128 in F8 Mode with HMAC-SHA1 authentication (80-bit). SRTP_F8_128_HMAC_SHA1_80 CryptoSuite = "F8_128_HMAC_SHA1_80" // SRTP_F8_128_HMAC_SHA1_32 uses AES-128 in F8 Mode with HMAC-SHA1 authentication (32-bit). SRTP_F8_128_HMAC_SHA1_32 CryptoSuite = "F8_128_HMAC_SHA1_32" // SRTP_NULL_HMAC_SHA1_80 uses no encryption and HMAC-SHA1 authentication (80-bit). SRTP_NULL_HMAC_SHA1_80 CryptoSuite = "NULL_HMAC_SHA1_80" // SRTP_NULL_HMAC_SHA1_32 uses no encryption and HMAC-SHA1 authentication (32-bit). SRTP_NULL_HMAC_SHA1_32 CryptoSuite = "NULL_HMAC_SHA1_32" )
type DTLS ¶
type DTLS string
DTLS defines the available modes for handling DTLS (Datagram Transport Layer Security) in RTP engine operations. DTLS is used to secure media streams, especially in WebRTC communications.
const ( // DTLSOff disables DTLS entirely. DTLSOff DTLS = "off" // DTLSNo indicates that DTLS is not used for the session. DTLSNo DTLS = "no" // DTLSDisable disables DTLS negotiation and processing. DTLSDisable DTLS = "disable" // DTLSPassive sets DTLS to passive mode, waiting for the remote peer to initiate the handshake. DTLSPassive DTLS = "passive" // DTLSActive sets DTLS to active mode, initiating the handshake with the remote peer. DTLSActive DTLS = "active" )
type DTLSFingerprint ¶
type DTLSFingerprint string
DTLSFingerprint defines the supported hash algorithms used for DTLS (Datagram Transport Layer Security) fingerprinting. DTLS fingerprints are used to verify the identity of peers during secure media session establishment.
const ( // DTLSFingerprintSha256 uses the SHA-256 hash algorithm for DTLS fingerprinting. DTLSFingerprintSha256 DTLSFingerprint = "sha-256" // DTLSFingerprintSha1 uses the SHA-1 hash algorithm for DTLS fingerprinting. DTLSFingerprintSha1 DTLSFingerprint = "sha-1" // DTLSFingerprintSha224 uses the SHA-224 hash algorithm for DTLS fingerprinting. DTLSFingerprintSha224 DTLSFingerprint = "sha-224" // DTLSFingerprintSha384 uses the SHA-384 hash algorithm for DTLS fingerprinting. DTLSFingerprintSha384 DTLSFingerprint = "sha-384" // DTLSFingerprintSha512 uses the SHA-512 hash algorithm for DTLS fingerprinting. DTLSFingerprintSha512 DTLSFingerprint = "sha-512" )
type DTLSReverse ¶
type DTLSReverse string
DTLSReverse defines the reverse DTLS roles used in RTP engine operations. These roles are used to determine how DTLS handshakes are initiated or responded to when reversing the media direction or endpoint roles.
const ( // DTLSReversePassive sets the reversed DTLS role to passive, waiting for the remote peer to initiate the handshake. DTLSReversePassive DTLSReverse = "passive" // DTLSReverseActive sets the reversed DTLS role to active, initiating the handshake with the remote peer. DTLSReverseActive DTLSReverse = "active" )
type DtlsHash ¶
type DtlsHash string
DtlsHash defines the supported hash algorithms used in DTLS (Datagram Transport Layer Security).
const ( // Sha256 represents the SHA-256 hash algorithm used in DTLS. Sha256 DtlsHash = "sha-256" // Sha1 represents the SHA-1 hash algorithm used in DTLS. Sha1 DtlsHash = "sha-1" // Sha224 represents the SHA-224 hash algorithm used in DTLS. Sha224 DtlsHash = "sha-224" // Sha384 represents the SHA-384 hash algorithm used in DTLS. Sha384 DtlsHash = "sha-384" // Sha512 represents the SHA-512 hash algorithm used in DTLS. Sha512 DtlsHash = "sha-512" )
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine represents a network engine that manages connections and communication parameters. It holds TCP and UDP connections, IP address, port, DNS resolver, protocol type, and a numeric identifier.
func (*Engine) Conn ¶
Conn establishes a connection with the RTP engine proxy using the configured protocol and port. It sets a read timeout of 10 seconds and stores the connection in the Engine instance.
Returns:
net.Conn - the established network connection. error - an error if the connection fails.
func (*Engine) ConnUDP ¶ added in v0.1.3
ConnUDP establishes a UDP connection with the RTP engine proxy using the configured protocol and port. It sets a read timeout of 10 seconds and stores the UDP connection in the Engine instance.
Returns:
*net.UDPConn - the established UDP connection. error - an error if the connection fails.
func (*Engine) GetCookie ¶
GetCookie generates a unique cookie string for command identification. This function uses UUID generation to create a random string, which can be used to correlate requests and responses when communicating with the RTP engine.
Returns:
string - A newly generated UUID string to be used as a cookie.
func (*Engine) GetIP ¶
GetIP returns the default IP address assigned for the RTP engine connection. This method retrieves the IP address stored in the Engine instance.
Returns:
net.IP - The IP address used for the RTP engine connection.
func (*Engine) GetNG ¶
GetNG returns the default NG port used by the controller. This method retrieves the NG port value stored in the Engine instance.
Returns:
int - the default NG port.
func (*Engine) GetPort ¶
GetPort returns the default port assigned for the RTP engine connection. This method retrieves the port number stored in the Engine instance.
Returns:
int - The port number used for the RTP engine connection.
type ICE ¶
type ICE string
ICE defines the available modes for handling ICE (Interactive Connectivity Establishment) in RTP engine operations. ICE is used to establish peer-to-peer media connections, especially in NAT and firewall traversal scenarios.
const ( // ICERemove disables ICE processing and removes any ICE-related attributes. ICERemove ICE = "remove" // ICEForce forces ICE negotiation regardless of remote support. ICEForce ICE = "force" // ICEDefault applies ICE handling based on default engine behavior or configuration. ICEDefault ICE = "default" // ICEForceRelay forces media to be relayed through ICE candidates (e.g., TURN servers). ICEForceRelay ICE = "force-relay" // ICEOptional enables ICE negotiation only if supported by the remote party. ICEOptional ICE = "optional" )
type OSRTP ¶
type OSRTP string
OSRTP defines the modes for handling Opportunistic SRTP (OSRTP) in RTP engine operations. OSRTP allows secure media transmission using SRTP without requiring prior key exchange, enabling encryption when both endpoints support it.
const ( // OSRTPOffer initiates an OSRTP negotiation. OSRTPOffer OSRTP = "offer" // OSRTPOfferRFC initiates OSRTP negotiation using the RFC-compliant method. OSRTPOfferRFC OSRTP = "offer-RFC" // OSRTPOfferLegacy initiates OSRTP negotiation using legacy signaling methods. OSRTPOfferLegacy OSRTP = "offer-legacy" // OSRTPAcceptRFC accepts OSRTP using the RFC-compliant method. OSRTPAcceptRFC OSRTP = "accept-RFC" // OSRTPAcceptLegacy accepts OSRTP using legacy signaling methods. OSRTPAcceptLegacy OSRTP = "accept-legacy" // OSRTPAccept accepts OSRTP negotiation regardless of the method used. OSRTPAccept OSRTP = "accept" )
type ParamFlags ¶
type ParamFlags string
ParamFlags defines a set of optional flags that modify the behavior of RTP engine operations. These flags control aspects of media handling, signaling, codec negotiation, NAT traversal, and recording.
const ( // TrustAddress trusts the source IP address from the signaling layer. TrustAddress ParamFlags = "trust-address" // Symmetric enables symmetric RTP behavior (same IP/port for sending and receiving). Symmetric ParamFlags = "symmetric" // Asymmetric enables asymmetric RTP behavior (different IP/port for sending and receiving). Asymmetric ParamFlags = "asymmetric" // Unidirectional forces one-way media flow. Unidirectional ParamFlags = "unidirectional" // Force applies the operation even if conditions are not ideal. Force ParamFlags = "force" // StrictSource enforces strict source IP verification for incoming media. StrictSource ParamFlags = "strict-source" // MediaHandover enables media handover between endpoints. MediaHandover ParamFlags = "media-handover" // Reset resets the media session state. Reset ParamFlags = "reset" // PortLatching enables port latching for NAT traversal. PortLatching ParamFlags = "port-latching" // NoRtcpAttribute disables RTCP attribute in SDP. NoRtcpAttribute ParamFlags = "no-rtcp-attribute" // FullRtcpAttribute includes full RTCP attribute in SDP. FullRtcpAttribute ParamFlags = "full-rtcp-attribute" // LoopProtect prevents media loopback scenarios. LoopProtect ParamFlags = "loop-protect" // RecordCall enables call recording. RecordCall ParamFlags = "record-call" // AlwaysTranscode forces media transcoding regardless of codec compatibility. AlwaysTranscode ParamFlags = "always-transcode" // SIPREC enables SIP Recording (SIPREC) support. SIPREC ParamFlags = "SIPREC" // PadCrypto pads crypto attributes in SDP. PadCrypto ParamFlags = "pad-crypto" // GenerateMid generates media stream identifiers (MID) in SDP. GenerateMid ParamFlags = "generate-mid" // Fragment enables SDP fragmentation. Fragment ParamFlags = "fragment" // OriginalSendrecv preserves original sendrecv attributes. OriginalSendrecv ParamFlags = "original-sendrecv" // SymmetricCodecs enforces symmetric codec negotiation. SymmetricCodecs ParamFlags = "symmetric-codecs" // AsymmetricCodecs allows asymmetric codec negotiation. AsymmetricCodecs ParamFlags = "asymmetric-codecs" // InjectDTMF injects DTMF tones into the media stream. InjectDTMF ParamFlags = "inject-DTMF" // DetectDTMF enables detection of DTMF tones. DetectDTMF ParamFlags = "detect-DTMF" // GenerateRTCP enables RTCP packet generation. GenerateRTCP ParamFlags = "generate-RTCP" // SingleCodec restricts media to a single codec. SingleCodec ParamFlags = "single-codec" // NoCodecRenegotiation disables codec renegotiation during session updates. NoCodecRenegotiation ParamFlags = "no-codec-renegotiation" // PierceNAT attempts to pierce NAT for media flow. PierceNAT ParamFlags = "pierce-NAT" // SIPSourceAddress uses the SIP source address for media routing. SIPSourceAddress ParamFlags = "SIP-source-address" // AllowTranscoding permits media transcoding. AllowTranscoding ParamFlags = "allow-transcoding" // TrickleICE enables Trickle ICE support. TrickleICE ParamFlags = "trickle-ICE" // RejectICE disables ICE candidate negotiation. RejectICE ParamFlags = "reject-ICE" // Egress marks the media flow as outbound. Egress ParamFlags = "egress" // NoJitterBuffer disables jitter buffering. NoJitterBuffer ParamFlags = "no-jitter-buffer" // Passthrough allows media to pass through without modification. Passthrough ParamFlags = "passthrough" // NoPassthrough disables media passthrough. NoPassthrough ParamFlags = "no-passthrough" // Pause temporarily halts media transmission. Pause ParamFlags = "pause" // EarlyMedia enables early media handling before call is answered. EarlyMedia ParamFlags = "early-media" // BlockShort blocks short-duration media packets. BlockShort ParamFlags = "block-short" // RecordingVsc enables VSC (Video Surveillance Control) recording. RecordingVsc ParamFlags = "recording-vsc" // BlockEgress blocks outbound media flow. BlockEgress ParamFlags = "block-egress" // StripExtmap removes extmap attributes from SDP. StripExtmap ParamFlags = "strip-extmap" // NATWait waits for NAT traversal before media transmission. NATWait ParamFlags = "NAT-wait" // NoPortLatching disables port latching. NoPortLatching ParamFlags = "no-port-latching" // RecordingAnnouncement enables recording announcements. RecordingAnnouncement ParamFlags = "recording-announcement" // ReuseCodecs reuses previously negotiated codecs. ReuseCodecs ParamFlags = "reuse-codecs" // RTCPMirror mirrors RTCP packets. RTCPMirror ParamFlags = "RTCP-mirror" // StaticCodecs enforces use of static codec payload types. StaticCodecs ParamFlags = "static-codecs" // CodecExceptPCMU excludes PCMU codec from negotiation. CodecExceptPCMU ParamFlags = "codec-except-PCMU" // CodecExceptPCMA excludes PCMA codec from negotiation. CodecExceptPCMA ParamFlags = "codec-except-PCMA" // CodecExceptG729 excludes G729 codec from negotiation. CodecExceptG729 ParamFlags = "codec-except-G729" // CodecExceptG729a excludes G729a codec from negotiation. CodecExceptG729a ParamFlags = "codec-except-G729a" // CodecExceptOpus excludes Opus codec from negotiation. CodecExceptOpus ParamFlags = "codec-except-opus" // CodecExceptG722 excludes G722 codec from negotiation. CodecExceptG722 ParamFlags = "codec-except-G722" // CodecExceptG723 excludes G723 codec from negotiation. CodecExceptG723 ParamFlags = "codec-except-G723" // CodecExceptILBC excludes iLBC codec from negotiation. CodecExceptILBC ParamFlags = "codec-except-iLBC" // CodecExceptSpeex excludes Speex codec from negotiation. CodecExceptSpeex ParamFlags = "codec-except-speex" // CodecStripPCMU removes PCMU codec from SDP. CodecStripPCMU ParamFlags = "codec-strip-PCMU" // CodecStripPCMA removes PCMA codec from SDP. CodecStripPCMA ParamFlags = "codec-strip-PCMA" // CodecStripG729 removes G729 codec from SDP. CodecStripG729 ParamFlags = "codec-strip-G729" // CodecStripG729a removes G729a codec from SDP. CodecStripG729a ParamFlags = "codec-strip-G729a" // CodecStripOpus removes Opus codec from SDP. CodecStripOpus ParamFlags = "codec-strip-opus" // CodecStripG722 removes G722 codec from SDP. CodecStripG722 ParamFlags = "codec-strip-G722" // CodecStripG723 removes G723 codec from SDP. CodecStripG723 ParamFlags = "codec-strip-G723" // CodecStripILBC removes iLBC codec from SDP. CodecStripILBC ParamFlags = "codec-strip-iLBC" // CodecStripSpeex removes Speex codec from SDP. CodecStripSpeex ParamFlags = "codec-strip-speex" // CodecMaskPCMA masks PCMA codec in SDP. CodecMaskPCMA ParamFlags = "codec-mask-PCMA" // CodecMaskG729 masks G729 codec in SDP. CodecMaskG729 ParamFlags = "codec-mask-G729" // CodecMaskG729a masks G729a codec in SDP. CodecMaskG729a ParamFlags = "codec-mask-G729a" // CodecMaskOpus masks Opus codec in SDP. CodecMaskOpus ParamFlags = "codec-mask-opus" // CodecMaskG722 masks G722 codec in SDP. CodecMaskG722 ParamFlags = "codec-mask-G722" // CodecMaskG723 masks G723 codec in SDP. CodecMaskG723 ParamFlags = "codec-mask-G723" // CodecMaskILBC masks iLBC codec in SDP. CodecMaskILBC ParamFlags = "codec-mask-iLBC" // CodecMaskSpeex masks Speex codec in SDP. CodecMaskSpeex ParamFlags = "codec-mask-speex" // CodecTranscodePCMA enables transcoding to PCMA codec. CodecTranscodePCMA ParamFlags = "codec-transcode-PCMA" // CodecTranscodeG729 enables transcoding to G729 codec. CodecTranscodeG729 ParamFlags = "codec-transcode-G729" // CodecTranscodeG729a enables transcoding to G729a codec. CodecTranscodeG729a ParamFlags = "codec-transcode-G729a" // CodecTranscodeOpus enables transcoding to Opus codec. CodecTranscodeOpus ParamFlags = "codec-transcode-opus" // CodecTranscodeG722 enables transcoding to G722 codec. CodecTranscodeG722 ParamFlags = "codec-transcode-G722" // CodecTranscodeG723 enables transcoding to G723 codec. CodecTranscodeG723 ParamFlags = "codec-transcode-G723" // CodecTranscodeILBC enables transcoding to iLBC codec. CodecTranscodeILBC ParamFlags = "codec-transcode-iLBC" // CodecTranscodeSpeex enables transcoding to Speex codec. CodecTranscodeSpeex ParamFlags = "codec-transcode-speex" )
type ParamMoh ¶ added in v0.1.8
type ParamMoh struct {
File string `json:"file,omitempty" bencode:"file,omitempty"`
Blob string `json:"blob,omitempty" bencode:"blob,omitempty"`
DbId string `json:"db-id,omitempty" bencode:"db-id,omitempty"`
Mode string `json:"mode,omitempty" bencode:"mode,omitempty"`
Connection Connection `json:"connection,omitempty" bencode:"connection,omitempty"`
}
ParamMoh defines the attributes for Music On Hold (MOH) configuration in RTP engine operations. This struct allows you to specify the audio file, binary data, database ID, playback mode, and connection details for MOH. Fields are annotated for both JSON and Bencode serialization.
Fields:
File string - The path or name of the MOH audio file. Blob string - Binary data for the MOH audio. DbId string - Database identifier for the MOH resource. Mode string - Playback mode (e.g., "sendonly"). Connection Connection - Connection details for the MOH resource.
type ParamRTCPMux ¶
type ParamRTCPMux string
ParamRTCPMux defines the RTCP multiplexing modes used in RTP engine operations. RTCP multiplexing allows RTP and RTCP packets to be sent over a single port, improving efficiency and NAT traversal.
const ( // RTCPOffer indicates that RTCP multiplexing is being offered. RTCPOffer ParamRTCPMux = "offer" // RTCPRequire indicates that RTCP multiplexing is required and must be supported. RTCPRequire ParamRTCPMux = "require" // RTCPDemux enables demultiplexing of RTP and RTCP packets received on the same port. RTCPDemux ParamRTCPMux = "demux" // RTCPAccept accepts RTCP multiplexing if offered by the remote party. RTCPAccept ParamRTCPMux = "accept" // RTCPReject rejects RTCP multiplexing, forcing separate RTP and RTCP streams. RTCPReject ParamRTCPMux = "reject" )
type ParamReplace ¶
type ParamReplace string
ParamReplace defines the types of SDP (Session Description Protocol) parameters that can be modified or replaced during RTP engine operations.
const ( // Origin replaces the SDP origin field. Origin ParamReplace = "origin" // OriginFull replaces the full SDP origin line, including username, session ID, version, network type, address type, and address. OriginFull ParamReplace = "origin-full" // SessionConnection replaces the SDP session-level connection information. // Deprecated: The 'replace-session-connection' flag is no longer supported. SessionConnection ParamReplace = "session-connection" // SdpVersion replaces the SDP version field. SdpVersion ParamReplace = "SDP-version" // Username replaces the username field in the SDP origin line. Username ParamReplace = "username" // SessionName replaces the session name field in the SDP. SessionName ParamReplace = "session-name" // ZeroAddress replaces the connection address with a zero IP address (e.g., 0.0.0.0). ZeroAddress ParamReplace = "zero-address" // ForceIncrementSdpVersion forces an increment of the SDP version number. ForceIncrementSdpVersion ParamReplace = "force-increment-sdp-version" // ForceIncrementSdpVer is an alias for force-increment-sdp-version. ForceIncrementSdpVer ParamReplace = "force-increment-sdp-ver" )
type ParametrosOption ¶
type ParametrosOption func(c *RequestRtp) error
ParametrosOption defines a function type used to customize a RequestRtp instance. Each ParametrosOption receives a pointer to a RequestRtp and applies specific configuration, such as setting flags, codecs, transport protocol, or other SDP-related parameters. If the option encounters an error during configuration, it should return the error.
This pattern allows flexible and composable configuration of RTP requests, enabling multiple options to be applied in sequence.
Example usage:
req, err := SDPOffering(params, req.SetCodecMask([]Codecs{"PCMU"}), req.SetTransportProtocol(RTP_AVP))
type ParamsOptInt ¶
type ParamsOptInt struct {
TOS int `json:"TOS,omitempty" bencode:"TOS,omitempty"`
DeleteDelay int `json:"delete-delay,omitempty" bencode:"delete-delay,omitempty"`
DelayBuffer int `json:"delay-buffer,omitempty" bencode:"delay-buffer,omitempty"`
Volume int `json:"volume,omitempty" bencode:"volume,omitempty"`
TriggerEndTime int `json:"trigger-end-time,omitempty" bencode:"trigger-end-time,omitempty"`
TriggerEndDigits int `json:"trigger-end-digits,omitempty" bencode:"trigger-end-digits,omitempty"`
DTMFDelay int `json:"DTMF-delay,omitempty" bencode:"DTMF-delay,omitempty"`
Ptime int `json:"ptime,omitempty" bencode:"ptime,omitempty"`
PtimeReverse int `json:"ptime-reverse,omitempty" bencode:"ptime-reverse,omitempty"`
DbId int `json:"db-id,omitempty" bencode:"db-id,omitempty"`
Duration int `json:"duration,omitempty" bencode:"duration,omitempty"`
RepeatTimes int `json:"repeat-times,omitempty" bencode:"repeat-times,omitempty"`
RepeatDuration int `json:"repeat-duration,omitempty" bencode:"repeat-duration,omitempty"`
StartPos int `json:"start-pos,omitempty" bencode:"rstart-pos,omitempty"`
}
ParamsOptInt defines a set of integer-based parameters for RTP engine operations. Each field represents a configurable option that can be serialized to JSON or bencode formats. The struct supports various RTP-related settings, such as TOS, delay, volume, DTMF, ptime, and session duration.
Fields:
TOS int - Type of Service (QoS) value. DeleteDelay int - Delay before deleting the session. DelayBuffer int - Buffer delay value. Volume int - Volume adjustment. TriggerEndTime int - End time for trigger events. TriggerEndDigits int - Number of digits for trigger end. DTMFDelay int - DTMF signal delay. Ptime int - Packetization time (ms). PtimeReverse int - Reverse packetization time (ms). DbId int - Database identifier. Duration int - Session duration (seconds). RepeatTimes int - Repeat times duration (seconds). RepeatDuration int - Repeat durations (seconds). StartPos int - Start position (seconds).
type ParamsOptString ¶
type ParamsOptString struct {
FromTag string `json:"from-tag,omitempty" bencode:"from-tag,omitempty"`
ToTag string `json:"to-tag,omitempty" bencode:"to-tag,omitempty"`
CallId string `json:"call-id,omitempty" bencode:"call-id,omitempty"`
TransportProtocol TransportProtocol `json:"transport-protocol,omitempty" bencode:"transport-protocol,omitempty"`
MediaAddress string `json:"media-address,omitempty" bencode:"media-address,omitempty"`
ICE ICE `json:"ICE,omitempty" bencode:"ICE,omitempty"`
AddressFamily AddressFamily `json:"address-family,omitempty" bencode:"address-family,omitempty"`
DTLS DTLS `json:"DTLS,omitempty" bencode:"DTLS,omitempty"`
ViaBranch string `json:"via-branch,omitempty" bencode:"via-branch,omitempty"`
XmlrpcCallback string `json:"xmlrpc-callback,omitempty" bencode:"xmlrpc-callback,omitempty"`
Metadata string `json:"metadata,omitempty" bencode:"metadata,omitempty"`
File string `json:"file,omitempty" bencode:"file,omitempty"`
Code string `json:"code,omitempty" bencode:"code,omitempty"`
DTLSFingerprint DTLSFingerprint `json:"DTLS-fingerprint,omitempty" bencode:"DTLS-fingerprint,omitempty"`
ICELite string `json:"ICE-lite,omitempty" bencode:"ICE-lite,omitempty"`
MediaEcho string `json:"media-echo,omitempty" bencode:"media-echo,omitempty"`
Label string `json:"label,omitempty" bencode:"label,omitempty"`
SetLabel string `json:"set-label,omitempty" bencode:"set-label,omitempty"`
FromLabel string `json:"from-label,omitempty" bencode:"from-label,omitempty"`
ToLabel string `json:"to-label,omitempty" bencode:"to-label,omitempty"`
DTMFSecurity string `json:"DTMF-security,omitempty" bencode:"DTMF-security,omitempty"`
Digit string `json:"digit,omitempty" bencode:"digit,omitempty"`
DTMFSecurityTrigger string `json:"DTMF-security-trigger,omitempty" bencode:"DTMF-security-trigger,omitempty"`
DTMFSecurityTriggerEnd string `json:"DTMF-security-trigger-end,omitempty" bencode:"DTMF-security-trigger-end,omitempty"`
Trigger string `json:"trigger,omitempty" bencode:"trigger,omitempty"`
TriggerEnd string `json:"trigger-end,omitempty" bencode:"trigger-end,omitempty"`
All string `json:"all,omitempty" bencode:"all,omitempty"`
Frequency string `json:"frequency,omitempty" bencode:"frequency,omitempty"`
Blob string `json:"blob,omitempty" bencode:"blob,omitempty"`
Sdp string `json:"sdp,omitempty" bencode:"sdp,omitempty"`
AudioPlayer string `json:"audio-player,omitempty" bencode:"audio-player,omitempty"`
DTMFLogDest string `json:"dtmf-log-dest,omitempty" bencode:"dtmf-log-dest,omitempty"`
OutputDestination string `json:"output-destination,omitempty" bencode:"output-destination,omitempty"`
VscStartRec string `json:"vsc-start-rec,omitempty" bencode:"vsc-start-rec,omitempty"`
VscStopRec string `json:"vsc-stop-rec,omitempty" bencode:"vsc-stop-rec,omitempty"`
VscPauseRec string `json:"vsc-pause-rec,omitempty" bencode:"vsc-pause-rec,omitempty"`
VscStartStopRec string `json:"vsc-start-stop-rec,omitempty" bencode:"vsc-start-stop-rec,omitempty"`
VscPauseResumeRec string `json:"vsc-pause-resume-rec,omitempty" bencode:"vsc-pause-resume-rec,omitempty"`
VscStartPauseResumeRec string `json:"vsc-start-pause-resume-rec,omitempty" bencode:"vsc-start-pause-resume-rec,omitempty"`
RtppFlags string `json:"rtpp-flags,omitempty" bencode:"rtpp-flags,omitempty"`
SdpAttr *ParamsSdpAttrSections `json:"sdp-attr,omitempty" bencode:"sdp-attr,omitempty"`
Template string `json:"template,omitempty" bencode:"template,omitempty"`
RecordCall Record `json:"record-call,omitempty" bencode:"record-call,omitempty"`
}
ParamsOptString defines a set of optional parameters for RTP engine operations. Each field represents a configurable option that can be serialized to JSON or bencode formats. The struct includes tags for both serialization formats and supports various RTP-related settings, such as transport protocol, media address, ICE, DTLS, metadata, DTMF, SDP attributes, recording options, and more.
Fields:
FromTag string - SIP from-tag value. ToTag string - SIP to-tag value. CallId string - Call identifier. TransportProtocol TransportProtocol - Transport protocol for RTP. MediaAddress string - Media IP address. ICE ICE - ICE configuration. AddressFamily AddressFamily - Address family (e.g., IPv4, IPv6). DTLS DTLS - DTLS configuration. ViaBranch string - SIP Via branch tag. XmlrpcCallback string - XML-RPC callback URL. Metadata string - Additional metadata. File string - File path or name. Code string - Custom code or identifier. DTLSFingerprint DTLSFingerprint - DTLS fingerprint. ICELite string - ICE Lite mode. MediaEcho string - Media echo setting. Label string - Label for identification. SetLabel string - Label to set. FromLabel string - Label for the sender. ToLabel string - Label for the receiver. DTMFSecurity string - DTMF security setting. Digit string - DTMF digit. DTMFSecurityTrigger string - DTMF security trigger. DTMFSecurityTriggerEnd string - DTMF security trigger end. Trigger string - Trigger event. TriggerEnd string - Trigger end event. All string - Apply to all. Frequency string - Frequency value. Blob string - Binary large object. Sdp string - SDP data. AudioPlayer string - Audio player setting. DTMFLogDest string - DTMF log destination. OutputDestination string - Output destination. VscStartRec string - VSC start recording. VscStopRec string - VSC stop recording. VscPauseRec string - VSC pause recording. VscStartStopRec string - VSC start/stop recording. VscPauseResumeRec string - VSC pause/resume recording. VscStartPauseResumeRec string - VSC start/pause/resume recording. RtppFlags string - RTP proxy flags. SdpAttr *ParamsSdpAttrSections - SDP attribute sections. Template string - Template name. RecordCall Record - Call recording option.
type ParamsOptStringArray ¶
type ParamsOptStringArray struct {
Flags []ParamFlags `json:"flags,omitempty" bencode:"flags,omitempty"`
RtcpMux []ParamRTCPMux `json:"rtcp-mux,omitempty" bencode:"rtcp-mux,omitempty"`
SDES []SDES `json:"SDES,omitempty" bencode:"SDES,omitempty"`
Supports []string `json:"supports,omitempty" bencode:"supports,omitempty"`
T38 []string `json:"T38,omitempty" bencode:"T38,omitempty"`
OSRTP []OSRTP `json:"OSRTP,omitempty" bencode:"OSRTP,omitempty"`
ReceivedFrom []string `json:"received-from,omitempty" bencode:"received-from,omitempty"`
FromTags []string `json:"from-tags,omitempty" bencode:"from-tags,omitempty"`
Frequencies []string `json:"frequencies,omitempty" bencode:"frequencies,omitempty"`
Replace []ParamReplace `json:"replace,omitempty" bencode:"replace,omitempty"`
Moh []ParamMoh `json:"moh,omitempty" bencode:"moh,omitempty"`
}
ParamsOptStringArray defines a set of array-based parameters for RTP engine operations. Each field represents a configurable option that can be serialized to JSON or bencode formats. The struct supports various RTP-related settings, such as flags, RTCP multiplexing, SDES, supported features, T.38 fax, OSRTP, received-from addresses, from-tags, frequencies, replace parameters, and music on hold.
Fields:
Flags []ParamFlags - List of flags for RTP operations. RtcpMux []ParamRTCPMux - RTCP multiplexing options. SDES []SDES - SDES encryption options. Supports []string - Supported features. T38 []string - T.38 fax options. OSRTP []OSRTP - OSRTP encryption options. ReceivedFrom []string - List of received-from addresses. FromTags []string - List of SIP from-tag values. Frequencies []string - List of frequency values. Replace []ParamReplace - List of parameters to be replaced. Moh []ParamMoh - Music On Hold file configurations.
type ParamsSdpAttrCommands ¶
type ParamsSdpAttrCommands struct {
Add []string `json:"add,omitempty" bencode:"add,omitempty"`
Remove []string `json:"remove,omitempty" bencode:"remove,omitempty"`
Substitute [][]string `json:"substitute,omitempty" bencode:"substitute,omitempty"`
}
ParamsSdpAttrCommands defines attribute commands for SDP sections in RTP engine operations. This struct allows you to specify lists of SDP attributes to add, remove, or substitute within a given SDP section. Fields are annotated for both JSON and Bencode serialization.
Fields:
Add []string - List of SDP attributes to add.
Remove []string - List of SDP attributes to remove.
Substitute [][]string - List of attribute substitutions, where each inner slice contains
the original attribute and its replacement.
type ParamsSdpAttrSections ¶
type ParamsSdpAttrSections struct {
Global *ParamsSdpAttrCommands `json:"global,omitempty" bencode:"global,omitempty"`
Audio *ParamsSdpAttrCommands `json:"audio,omitempty" bencode:"audio,omitempty"`
Video *ParamsSdpAttrCommands `json:"video,omitempty" bencode:"video,omitempty"`
None *ParamsSdpAttrCommands `json:"none,omitempty" bencode:"none,omitempty"`
}
ParamsSdpAttrSections defines the SDP attribute sections for RTP engine operations. This struct allows you to specify attribute modifications for different SDP sections, including global, audio, video, and none. Each field is a pointer to ParamsSdpAttrCommands, which contains lists of attributes to add, remove, or substitute in the respective section. Fields are annotated for both JSON and Bencode serialization.
Fields:
Global *ParamsSdpAttrCommands - Attribute commands for the global SDP section. Audio *ParamsSdpAttrCommands - Attribute commands for the audio SDP section. Video *ParamsSdpAttrCommands - Attribute commands for the video SDP section. None *ParamsSdpAttrCommands - Attribute commands for the none SDP section.
type Record ¶ added in v0.1.9
type Record string
Record defines the available options for controlling media recording behavior in RTP engine operations. These values determine whether media streams should be recorded.
type RequestRtp ¶
type RequestRtp struct {
Command string `json:"command" bencode:"command"`
*ParamsOptString
*ParamsOptInt
*ParamsOptStringArray
}
RequestRtp represents a request to the RTP engine, containing the command to be executed and optional parameters. The struct embeds ParamsOptString, ParamsOptInt, and ParamsOptStringArray to allow flexible inclusion of string, integer, and string array options respectively. The Command field specifies the action for the RTP engine, and is serialized using both JSON and Bencode formats.
func SDPAnswer ¶
func SDPAnswer(parametros *ParamsOptString, options ...ParametrosOption) (*RequestRtp, error)
SDPAnswer creates an SDP answer request for rtpengine. This function initializes a RequestRtp structure with the "Answer" command and the provided parameters. It applies any additional options (ParametrosOption) to customize the request, such as codec masks, flags, or transport protocol. If any option returns an error, the function aborts and returns the error.
Parameters:
parametros *ParamsOptString - The main SDP parameters for the answer. options ...ParametrosOption - Optional functions to further configure the RequestRtp.
Returns:
*RequestRtp - The fully configured RTP request for the answer. error - Any error encountered while applying the options.
Example usage:
req, err := SDPAnswer(params, req.SetCodecMask([]Codecs{"PCMU"}), req.SetTransportProtocol(RTP_AVP))
func SDPDelete ¶
func SDPDelete(parametros *ParamsOptString, options ...ParametrosOption) (*RequestRtp, error)
SDPDelete creates an SDP delete request for rtpengine. This function initializes a RequestRtp structure with the "Delete" command and the provided parameters. It applies any additional options (ParametrosOption) to customize the request, such as flags or protocol settings. If any option returns an error, the function aborts and returns the error.
Parameters:
parametros *ParamsOptString - The main SDP parameters for the delete operation. options ...ParametrosOption - Optional functions to further configure the RequestRtp.
Returns:
*RequestRtp - The fully configured RTP request for the delete operation. error - Any error encountered while applying the options.
Example usage:
req, err := SDPDelete(params, req.SetFlags([]ParamFlags{"flag1"}))
func SDPOffering ¶
func SDPOffering(parametros *ParamsOptString, options ...ParametrosOption) (*RequestRtp, error)
SDPOffering creates an SDP offer request for rtpengine. This function initializes a RequestRtp structure with the "Offer" command and the provided parameters. It applies any additional options (ParametrosOption) to customize the request, such as codec masks, flags, or transport protocol. If any option returns an error, the function aborts and returns the error.
Parameters:
parametros *ParamsOptString - The main SDP parameters for the offer. options ...ParametrosOption - Optional functions to further configure the RequestRtp.
Returns:
*RequestRtp - The fully configured RTP request for the offer. error - Any error encountered while applying the options.
Example usage:
req, err := SDPOffering(params, req.SetCodecMask([]Codecs{"PCMU"}), req.SetTransportProtocol(RTP_AVP))
func (*RequestRtp) DeleteSDES ¶ added in v1.0.0
func (c *RequestRtp) DeleteSDES(cript []CryptoSuite) ParametrosOption
DeleteSDES disables specific SDES crypto suites for the RTP request. This function receives a list of CryptoSuite values and generates flags in the format "no-<crypto>", which are appended to the SDES field of ParamsOptStringArray. These flags instruct rtpengine to disable the specified SDES encryption algorithms for the session.
Parameters:
cript []CryptoSuite - List of crypto suites to be disabled.
Returns:
ParametrosOption - A function that applies the SDES disable flags to the RequestRtp structure.
Example usage:
req.DeleteSDES([]CryptoSuite{"AES_CM_128_HMAC_SHA1_80"})
func (*RequestRtp) DisablesSDES ¶ added in v1.0.0
func (c *RequestRtp) DisablesSDES() ParametrosOption
DisablesSDES disables SDES (Session Description Protocol Security Descriptions) for the RTP request. This function appends the SDESOff flag to the SDES field of ParamsOptStringArray, instructing rtpengine to turn off SDES encryption for the session.
Returns:
ParametrosOption - A function that applies the SDES disable flag to the RequestRtp structure.
Example usage:
req.DisablesSDES()
func (*RequestRtp) EnableSDES ¶
func (c *RequestRtp) EnableSDES(cript []CryptoSuite) ParametrosOption
EnableSDES enables specific SDES crypto suites for the RTP request. This function receives a list of CryptoSuite values and generates flags in the format "only-<crypto>", which are appended to the SDES field of ParamsOptStringArray. These flags instruct rtpengine to use only the specified SDES encryption algorithms for the session.
Parameters:
cript []CryptoSuite - List of crypto suites to be enabled.
Returns:
ParametrosOption - A function that applies the SDES enable flags to the RequestRtp structure.
Example usage:
req.EnableSDES([]CryptoSuite{"AES_CM_128_HMAC_SHA1_80"})
func (*RequestRtp) ICEForce ¶
func (c *RequestRtp) ICEForce() ParametrosOption
ICEForce forces the use of ICE attributes in the SDP for the RTP request. This function sets the ICE field of the RequestRtp structure to "force", instructing rtpengine to enforce ICE negotiation regardless of the original SDP content.
Returns:
ParametrosOption - A function that applies the ICE force option to the RequestRtp structure.
Example usage:
req.ICEForce()
func (*RequestRtp) ICERemove ¶
func (c *RequestRtp) ICERemove() ParametrosOption
ICERemove removes all ICE attributes from the SDP in the RTP request. This function sets the ICE field of the RequestRtp structure to "remove", indicating that all ICE candidates and related attributes should be stripped from the SDP before sending it to rtpengine. This ensures that the media proxy becomes the sole ICE candidate.
Returns:
ParametrosOption - A function that applies the ICE removal to the RequestRtp structure.
Example usage:
req.ICERemove()
func (*RequestRtp) RecordNo ¶ added in v0.1.9
func (c *RequestRtp) RecordNo() ParametrosOption
RecordNo disables call recording for the RTP request. This function sets the RecordCall field of the RequestRtp structure to "no", instructing rtpengine not to record the media stream for the session.
Returns:
ParametrosOption - A function that applies the call recording disable option to the RequestRtp structure.
Example usage:
req.RecordNo()
func (*RequestRtp) RecordOff ¶ added in v0.1.9
func (c *RequestRtp) RecordOff() ParametrosOption
RecordOff disables call recording for the RTP request. This function sets the RecordCall field of the RequestRtp structure to "off", instructing rtpengine to stop recording the media stream for the session.
Returns:
ParametrosOption - A function that applies the call recording off option to the RequestRtp structure.
Example usage:
req.RecordOff()
func (*RequestRtp) RecordOn ¶ added in v0.1.9
func (c *RequestRtp) RecordOn() ParametrosOption
RecordOn enables call recording for the RTP request. This function sets the RecordCall field of the RequestRtp structure to "on", instructing rtpengine to start recording the media stream for the session.
Returns:
ParametrosOption - A function that applies the call recording option to the RequestRtp structure.
Example usage:
req.RecordOn()
func (*RequestRtp) RecordYes ¶ added in v0.1.9
func (c *RequestRtp) RecordYes() ParametrosOption
RecordYes enables call recording for the RTP request. This function sets the RecordCall field of the RequestRtp structure to "yes", instructing rtpengine to record the media stream for the session.
Returns:
ParametrosOption - A function that applies the call recording option to the RequestRtp structure.
Example usage:
req.RecordYes()
func (*RequestRtp) SetAttrChange ¶
func (c *RequestRtp) SetAttrChange(sdpAttr *ParamsSdpAttrSections) ParametrosOption
SetAttrChange sets the SDP attribute sections for the RTP request. This function receives a pointer to ParamsSdpAttrSections and assigns it to the SdpAttr field of the RequestRtp structure. It allows you to specify which SDP attributes should be added, removed, or replaced during the negotiation process.
Parameters:
sdpAttr *ParamsSdpAttrSections - Pointer to the SDP attribute sections to be applied.
Returns:
ParametrosOption - A function that applies the SDP attribute changes to the RequestRtp structure.
Example usage:
req.SetAttrChange(&ParamsSdpAttrSections{/* attribute modifications */})
func (*RequestRtp) SetCodecEncoder ¶
func (c *RequestRtp) SetCodecEncoder(codecs []Codecs) ParametrosOption
SetCodecEncoder adds codec transcoding flags to the RTP request. This function receives a list of codecs and generates flags in the format "codec-transcode-<codec>", which are appended to the Flags field of ParamsOptStringArray. These flags instruct rtpengine to transcode the specified codecs during SDP negotiation.
Parameters:
codecs []Codecs - List of codecs to be transcoded.
Returns:
ParametrosOption - A function that applies the codec transcoding flags to the RequestRtp structure.
Example usage:
req.SetCodecEncoder([]Codecs{"PCMU", "PCMA"})
func (*RequestRtp) SetCodecExcept ¶
func (c *RequestRtp) SetCodecExcept(codecs []Codecs) ParametrosOption
SetCodecExcept adds codec exception flags to the RTP request. This function receives a list of codecs and generates flags in the format "codec-except-<codec>", which are appended to the Flags field of ParamsOptStringArray. These flags instruct rtpengine to exclude the specified codecs from the SDP negotiation.
Parameters:
codecs []Codecs - List of codecs to be excluded.
Returns:
ParametrosOption - A function that applies the codec exception flags to the RequestRtp structure.
Example usage:
req.SetCodecExcept([]Codecs{"PCMU", "PCMA"})
func (*RequestRtp) SetCodecMask ¶
func (c *RequestRtp) SetCodecMask(codecs []Codecs) ParametrosOption
SetCodecMask adds codec mask flags to the RTP request. This function receives a list of codecs and generates flags in the format "codec-mask-<codec>", which are appended to the Flags field of ParamsOptStringArray. These flags instruct rtpengine to accept only the specified codecs during SDP negotiation.
Parameters:
codecs []Codecs - List of codecs to be masked.
Returns:
ParametrosOption - A function that applies the codec mask flags to the RequestRtp structure.
Example usage:
req.SetCodecMask([]Codecs{"PCMU", "PCMA"})
func (*RequestRtp) SetCodecStrip ¶
func (c *RequestRtp) SetCodecStrip(codecs []Codecs) ParametrosOption
SetCodecStrip adds codec strip flags to the RTP request. This function receives a list of codecs and generates flags in the format "codec-strip-<codec>", which are appended to the Flags field of ParamsOptStringArray. These flags instruct rtpengine to remove the specified codecs from the SDP negotiation.
Parameters:
codecs []Codecs - List of codecs to be stripped.
Returns:
ParametrosOption - A function that applies the codec strip flags to the RequestRtp structure.
Example usage:
req.SetCodecStrip([]Codecs{"PCMU", "PCMA"})
func (*RequestRtp) SetFlags ¶
func (c *RequestRtp) SetFlags(flags []ParamFlags) ParametrosOption
SetFlags adds a list of flags to the RTP request. This function receives a slice of ParamFlags and appends them to the Flags field of ParamsOptStringArray in the RequestRtp structure. These flags are used to customize the behavior of the RTP engine during SDP negotiation.
Parameters:
flags []ParamFlags - List of flags to be added.
Returns:
ParametrosOption - A function that applies the flags to the RequestRtp structure.
Example usage:
req.SetFlags([]ParamFlags{"flag1", "flag2"})
func (*RequestRtp) SetMediaAddress ¶
func (c *RequestRtp) SetMediaAddress(Address string) ParametrosOption
SetMediaAddress sets the media address for the RTP request. This function assigns the provided IP address string to the MediaAddress field of the RequestRtp structure. The media address is used to specify the destination IP address for media streams in the SDP negotiation.
Parameters:
Address string - The IP address to be set as the media address.
Returns:
ParametrosOption - A function that applies the media address to the RequestRtp structure.
Example usage:
req.SetMediaAddress("192.168.1.200")
func (*RequestRtp) SetMohFile ¶ added in v1.0.0
func (c *RequestRtp) SetMohFile(file string) ParametrosOption
SetMohFile adds a Music On Hold (MOH) file to the RTP request. This function appends a ParamMoh struct with the specified file and "sendonly" mode to the Moh field of the RequestRtp structure. It is used to configure the RTP engine to play a specific audio file as music on hold during the session.
Parameters:
file string - The path or name of the MOH audio file to be played.
Returns:
ParametrosOption - A function that applies the MOH file configuration to the RequestRtp structure.
Example usage:
req.SetMohFile("holdmusic.wav")
func (*RequestRtp) SetPtimeCodecAnswer ¶
func (c *RequestRtp) SetPtimeCodecAnswer(ptime int) ParametrosOption
SetPtimeCodecAnswer sets the ptime value for the codec in the SDP answer. This function assigns the provided integer value to the PtimeReverse field of the RequestRtp structure. The ptime parameter defines the packetization time (in milliseconds) for the codec in the answer, which can be used to control the duration of audio frames in RTP packets.
Parameters:
ptime int - The packetization time value to be set.
Returns:
ParametrosOption - A function that applies the ptime value to the RequestRtp structure.
Example usage:
req.SetPtimeCodecAnswer(20)
func (*RequestRtp) SetPtimeCodecOffer ¶
func (c *RequestRtp) SetPtimeCodecOffer(ptime int) ParametrosOption
SetPtimeCodecOffer sets the ptime value for the codec in the SDP offer. This function assigns the provided integer value to the Ptime field of the RequestRtp structure. The ptime parameter defines the packetization time (in milliseconds) for the codec in the offer, which can be used to control the duration of audio frames in RTP packets.
Parameters:
ptime int - The packetization time value to be set.
Returns:
ParametrosOption - A function that applies the ptime value to the RequestRtp structure.
Example usage:
req.SetPtimeCodecOffer(20)
func (*RequestRtp) SetReceivedFrom ¶
func (c *RequestRtp) SetReceivedFrom(addressFamily AddressFamily, Address string) ParametrosOption
SetReceivedFrom adds the received-from attribute to the RTP request. This function is used when SDP addresses are not reliable. It receives the address family and address, and appends them to the ReceivedFrom field of the RequestRtp structure.
Parameters:
addressFamily AddressFamily - The address family (e.g., "ipv4", "ipv6"). Address string - The IP address to be set.
Returns:
ParametrosOption - A function that applies the received-from attribute to the RequestRtp structure.
Example usage:
req.SetReceivedFrom(ipv4, "192.168.1.100")
func (*RequestRtp) SetReplace ¶
func (c *RequestRtp) SetReplace(replace []ParamReplace) ParametrosOption
SetReplace sets the list of SDP parameters to be replaced in the RTP request. This function receives a slice of ParamReplace and assigns it to the Replace field of the RequestRtp structure. These parameters specify which SDP attributes should be replaced during the negotiation process.
Parameters:
replace []ParamReplace - List of SDP parameters to be replaced.
Returns:
ParametrosOption - A function that applies the replace parameters to the RequestRtp structure.
Example usage:
req.SetReplace([]ParamReplace{"origin", "session"})
func (*RequestRtp) SetRtcpMux ¶
func (c *RequestRtp) SetRtcpMux(rtcpmux []ParamRTCPMux) ParametrosOption
SetRtcpMux sets the RTCP multiplexing options for the RTP request. This function receives a slice of ParamRTCPMux and assigns it to the RtcpMux field of the RequestRtp structure. These options control how RTCP packets are multiplexed with RTP.
Parameters:
rtcpmux []ParamRTCPMux - List of RTCP multiplexing options to be set.
Returns:
ParametrosOption - A function that applies the RTCP multiplexing options to the RequestRtp structure.
Example usage:
req.SetRtcpMux([]ParamRTCPMux{"demux"})
func (*RequestRtp) SetTransportProtocol ¶
func (c *RequestRtp) SetTransportProtocol(proto TransportProtocol) ParametrosOption
SetTransportProtocol sets the transport protocol for the RTP request. This function receives a TransportProtocol value and assigns it to the TransportProtocol field of the RequestRtp structure. The transport protocol determines how RTP packets are transmitted (e.g., RTP/AVP, RTP/SAVP, UDP/TLS/RTP/SAVP).
Parameters:
proto TransportProtocol - The transport protocol to be set.
Returns:
ParametrosOption - A function that applies the transport protocol to the RequestRtp structure.
Example usage:
req.SetTransportProtocol("RTP/AVP")
func (*RequestRtp) SetViaBranchTag ¶
func (c *RequestRtp) SetViaBranchTag(branch string) ParametrosOption
SetViaBranchTag sets the Via branch tag for the RTP request. This function assigns the provided branch string to the ViaBranch field of the RequestRtp structure. The Via branch tag is used to uniquely identify SIP transactions and is important for proper routing and correlation of SIP messages.
Parameters:
branch string - The branch tag to be set.
Returns:
ParametrosOption - A function that applies the Via branch tag to the RequestRtp structure.
Example usage:
req.SetViaBranchTag("z9hG4bK-branchvalue")
type ResponseRtp ¶
type ResponseRtp struct {
Result string `json:"result" bencode:"result"`
Sdp string `json:"sdp,omitempty" bencode:"sdp,omitempty"`
ErrorReason string `json:"error-reason,omitempty" bencode:"error-reason,omitempty"`
Warning string `json:"warning,omitempty" bencode:"warning,omitempty"`
Created int `json:"created,omitempty" bencode:"created,omitempty"`
CreatedUs int `json:"created_us,omitempty" bencode:"created_us,omitempty"`
LastSignal int `json:"last signal,omitempty" bencode:"last signal,omitempty"`
LastRedisUpdate int `json:"last redis update,omitempty" bencode:"last redis update,omitempty"`
SSRC interface{} `json:"SSRC,omitempty" bencode:"SSRC,omitempty"`
Tags interface{} `json:"tags,omitempty" bencode:"tags,omitempty"`
FromTag string `json:"from-tag,omitempty" bencode:"from-tag,omitempty"`
FromTags []string `json:"from-tags,omitempty" bencode:"from-tags,omitempty"`
ToTag string `json:"to-tag,omitempty" bencode:"to-tag,omitempty"`
Totals TotalRTP `json:"totals,omitempty" bencode:"totals,omitempty"`
}
ResponseRtp represents the response structure from the RTP engine. It contains information about the result of the RTP operation, including the SDP, error and warning messages, timestamps, SSRC, tags, and other metadata related to RTP processing. All fields are annotated for both JSON and Bencode serialization.
Fields:
Result string - The result status of the RTP operation.
Sdp string - The Session Description Protocol (SDP) data.
ErrorReason string - Error reason message, if any.
Warning string - Warning message, if any.
Created int - Timestamp when the response was created.
CreatedUs int - Microsecond timestamp of creation.
LastSignal int - Timestamp of the last signal.
LastRedisUpdate int - Timestamp of the last Redis update.
SSRC interface{} - Synchronization source identifier(s).
Tags interface{} - Additional tags or metadata.
FromTag string - SIP from-tag value.
FromTags []string - List of SIP from-tag values.
ToTag string - SIP to-tag value.
Totals TotalRTP - RTP and RTCP statistics for the session.
func DecodeResposta ¶
func DecodeResposta(cookie string, resposta []byte) *ResponseRtp
DecodeResposta decodes the response from the RTP engine and validates the cookie. It parses the bencoded response and maps it to the ResponseRtp struct.
Parameters:
cookie - the expected cookie string. resposta - the raw response bytes from the RTP engine.
Returns:
*ResponseRtp - the decoded response with result and error information.
type SDES ¶
type SDES string
SDES defines the available modes and options for handling SDES (Session Description Protocol Security Descriptions) in RTP engine operations. SDES is used to negotiate SRTP (Secure Real-time Transport Protocol) parameters through SDP, enabling secure media transmission.
const ( // SDESOff disables SDES processing. SDESOff SDES = "off" // SDESNo indicates that SDES is not used for the session. SDESNo SDES = "no" // SDESDisable disables SDES negotiation and related attributes. SDESDisable SDES = "disable" // SDESNonew prevents generation of new SDES parameters. SDESNonew SDES = "nonew" // SDESPad adds padding to SDES crypto attributes. SDESPad SDES = "pad" // SDESStatic uses static SDES keys instead of dynamically generated ones. SDESStatic SDES = "static" // SDESPrefer prioritizes SDES over other key exchange mechanisms. SDESPrefer SDES = "prefer" // SDESUnencrypted_srtp allows unencrypted SRTP streams. SDESUnencrypted_srtp SDES = "unencrypted_srtp" // SDESUnencrypted_srtcp allows unencrypted SRTCP streams. SDESUnencrypted_srtcp SDES = "unencrypted_srtcp" // SDESUnauthenticated_srtp allows SRTP without authentication. SDESUnauthenticated_srtp SDES = "unauthenticated_srtp" // SDESEncrypted_srtp enables encrypted SRTP streams. SDESEncrypted_srtp SDES = "encrypted_srtp" // SDESEncrypted_srtcp enables encrypted SRTCP streams. SDESEncrypted_srtcp SDES = "encrypted_srtcp" // SDESAuthenticated_srtp enables authenticated SRTP streams. SDESAuthenticated_srtp SDES = "authenticated_srtp" // SDESNo* flags disable specific crypto suites from being used in SDES negotiation. SDESNoAEAD_AES_256_GCM SDES = "no-AEAD_AES_256_GCM" SDESNoAEAD_AES_128_GCM SDES = "no-AEAD_AES_128_GCM" SDESNoAES_256_CM_HMAC_SHA1_80 SDES = "no-AES_256_CM_HMAC_SHA1_80" SDESNoAES_256_CM_HMAC_SHA1_32 SDES = "no-AES_256_CM_HMAC_SHA1_32" SDESNoAES_192_CM_HMAC_SHA1_80 SDES = "no-AES_192_CM_HMAC_SHA1_80" SDESNoAES_192_CM_HMAC_SHA1_32 SDES = "no-AES_192_CM_HMAC_SHA1_32" SDESNoAES_CM_128_HMAC_SHA1_80 SDES = "no-AES_CM_128_HMAC_SHA1_80" SDESNoAES_CM_128_HMAC_SHA1_32 SDES = "no-AES_CM_128_HMAC_SHA1_32" SDESNoF8_128_HMAC_SHA1_80 SDES = "no-F8_128_HMAC_SHA1_80" SDESNoF8_128_HMAC_SHA1_32 SDES = "no-F8_128_HMAC_SHA1_32" SDESNoNULL_HMAC_SHA1_80 SDES = "no-NULL_HMAC_SHA1_80" SDESNoNULL_HMAC_SHA1_32 SDES = "no-NULL_HMAC_SHA1_32" // SDESOnly* flags restrict SDES negotiation to specific crypto suites only. SDESOnlyAEAD_AES_256_GCM SDES = "only-AEAD_AES_256_GCM" SDESOnlyAEAD_AES_128_GCM SDES = "only-AEAD_AES_128_GCM" SDESOnlyAES_256_CM_HMAC_SHA1_80 SDES = "only-AES_256_CM_HMAC_SHA1_80" SDESOnlyAES_256_CM_HMAC_SHA1_32 SDES = "only-AES_256_CM_HMAC_SHA1_32" SDESOnlyAES_192_CM_HMAC_SHA1_80 SDES = "only-AES_192_CM_HMAC_SHA1_80" SDESOnlyAES_192_CM_HMAC_SHA1_32 SDES = "only-AES_192_CM_HMAC_SHA1_32" SDESOnlyAES_CM_128_HMAC_SHA1_80 SDES = "only-AES_CM_128_HMAC_SHA1_80" SDESOnlyAES_CM_128_HMAC_SHA1_32 SDES = "only-AES_CM_128_HMAC_SHA1_32" SDESOnlyF8_128_HMAC_SHA1_80 SDES = "only-F8_128_HMAC_SHA1_80" SDESOnlyF8_128_HMAC_SHA1_32 SDES = "only-F8_128_HMAC_SHA1_32" SDESOnlyNULL_HMAC_SHA1_80 SDES = "only-NULL_HMAC_SHA1_80" SDESOnlyNULL_HMAC_SHA1_32 SDES = "only-NULL_HMAC_SHA1_32" )
type TotalRTP ¶
type TotalRTP struct {
Rtp ValuesRTP `json:"RTP,omitempty" bencode:"RTP,omitempty"`
Rtcp ValuesRTP `json:"RCTP,omitempty" bencode:"RTP,omitempty"`
}
TotalRTP represents the total RTP and RTCP statistics for a session. It contains two fields, Rtp and Rtcp, each of type ValuesRTP, which hold packet, byte, and error counts for RTP and RTCP streams respectively. The struct is annotated for both JSON and Bencode serialization.
Fields:
Rtp ValuesRTP `json:"RTP,omitempty" bencode:"RTP,omitempty"` - RTP stream statistics. Rtcp ValuesRTP `json:"RCTP,omitempty" bencode:"RTP,omitempty"` - RTCP stream statistics.
type TransportProtocol ¶
type TransportProtocol string
TransportProtocol defines the supported transport protocols for RTP communication.
const ( // RTP_AVP represents the standard RTP Audio/Video Profile. RTP_AVP TransportProtocol = "RTP/AVP" // RTP_SAVP represents the Secure RTP Audio/Video Profile using SRTP. RTP_SAVP TransportProtocol = "RTP/SAVP" // RTP_AVPF represents the RTP Audio/Video Profile with Feedback. RTP_AVPF TransportProtocol = "RTP/AVPF" // RTP_SAVPF represents the Secure RTP Audio/Video Profile with Feedback using SRTP. RTP_SAVPF TransportProtocol = "RTP/SAVPF" // UDP_TLS_RTP_SAVP represents RTP over UDP with TLS encryption using the Secure Audio/Video Profile. UDP_TLS_RTP_SAVP TransportProtocol = "UDP/TLS/RTP/SAVP" // UDP_TLS_RTP_SAVPF represents RTP over UDP with TLS encryption using the Secure Audio/Video Profile with Feedback. UDP_TLS_RTP_SAVPF TransportProtocol = "UDP/TLS/RTP/SAVPF" )
type TypeCommands ¶ added in v1.0.0
type TypeCommands string
TypeCommands defines the set of supported command types for RTP engine operations.
const ( // Ping is used to check the availability or responsiveness of the RTP engine. Ping TypeCommands = "ping" // Offer initiates a media session by sending an SDP offer to the RTP engine. Offer TypeCommands = "offer" // Answer responds to an SDP offer to establish a media session. Answer TypeCommands = "answer" // Delete terminates an existing media session. Delete TypeCommands = "delete" // Query retrieves information about an existing media session. Query TypeCommands = "query" // List returns a list of all active media sessions. List TypeCommands = "list" // StartRecording begins recording the media stream of a session. StartRecording TypeCommands = "start recording" // StopRecording stops the ongoing media recording of a session. StopRecording TypeCommands = "stop recording" // PauseRecording temporarily pauses the media recording of a session. PauseRecording TypeCommands = "pause recording" // BlockDTMF blocks DTMF (Dual-tone multi-frequency) signals in a media session. BlockDTMF TypeCommands = "block DTMF" // UnblockDTMF allows DTMF signals in a media session. UnblockDTMF TypeCommands = "unblock DTMF" // BlockMedia blocks media transmission in a session. BlockMedia TypeCommands = "block media" // UnblockMedia resumes media transmission in a session. UnblockMedia TypeCommands = "unblock media" // SilenceMedia mutes the media stream in a session. SilenceMedia TypeCommands = "silence media" // UnsilenceMedia unmutes the media stream in a session. UnsilenceMedia TypeCommands = "unsilence media" // StartForwarding begins forwarding media to a specified destination. StartForwarding TypeCommands = "start forwarding" // StopForwarding stops forwarding media to a specified destination. StopForwarding TypeCommands = "stop forwarding" // PlayMedia plays a media file into the session. PlayMedia TypeCommands = "play media" // StopMedia stops the playback of a media file in the session. StopMedia TypeCommands = "stop media" // PlayDTMF sends a DTMF tone into the media session. PlayDTMF TypeCommands = "play DTMF" // Statistics retrieves performance and usage statistics from the RTP engine. Statistics TypeCommands = "statistics" // Publish sends media stream information to the RTP engine for distribution. Publish TypeCommands = "publish" // SubscribeRequest initiates a subscription request for media stream updates. SubscribeRequest TypeCommands = "subscribe request" // SubscribeAnswer responds to a subscription request for media stream updates. SubscribeAnswer TypeCommands = "subscribe answer" // Unsubscribe cancels an existing media stream subscription. Unsubscribe TypeCommands = "unsubscribe" // Connect establishes a connection between media endpoints. Connect TypeCommands = "connect" )
type ValuesRTP ¶
type ValuesRTP struct {
Packets int `json:"packets,omitempty" bencode:"packets,omitempty"`
Bytes int `json:"bytes,omitempty" bencode:"bytes,omitempty"`
Errors int `json:"errors,omitempty" bencode:"errors,omitempty"`
}
ValuesRTP represents RTP or RTCP stream statistics for a session. It contains the number of packets, bytes, and errors for the stream. The struct is annotated for both JSON and Bencode serialization.
Fields:
Packets int - The number of RTP/RTCP packets. Bytes int - The total number of bytes transmitted. Errors int - The number of errors encountered.