v1.x to v2.0 Migration

This page covers breaking changes introduced in v2.0.0 (released 2025-02-07). The last v1.x release was v1.7.2 (2024-08-08).

Platform Scope

Most breaking changes in v2.0.0 affect the JavaScript SDK only. Native (iOS/Android) breaking changes are called out explicitly.

Chat API Deprecation

The Chat API is deprecated and will be removed in a future release. Chat-related breaking changes (e.g. ChannelType renamed to MemberChannelType, MemberChannelType PascalCase keys, deprecated Chat function signatures removed) are not documented here. Do not build new applications using the Chat API.

Version Mapping

v1.x (last) v2.x (first)
1.7.2 2.0.0

Enum Key Renames (JS)

All enum keys changed from their v1.x casing to PascalCase. The underlying values are unchanged — only the keys you use to access them differ.

HangupReason

v1.x Key v2.0 Key Value (unchanged)
REMOTE_HANGUP RemoteHangup 'REMOTE_HANGUP'
REMOTE_REJECT RemoteReject 'REMOTE_REJECT'
REMOTE_NO_ANSWER_TIMEOUT RemoteNoAnswerTimeout 'REMOTE_NO_ANSWER_TIMEOUT'
LOCAL_HANGUP LocalHangup 'LOCAL_HANGUP'
MEDIA_TIMEOUT MediaTimeout 'MEDIA_TIMEOUT'

LegStatus

v1.x Key v2.0 Key Value (unchanged)
RINGING Ringing 'RINGING'
ANSWERED Answered 'ANSWERED'
COMPLETED Completed 'COMPLETED'

CallDisconnectReason

v1.x Key v2.0 Key Value (unchanged)
networkChange NetworkChange 'networkChange'

CancelReason

Keys were already PascalCase in v1.x — no change required.

Key Value
RemoteCancel 'RemoteCancel'
RejectedElsewhere 'RejectedElsewhere'
RemoteTimeout 'RemoteTimeout'
AnsweredElsewhere 'AnsweredElsewhere'

VoiceChannelType

v1.x Key v2.0 Key Value (unchanged)
app App 'app'
phone Phone 'phone'
sip Sip 'sip'
websocket Websocket 'websocket'

VonageErrorType

v1.x Key v2.0 Key Value (unchanged)
CS_ERROR CsError 'CS_ERROR'
SESSION_ERROR SessionError 'SESSION_ERROR'
NETWORK_ERROR NetworkError 'NETWORK_ERROR'
INTERNAL_ERROR InternalError 'INTERNAL_ERROR'
UNKNOWN_ERROR UnknownError 'UNKNOWN_ERROR'

SessionErrorReason

v1.x Key v2.0 Key Value (unchanged)
TRANSPORT_CLOSED TransportClosed 'TRANSPORT_CLOSED'
PING_TIMEOUT PingTimeout 'PING_TIMEOUT'
EXPIRED_TOKEN ExpiredToken 'EXPIRED_TOKEN'

Example

// v1.x
if (reason === HangupReason.REMOTE_HANGUP) { /* ... */ }
if (error.type === VonageErrorType.CS_ERROR) { /* ... */ }
if (channel === VoiceChannelType.app) { /* ... */ }

// v2.0
if (reason === HangupReason.RemoteHangup) { /* ... */ }
if (error.type === VonageErrorType.CsError) { /* ... */ }
if (channel === VoiceChannelType.App) { /* ... */ }

CSErrorCodes & SessionErrorCodes: Object to Enum (JS)

In v1.x, CSErrorCodes and SessionErrorCodes were re-exports of Kotlin objects with SCREAMING_SNAKE_CASE getter properties. In v2.0, they are proper TypeScript enum-style const objects with PascalCase keys, consistent with all other SDK enums.

CSErrorCodes

