Documentation
¶
Overview ¶
Package dialog tracks minimal SIP dialog state for pkg/sip1 (Call-ID, tags, early/confirmed).
It aligns with transaction keys via InviteTransactionKey (branch + Call-ID from the INVITE). It does not parse SDP or touch RTP; use pkg/sip1/session for media.
Index ¶
- func AppendTagAfterNameAddr(header, tag string) string
- func TagFromHeader(header string) string
- type Dialog
- func (d *Dialog) Confirm()
- func (d *Dialog) GetLocalTag() string
- func (d *Dialog) GetRemoteTag() string
- func (d *Dialog) InviteCSeqNum() int
- func (d *Dialog) InviteTransactionKey() string
- func (d *Dialog) MatchACK(ack *stack.Message) bool
- func (d *Dialog) SetLocalTag(tag string)
- func (d *Dialog) SetLocalTagFromToHeader(toHeader string)
- func (d *Dialog) State() State
- func (d *Dialog) Terminate()
- type Registry
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendTagAfterNameAddr ¶
AppendTagAfterNameAddr inserts ;tag=tag immediately after the closing '>' of a name-addr, or appends ;tag=tag when no angle brackets are present. If a tag already exists, header is unchanged.
func TagFromHeader ¶
TagFromHeader extracts the SIP tag parameter from a From or To header value.
Types ¶
type Dialog ¶
type Dialog struct {
CallID string
InviteBranch string // top Via branch of the INVITE; matches transaction layer key
CSeqInvite int // INVITE CSeq number (ACK uses same number with method ACK)
// RemoteTag is typically the peer tag from the INVITE From (caller).
RemoteTag string
// LocalTag is the UAS tag added to To in 1xx/2xx responses.
LocalTag string
// contains filtered or unexported fields
}
Dialog holds minimal identifiers for one SIP dialog (UAS-centric helpers).
func NewUASFromINVITE ¶
NewUASFromINVITE builds dialog state from an inbound INVITE (early). Parses Call-ID, branch, INVITE CSeq, remote From tag.
func (*Dialog) Confirm ¶
func (d *Dialog) Confirm()
Confirm marks the dialog confirmed (e.g. after stable 2xx/ACK path).
func (*Dialog) GetLocalTag ¶
GetLocalTag returns the UAS tag for this dialog (empty before 2xx To is set).
func (*Dialog) GetRemoteTag ¶
GetRemoteTag returns the peer tag parsed from the INVITE From.
func (*Dialog) InviteCSeqNum ¶
InviteCSeqNum returns the CSeq number of the INVITE that created this dialog (ACK uses the same number).
func (*Dialog) InviteTransactionKey ¶
InviteTransactionKey returns the same key used by pkg/sip1/transaction for INVITE server/client maps.
func (*Dialog) MatchACK ¶
MatchACK reports whether ack belongs to this dialog's INVITE (same Call-ID, CSeq number, ACK method, tags when present).
func (*Dialog) SetLocalTag ¶
SetLocalTag records the UAS tag (usually parsed from the To header you generated on 1xx/2xx).
func (*Dialog) SetLocalTagFromToHeader ¶
SetLocalTagFromToHeader extracts ;tag= from a To header value (e.g. your generated 200 OK To).
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry stores dialogs keyed by Call-ID (single dialog per Call-ID for this minimal registry).