CallIdConfig

A configuration for the CallId plugin.

Constructors

Link copied to clipboard

Functions

Link copied to clipboard

Allows you to generate a call ID if an incoming request doesn't include it. Generates null if it is impossible to generate a call ID for some reason.

Link copied to clipboard
fun header(headerName: String)

Allows you to retrieve a call ID and send it in the same header.

Link copied to clipboard
fun reply(block: (call: ApplicationCall, CallId: String) -> Unit)

Allows you to reply with a retrieved or generated call ID by modifying an ApplicationCall.

Link copied to clipboard
fun replyToHeader(headerName: String)

Replies with a call ID using a specified header named headerName.

Link copied to clipboard

Allows you to retrieve a call ID from ApplicationCall. Returns null if no call ID is found in a request.

Link copied to clipboard
fun retrieveFromHeader(headerName: String)

Retrieves a call ID from a specified request header named headerName.

Link copied to clipboard
fun verify(predicate: CallIdVerifier)

Verifies a retrieved or generated call ID. The code below verifies that a call ID is not an empty string:

fun verify(dictionary: String, reject: Boolean = false)

Verifies a retrieved or generated call ID against the specified dictionary. Rejects an ApplicationCall if reject is true; otherwise, an illegal call ID is ignored.

Extensions

Link copied to clipboard
fun CallIdConfig.generate(length: Int = 64, dictionary: String = CALL_ID_DEFAULT_DICTIONARY)

Generates a fixed length call ID using the specified dictionary. Note that this function generates pseudo-random identifiers via regular java.util.Random and should not be considered as cryptographically secure. Also note that you need to use the same dictionary for CallIdVerifier, otherwise a generated call ID could be discarded or may lead to complete call rejection.