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
| Parameter | Type | Required | Description |
|---|---|---|---|
voipToken | Data / NSData | Yes | VoIP token obtained from PushKit |
isSandbox | Bool / BOOL | No | APNS 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 Type | Error Code | Description |
|---|---|---|
SESSION_ERROR | Various session/auth codes | Session/token state is invalid during registration |
NETWORK_ERROR | internal:error:serviceNotAvailable | Network/service failure while registering token |
CS_ERROR | Various backend push codes | Backend rejected token registration |
UNKNOWN_ERROR | N/A | Unexpected 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
deviceIdto 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
Related Actions
processCallInvitePushData- Process incoming call invite push payload on iOSregisterDevicePushToken- Register Android push token for incoming call delivery
Related Events
onCallInvite- Fired when an inbound call invite is received