Headers

class sipmessage.Address(uri: ~sipmessage.uri.URI, name: str = '', parameters: ~sipmessage.parameters.Parameters = <factory>)

An address as used in Contact, From, Reply-To and To headers.

name: str = ''

The display name of the address.

parameters: Parameters

The parameters of the address.

classmethod parse(value: str) Address

Parse the given string into an Address instance.

If parsing fails, a ValueError is raised.

classmethod parse_many(value: str) list[Address]

Parse the given string into a list of Address instances.

If parsing fails, a ValueError is raised.

uri: URI

The URI of the address.

class sipmessage.AuthChallenge(scheme: str, parameters: ~sipmessage.auth.AuthParameters = <factory>)

A WWW-Authenticate or Proxy-Authenticate header, used to convey an authentication challenge.

parameters: AuthParameters

The authentication parameters.

classmethod parse(value: str) AuthChallenge

Parse the given string into an AuthChallenge instance.

If parsing fails, a ValueError is raised.

scheme: str

The authentication scheme, e.g. “Digest”.

class sipmessage.AuthCredentials(scheme: str, parameters: AuthParameters | None = None, token: str | None = None)

An Authorization, Proxy-Authorization header, used to convey authentication credentials.

parameters: AuthParameters | None = None

The authentication parameters.

classmethod parse(value: str) AuthCredentials

Parse the given string into an AuthCredentials instance.

If parsing fails, a ValueError is raised.

scheme: str

The authentication scheme, e.g. “Digest”.

token: str | None = None

The authentication token.

class sipmessage.AuthParameters(**kwargs: str)

A mapping of AuthChallenge or AuthCredentials parameters.

classmethod parse(value: str) AuthParameters

Parse the given string into a AuthParameters instance.

If parsing fails, a ValueError is raised.

replace(**changes: str) AuthParameters

Return a copy of the parameters, updated with the given changes.

class sipmessage.CSeq(sequence: int, method: str)

A CSeq header, used to identity and order transactions.

method: str

The request method.

classmethod parse(value: str) CSeq

Parse the given string into an CSeq instance.

If parsing fails, a ValueError is raised.

sequence: int

The sequence number.

class sipmessage.MediaType(mime_type: str, parameters: ~sipmessage.parameters.Parameters = <factory>)

A media type as used in Accept and Content-Type headers.

mime_type: str

The MIME type, e.g. application/sdp.

parameters: Parameters

The parameters of the media type.

classmethod parse(value: str) MediaType

Parse the given string into a MediaType instance.

If parsing fails, a ValueError is raised.

classmethod parse_many(value: str) list[MediaType]

Parse the given string into a list of MediaType instances.

If parsing fails, a ValueError is raised.

class sipmessage.Parameters(**kwargs: str | None)

A mapping of Address, MediaType, URI or Via parameters.

classmethod parse(value: str) Parameters

Parse the given string into a Parameters instance.

If parsing fails, a ValueError is raised.

replace(**changes: str | None) Parameters

Return a copy of the parameters, updated with the given changes.

class sipmessage.URI(scheme: str, host: str, user: str | None = None, password: str | None = None, port: int | None = None, parameters: ~sipmessage.parameters.Parameters = <factory>)

A SIP, SIPS or TEL URI as described by RFC3261 and RFC3966.

property global_phone_number: str | None

The global phone number (E.164) of this URI, if described by the URI.

This is one of the possibilities for the userinfo part described in RFC3261, with telephone-subscriber in RFC2806:

> userinfo = user | telephone-subscriber > telephone-subscriber = global-phone-number | local-phone-number

The phone number is returned without any visual separators.

host: str

The host providing the SIP resource.

parameters: Parameters

Parameters affecting a request constructed from the URI.

classmethod parse(value: str) URI

Parse the given string into a URI instance.

If parsing fails, a ValueError is raised.

password: str | None = None

A password associated with the user.

port: int | None = None

The port number where the request is to be sent.

scheme: str

The URI scheme specifier.

user: str | None = None

The identifier of a particular resource at the host being addressed.

class sipmessage.Via(transport: str, host: str, port: int | None = None, parameters: ~sipmessage.parameters.Parameters = <factory>)

A Via header, indicating a reponse location for a transaction.

host: str

The host to which responses should to be sent.

parameters: Parameters

The parameters of the address.

classmethod parse(value: str) Via

Parse the given string into a Via instance.

If parsing fails, a ValueError is raised.

classmethod parse_many(value: str) list[Via]

Parse the given string into a list of Via instances.

If parsing fails, a ValueError is raised.

port: int | None = None

The port to which responses should to be sent.

transport: str

The transport for the transaction, e.g “UDP”, “TCP”, “TLS”.