sip/sdp library

Tiny SDP helper — only what the SIP UA needs to negotiate G.711 audio (and optional VP8 video) against dart-pbx. Not a full RFC 4566 parser.

Classes

SdpAudio
SdpOffer
Bundle returned by parseSdp — either or both media sections may be null.
SdpVideo

Enums

SdpDirection
Direction attribute (RFC 4566 §6).
SdpVideoCodec
Video codecs we understand for SDP negotiation.

Functions

buildAvOffer({required String username, required String localHost, required int audioPort, int? videoPort, G711Variant audioPreferred = G711Variant.pcmu, G711Variant? audioSecond = G711Variant.pcma, int? audioRtcpPort, int? telephoneEventPt = 101, String telephoneEventRange = '0-15', int videoPayloadType = 96, SdpVideoCodec videoCodec = SdpVideoCodec.vp8, int? videoRtcpPort, SdpDirection direction = SdpDirection.sendrecv, int? sessionId, int? sessionVersion}) String
Build an audio+video SDP offer/answer. Audio uses the same defaults as buildG711Offer; video advertises VP8 on PT 96 by default.
buildG711Answer({required String username, required String localHost, required int localPort, required SdpAudio remoteOffer, int? rtcpPort, SdpDirection direction = SdpDirection.sendrecv, int? sessionId, int? sessionVersion}) String
Build an SDP answer for a G.711 audio offer, per RFC 3264 §6.
buildG711Offer({required String username, required String localHost, required int localPort, G711Variant preferred = G711Variant.pcmu, G711Variant? second = G711Variant.pcma, int? rtcpPort, int? telephoneEventPt = 101, String telephoneEventRange = '0-15', SdpDirection direction = SdpDirection.sendrecv, int? sessionId, int? sessionVersion}) String
Build a minimal SDP offer/answer for a G.711 audio session.
parseSdp(String sdp) SdpOffer
Parse a full SDP body into its audio + optional video section. Reuses parseSdpAudio internally for the audio half so all the existing code paths keep working.
parseSdpAudio(String sdp) SdpAudio?
Parse the remote audio endpoint from an SDP body. Returns null if the body has no audio media line we can use.