Dialog layer

class sipua.DialogLayer(transaction_layer: TransactionLayer)

SIP transaction layer.

See RFC 3261 Section 12.

request_handler: Callable[[Request], Coroutine[None, None, None]] | None

A coroutine which will be called whenever a request is received which does not match an existing dialog.

class sipua.Dialog(*, call_id: str, dialog_layer: DialogLayer, local_address: Address, remote_address: Address, remote_uri: URI, route_set: list[Address] = [])

A SIP dialog, representing a peer-to-peer SIP relationship between two user agents that persists for some time.

See RFC 3261 Section 12.

create_request(method: str) Request

Create a new request for this dialog.

create_response(request: Request, code: int) Response

Create a response to the given request.

classmethod create_uac(*, dialog_layer: DialogLayer, local_address: Address, remote_address: Address, route_set: list[Address] = [], **kwargs: object) T

Create a client dialog.

The initial request will neeed to be constructed using create_request().

classmethod create_uas(*, dialog_layer: DialogLayer, request: Request, **kwargs: object) T

Create a server dialog based on a received request.

async handle_request(request: Request) None

Handle a request for this dialog.

This needs to be overriden as the base implementation replies with a “Not Implemented” error.

async send_request(request: Request) Response

Send the request in a transaction and return the final response.

async send_response(response: Response) None

Send the response.