Migrating to Libsoftphone 26.1¶
Libsoftphone 26.1 changes SDK termination, audio routing, contact-source types, and account XML updates on iOS.
This guide describes the changes needed when upgrading from 25.3, including source changes for apps using Softphone_Swift or the C++ API.
The API comparison uses 25.3.38 and 26.1.
Start with the iOS integration guide if you are adding the SDK to a new app.
Update the SDK packages¶
Update both Softphone.xcframework and Softphone_Swift.xcframework to the same 26.1 release.
Do not combine a 25.3 bridge with a 26.1 core framework.
Rebuild your app and any extensions that use the SDK after replacing the frameworks.
Video is now included in the standard SaaS SDK instead of requiring a separate video build. Review any dependency or packaging scripts that select separate video and non-video SDK artifacts. Including video support does not replace your application's camera permission handling.
Replace termination calls¶
The old Swift bridge methods terminate() and terminateWithin(...) were removed.
Use requestTermination(within:completionHandler:), retain its returned ResourceHandle2, and finish your shutdown flow from the callback.
The Swift timeout is expressed in seconds.
import Softphone_Swift
private var terminationHandle: ResourceHandle2?
func terminateSoftphone() {
guard let state = SoftphoneBridge.instance().state() else {
return
}
terminationHandle = state.requestTermination(within: 20) {
// Cleanup finished, or the termination timeout was reached.
// Update the application's SDK lifecycle here.
}
}
Important
Retain the handle through completion and for as long as the SDK should remain terminated. Releasing it before completion cancels the request; releasing it after completion respawns the SDK. Do not clear the handle as routine cleanup in the completion handler.
To start SDK processing again after termination completes, explicitly respawn the SDK before releasing the handle:
For C++ integrations, replace State::terminate(...) with State::requestTermination(...) and retain the returned ali::handle2.
The C++ timeout remains in milliseconds; 20'000 means 20 seconds.
Softphone::deinit() was removed and should no longer be called.
Termination ends calls and unregisters SIP accounts asynchronously; it does not delete their saved configuration. For logout, remove the user's accounts before requesting termination. See SDK termination for cancellation, timeout, and restart behavior, and Logging Out for account removal.
Migrate audio routing¶
The previous AudioRouteType enum has been replaced by separate preferred-route and current-route objects.
A route preference describes whether to override output to the speaker; the current route describes the output actually selected by iOS.
| Previous API | Replacement |
|---|---|
AudioRouteType / C++ AudioRoute::Type |
SoftphonePreferredAudioRoute for selection; SoftphoneCurrentAudioRoute for observation. C++ uses PreferredAudioRoute and CurrentAudioRoute. |
setCallAudioRoute(...) with an enum |
Pass a preferred-route object created by Speaker or Default. |
getCallAudioRoute() returning an enum |
Read the returned current-route object's type, iosType, and name. |
getCurrentHardwareAudioRoute() |
Use getCallAudioRoute(). |
onAudioRouteChanged(route) |
Implement the parameterless onAudioRouteChanged() and query the current route. |
C++ getAvailableCallAudioRoutes() and onAudioAvailableRoutesChanged(...) |
Removed; do not maintain a route picker based on the old enum list. |
For example, route selection in Objective-C now uses:
// Override output to the speaker.
[[[SoftphoneBridge instance] audio]
setCallAudioRoute:[SoftphonePreferredAudioRoute Speaker]];
// Remove the speaker override and let iOS choose the default route.
[[[SoftphoneBridge instance] audio]
setCallAudioRoute:[SoftphonePreferredAudioRoute Default]];
Default is not a request for a particular receiver, headset, or Bluetooth device.
Update your controls from the current route after a route-change callback, rather than assuming the requested preference became the active output.
Use iOS route-selection UI when your app needs the user to choose a specific system output device.
Migrate contact-source types¶
Contact sources are now represented by ContactSourceType, imported into Swift from an NS_STRING_ENUM.
Use the exported source constants instead of constructing source names from arbitrary strings.
For example, Objective-C uses ContactSourceTypeAddressBook, ContactSourceTypeGoogle, and ContactSourceTypeOffice365.
| API surface | Required update |
|---|---|
Contacts getSources() |
Handle a collection of ContactSourceType values instead of strings. |
| Source-taking contacts methods | Pass the typed source to lookup, count, enumeration, section, avatar, checksum, synchronization, and auxiliary-data methods. |
| Contact observer callbacks | Change source arguments to ContactSourceType; C++ callbacks use Contacts::ContactSourceType const &. |
BLF addBlf(...) and removeBlf(...) |
Pass a typed contact source. |
contactSources preference |
Supply an array of typed sources instead of a single string. |
| Contact IDs | Swift SoftphoneContactId.source is an optional typed source. C++ ContactId.source is now ali::optional<Contacts::ContactSourceType>. |
For example, an Objective-C observer now implements:
- (void)onContactsChanged:(ContactSourceType)source
{
if ([source isEqualToString:ContactSourceTypeAddressBook]) {
// Refresh the application's address-book view.
}
}
Update source variable types and callback signatures throughout your contacts integration. In C++, check an optional contact ID source before dereferencing it.
Supply account XML node attributes¶
The Swift bridge's AccountXml mutation methods now require NodeAttributes describing the value's source and priority.
This applies to mergeXmlTree, mergeValue, canMergeValue, and removeAll.
For example, Objective-C code changing a value through the application's account editor can use:
// Before
[accountXml mergeValue:@"Example account" forKey:@"title"];
// After
[accountXml mergeValue:@"Example account"
forKey:@"title"
nodeAttributes:[NodeAttributes gui]];
Choose attributes appropriate to the origin of the update.
The bridge provides presets including gui, provisioning, externalProvisioning, system, defaults, and legacy, plus an initializer accepting an explicit source and priority.
Do not mark downloaded provisioning values as GUI edits: source and priority affect which value wins when account XML is merged.
See Mergeable XML.
The registration bridge also adds saveAccountXml(...), accepting AccountXml directly.
Multi-account builds additionally expose saveSingleAccountXml(...), which saves the supplied account and deletes all other accounts with different IDs.
Use that method only when replacing the entire account list with one account is intentional.
Existing tree-taking save methods remain available; use the new overload when you already hold an AccountXml object.
Update subscription callbacks¶
C++ subscription callbacks now use Softphone::Subscription::State instead of Softphone::Subscription::State::Type.
The Swift subscription callback takes SoftphoneSubscriptionStateType instead of the previous SubscriptionStateType enum.
Update observer implementations and replace enum-based checks with the state object's predicates, such as isSubscribed(), isRefreshing(), and isTerminated().
Review Swift optionality¶
Several bridge declarations changed their nullability, which changes the imported Swift signatures. Review compiler errors in your app's wrappers, observer implementations, and tests rather than preserving the old types with forced casts.
In particular:
- Number-rewriting methods require non-optional account IDs.
- Draft lookup and removal require non-optional stream keys.
- Several call-event getters now return non-optional strings, including recording path, location policy, and rewritten transport URI.
- The avatar completion handler receives a non-optional
SoftphoneAssetResultobject. Itsurlanddataproperties remain optional.
Update the affected call sites and remove optional binding only where the new declaration guarantees a value.
Optional: look up pushed calls directly¶
The calls API adds findPushedCall(dialogId:selectorPrefixOrAccountId:).
It looks up an incoming call created from a push notification by dialog ID.
Pass an account ID or selector prefix to restrict the lookup; the Swift bridge also accepts nil to search all accounts.
The result is optional when no matching call exists.
This is an additional lookup API, not a replacement for forwarding push payloads to the SDK or completing your PushKit callbacks. See Handling Push Notifications for Incoming Calls.