Skip to content

Register VoIP Token ​

Registers an iOS VoIP token used for incoming call push delivery. Successful registration returns a deviceId that can be persisted for later token updates or unregister flows.

Signature ​

// Callback versions
func registerVoipToken(
  _ voipToken: Data,
  callback: @escaping (Error?, String?) -> Void
)

func registerVoipToken(
  _ voipToken: Data,
  isSandbox: Bool,
  callback: @escaping (Error?, String?) -> Void
)

// Async versions
func registerVoipToken(
  _ voipToken: Data
) async throws -> String

func registerVoipToken(
  _ voipToken: Data,
  isSandbox: Bool
) async throws -> String

Parameters ​

ParameterTypeRequiredDescription
voipTokenData / NSDataYesVoIP token obtained from PushKit
isSandboxBool / BOOLNoAPNS environment flag (true for sandbox, false for production)

Return Type ​

Returns deviceId in callback/async completion on success.

Usage Example ​

let voipToken: Data = Data() // See https://developer.apple.com/documentation/pushkit/supporting_pushkit_notifications_in_your_app

// Callback
client.registerVoipToken(voipToken) { error, deviceId in
    guard let error = error else {
        print("push registered successfully")
        return
    }
    print("Error in registering push: \(error.localizedDescription)")
}

// Async Await
Task.detached {
    do {
        let voipToken: Data = Data()
        try await client.registerVoipToken(voipToken)
    } catch {
        print("error")
    }
}

Errors ​

Error TypeError CodeDescription
SESSION_ERRORVarious session/auth codesSession/token state is invalid during registration
NETWORK_ERRORinternal:error:serviceNotAvailableNetwork/service failure while registering token
CS_ERRORVarious backend push codesBackend rejected token registration
UNKNOWN_ERRORN/AUnexpected failure

For complete error reference and handling guidelines, see Error Reference.

Notes ​

  • This action is iOS-only and should be called after session creation
  • Persist returned deviceId to support future unregister/update workflows
  • For apps that also need non-VoIP APNS notifications, use combined registration methods on the base client
  • Web does not expose this action; Android uses registerDevicePushToken
  • onCallInvite - Fired when an inbound call invite is received

Built with VitePress.