class Configuration

CallId feature’s configuration




CallId feature’s configuration



fun generate(block: CallIdProvider): Unit

block function will be applied when there is no call id retrieved. It should generate a string to be used as call id or null if it is impossible to generate call id for some reason. Note that it should conform to call id verification otherwise it may be discarded or may lead to complete call rejection


fun header(headerName: String): Unit

Setup retrieve/reply cycle via HTTP request and response headers headerName. Identical to retrieveFromHeader and replyToHeader invocations with the same headerName


fun reply(
    block: (call: ApplicationCall, callId: String) -> Unit
): Unit

Replies with retrieved or generated callId. Usually replyToHeader could be used instead.


fun replyToHeader(headerName: String): Unit

Replies retrieved or generated callId using HTTP response header headerName


fun retrieve(block: CallIdProvider): Unit

block will be used to retrieve call id from a call. It should return null if no call id found in request


fun retrieveFromHeader(headerName: String): Unit

Fetch call id from a request header named headerName that is treated as optional


fun verify(predicate: CallIdVerifier): Unit

Verify retrieved or generated call ids using the specified predicate. Should return true for valid call ids, false to ignore an illegal retrieved or generated call id or throw an RejectedCallIdException to reject an ApplicationCall. Only one verify condition could be specified. It is not recommended to disable verification (allow all call id values) as it could be abused so that it may become a security risk. By default there is always the default verifier against CALL_ID_DEFAULT_DICTIONARY so all illegal call ids will be discarded.

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

Verify retrieved or generated call ids against the specified dictionary. Rejects an ApplicationCall if reject is true otherwise an illegal call id will be simply ignored. Only one verify condition or dictionary could be specified

Extension Functions


fun Configuration.generate(
    length: Int = 64,
    dictionary: String = CALL_ID_DEFAULT_DICTIONARY
): Unit

Generates fixed length call ids using the specified dictionary. Please 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 should use the same dictionary for CallIdVerifier otherwise a generated call id could be discarded or may lead to complete call rejection.