callMediaEvents (see Events and states).
Mute
Signature
callId is accepted for symmetry and ignored). Muting while a call is still connecting takes effect as soon as the microphone opens, and the mute survives hold and resume. Each new call starts unmuted. Every change emits a MuteChangedEvent.
Speakerphone
Signature
true routes call audio to the loudspeaker; false routes it back to the earpiece or a connected headset. Each call starts off the loudspeaker.
Audio routes
client.audioRoutes is an AudioRouteController that also handles Bluetooth and wired headsets.
After the last call ends, the SDK resets the route to the earpiece, so a speaker choice doesn’t leak into the next call.
On Android 12 and later, routing to a Bluetooth headset needs the
BLUETOOTH_CONNECT runtime permission. The SDK doesn’t depend on a permission plugin; ask for it with the plugin you already use before you select AudioRoute.bluetooth.
Hold and resume
Signature
hold() puts the connected call on hold with a SIP re-INVITE offering a=sendonly, so the other party hears hold music instead of silence. Your microphone is silenced while the call is held. resume() sends a=sendrecv and brings the call back; the microphone stays muted if you had muted it.
callEvents reports held and then active, and callMediaEvents emits HoldChangedEvent.
Throws StateError when there is no connected call (for hold()) or the call isn’t on hold (for resume()), and VobizException with code hold_failed or resume_failed when the far end refuses. The call then carries on as it was. Only one hold or resume can be in progress at a time.
DTMF
Signature
Throws
ArgumentError for any other character, and StateError when the call isn’t connected. A held call is refused.
Interruptions from other calls
The SDK can’t detect when another app’s call, such as a cellular or WhatsApp call, takes the microphone. Tell it, and it holds the Vobiz call so the other party hears hold music instead of silence:Signature
audioInterruptionEnded resumes the call if audioInterruptionBegan held it and shouldResume is true. A call the user held stays held. Feed it from your audio-session plugin, for example package:audio_session, which reports Android audio-focus loss and iOS AVAudioSession interruptions:
Transfer a call (demo mode)
Signature
Returns the server’s confirmation. Throws
StateError when the call isn’t answered, when not signed in with Zero-Config, or before Vobiz has reported the CallUUID; ArgumentError for a bad target or header; and VobizException (transfer_failed) when the server refuses.
Recordings (demo mode)
makeCall(record: true) asks your Answer URL to record the call. With Zero-Config, the hosted webhook server records it and lists the file:
Signature
waitForRecording polls every interval, up to attempts times, for the recording of the call with callUuid (usually client.lastCallUuid), and returns null if it never arrives. A VobizRecording has recordingId, callUuid, url, durationSecs, endReason, and receivedAt.
On the shared demo server the list is visible to everyone who uses it, so the SDK reads it only with SdkConfig(unsafeDemoZeroConfig: true). In production, receive recordings on your own server with the recording callback of your Answer URL’s VobizXML.
Proximity sensor
client.proximity accepts a ProximityController that turns the screen off when the phone is held to the ear during an earpiece call. The SDK provides the hook; supply the platform code from your app. The default, NoProximityController, does nothing.