v1.x Key v2.0 Key Value (unchanged)
CONVERSATION_DUPLICATE_NAME ConversationDuplicateName 'CONVERSATION_DUPLICATE_NAME'
MEMBER_ALREADY_JOINED MemberAlreadyJoined 'MEMBER_ALREADY_JOINED'
MEMBER_ALREADY_INVITED MemberAlreadyInvited 'MEMBER_ALREADY_INVITED'
CONVERSATION_NOT_FOUND ConversationNotFound 'CONVERSATION_NOT_FOUND'
MEMBER_NOT_FOUND MemberNotFound 'MEMBER_NOT_FOUND'
USER_NOT_FOUND UserNotFound 'USER_NOT_FOUND'
INVALID_CURSOR InvalidCursor 'INVALID_CURSOR'
VALIDATION_FAIL ValidationFail 'VALIDATION_FAIL'
CONVERSATION_MAX_NUMBER_OF_MEMBERS ConversationMaxNumberOfMembers 'CONVERSATION_MAX_NUMBER_OF_MEMBERS'
CUSTOM_DATA_OVERALL_LIMIT_EXCEEDED CustomDataOverallLimitExceeded 'CUSTOM_DATA_OVERALL_LIMIT_EXCEEDED'

SessionErrorCodes

v1.x Key v2.0 Key Value (unchanged)
TIMEOUT Timeout 'TIMEOUT'
EXPIRED_TOKEN ExpiredToken 'EXPIRED_TOKEN'
EMPTY_TOKEN EmptyToken 'EMPTY_TOKEN'
FORCED_DISCONNECT ForcedDisconnect 'FORCED_DISCONNECT'
INTERNAL_FAILURE InternalFailure 'INTERNAL_FAILURE'
NO_ACTIVE_SESSION NoActiveSession 'NO_ACTIVE_SESSION'
ALREADY_ACTIVE_SESSION AlreadyActiveSession 'ALREADY_ACTIVE_SESSION'
INVALID_TOKEN InvalidToken 'INVALID_TOKEN'
INVALID_USER InvalidUser 'INVALID_USER'
AUTHORIZATION_ERROR AuthorizationError 'AUTHORIZATION_ERROR'
INVALID_SESSION InvalidSession 'INVALID_SESSION'
MAX_OPEN_SESSIONS MaxOpenSessions 'MAX_OPEN_SESSIONS'
INVALID_SOCKET_TRANSPORT InvalidSocketTransport 'INVALID_SOCKET_TRANSPORT'
CLIENT_DISCONNECT ClientDisconnect 'CLIENT_DISCONNECT'
PING_TIMEOUT_DISCONNECT PingTimeoutDisconnect 'PING_TIMEOUT_DISCONNECT'
TRANSPORT_CLOSED_DISCONNECT TransportClosedDisconnect 'TRANSPORT_CLOSED_DISCONNECT'

Example

// v1.x (Kotlin object re-export with SCREAMING_SNAKE getters)
if (code === CSErrorCodes.CONVERSATION_NOT_FOUND) { /* ... */ }
if (code === SessionErrorCodes.EXPIRED_TOKEN) { /* ... */ }

// v2.0 (TypeScript enum-style const object with PascalCase keys)
if (code === CSErrorCodes.ConversationNotFound) { /* ... */ }
if (code === SessionErrorCodes.ExpiredToken) { /* ... */ }

Removed Deprecated Functions

Logging Functions (All Platforms)

Removed Function Platform
setDefaultLoggingLevel() All
setVonageClientLoggingLevel() JS

Set the logging level at client initialization instead. See Logging and diagnostics for configuration details and examples.

Push Token Registration (iOS)

Removed Function Replacement
registerDevicePushToken() registerDeviceVoipToken()

Fixed Types (JS)

These are bug fixes but may break code that was working around the previous incorrect types:

  • VonageError.type — previously exposed a mangled Kotlin type string; now returns a proper VonageErrorType union string
  • on('sessionError') callback reason — previously exposed a mangled Kotlin type string; now returns a proper SessionErrorReason union string

If your code was comparing these against raw strings or handling the mangled output, update it to use the enum objects:

// v2.0 — correct usage
client.on('sessionError', (reason) => {
  if (reason === SessionErrorReason.ExpiredToken) {
    // refresh token
  }
});

Kotlin 2.0.0 Upgrade

The core library was updated from Kotlin 1.9.x to Kotlin 2.0.0 (with 1.9.21 API compatibility). If you consume the Android SDK and have Kotlin version constraints in your Gradle build, ensure they are compatible with Kotlin 2.0.0.