Class CallSession
One call, from the system's point of view.
Obtained from Calls.reportIncoming(String, CallHandle, String, boolean) or Calls.reportOutgoing(String, CallHandle, String, boolean), or handed
over already ringing by
com.codename1.call.voip.PushedCall#getSession(). A session is a handle
on a call the operating system knows about; it does not carry audio.
Every method here is a request to the system, and every one of them is
asynchronous because the system can refuse. Acting on a call that has
already ended fails with CallError.INVALID_ID rather than doing nothing,
so a bug in the app's own bookkeeping shows up instead of hiding.
-
Method Summary
Modifier and TypeMethodDescriptionend(CallEndReason reason) Hangs up, and writesreasoninto the system call log.The identifier naming this call everywhere -- here, in the system, and in whatever signalling the app uses.Which way the call was placed.The name shown for the far end, or null.Who is on the other end.getState()Where the call is in its life.groupWith(CallSession other) Puts this call in a conference withother, or takes it out of one whenotheris null.booleanisMuted()Whether the call is muted, as far as the system is concerned.voidTells the system the call is connected.voidreportEndedRemotely(CallEndReason reason) Tells the system the far end ended the call.voidTells the system the outgoing call has begun connecting -- the far end is being rung.sendDigits(String digits) Sends DTMF digits through the system.setHeld(boolean held) Holds or resumes the call.setMuted(boolean value) Mutes or unmutes the call in the system UI.voidupdate(CallHandle newHandle, String newDisplayName) Changes what the system shows for this call.
-
Method Details
-
getCallId
The identifier naming this call everywhere -- here, in the system, and in whatever signalling the app uses. -
getDirection
Which way the call was placed. -
getHandle
Who is on the other end. -
getDisplayName
The name shown for the far end, or null. -
getState
Where the call is in its life. -
isMuted
public boolean isMuted()Whether the call is muted, as far as the system is concerned. -
reportStartedConnecting
public void reportStartedConnecting()Tells the system the outgoing call has begun connecting -- the far end is being rung. Ignored for an incoming call, and ignored once the call has connected. -
reportConnected
public void reportConnected()Tells the system the call is connected. Call this when media is actually flowing, because it starts the duration the user sees. -
update
Changes what the system shows for this call. Arguments left null are left alone.
The two fields are written under the session monitor, like the state and the mute flag: a signalling worker calls this while the EDT reads the same session to refresh the in-app call UI, and plain writes gave that reader no reason ever to see them -- so the system UI could show the new identity while Java went on displaying the old one, or a mixed pair of the two.
-
end
Hangs up, and writes
reasoninto the system call log.Do not call this from
CallActionListener.providerReset()-- by then the call no longer exists. -
reportEndedRemotely
Tells the system the far end ended the call. Use this rather thanend(CallEndReason)when the hang-up came down the app's own signalling, so the call log says what happened. -
setHeld
Holds or resumes the call. -
setMuted
Mutes or unmutes the call in the system UI.
This tells the operating system what the mute button should look like. It does not stop the app sending audio -- nothing here touches media -- so an app that only calls this is still transmitting.
Gated by
CallBridge.CAPABILITY_MUTE, which Android does not offer: a self-managed call there cannot tell Telecom its mute state, so this answersNOT_SUPPORTEDandisMuted()stays where the system left it. Hearing what the user does with the system's own mute control is a separate thing and works everywhere; seeCallActionListener.muteRequested(String, boolean, CallAction). -
sendDigits
Sends DTMF digits through the system. -
groupWith
Puts this call in a conference with
other, or takes it out of one whenotheris null.Answers NOT_SUPPORTED on every platform today, which is why
CallBridge.CAPABILITY_GROUPINGis set by no port: CallKit's group action travels system to app with no app-initiated counterpart, and Telecom conferences self-managed calls only through aConnectionServiceconference this framework does not build. It stays here because the system may still ask an app to group calls, and because a conference an app mixes itself needs no permission from either platform.
-