/** * Rejects an incoming call or session update. * * @param reason reason code to reject an incoming call * @see Listener#callSessionStartFailed */ public void reject(int reason) { if (mClosed) { return; } try { miSession.reject(reason); } catch (RemoteException e) { } }
/** * Sends an USSD message. * * @param ussdMessage USSD message to send */ public void sendUssd(String ussdMessage) { if (mClosed) { return; } try { miSession.sendUssd(ussdMessage); } catch (RemoteException e) { } }
/** * Starts a DTMF code. According to <a href="http://tools.ietf.org/html/rfc2833">RFC 2833</a>, * event 0 ~ 9 maps to decimal value 0 ~ 9, '*' to 10, '#' to 11, event 'A' ~ 'D' to 12 ~ 15, and * event flash to 16. Currently, event flash is not supported. * * @param c the DTMF to send. '0' ~ '9', 'A' ~ 'D', '*', '#' are valid inputs. */ public void startDtmf(char c) { if (mClosed) { return; } try { miSession.startDtmf(c); } catch (RemoteException e) { } }
/** * Terminates a call. * * @see Listener#callSessionTerminated */ public void terminate(int reason) { if (mClosed) { return; } try { miSession.terminate(reason); } catch (RemoteException e) { } }
/** * Sends a DTMF code. According to <a href="http://tools.ietf.org/html/rfc2833">RFC 2833</a>, * event 0 ~ 9 maps to decimal value 0 ~ 9, '*' to 10, '#' to 11, event 'A' ~ 'D' to 12 ~ 15, and * event flash to 16. Currently, event flash is not supported. * * @param c the DTMF to send. '0' ~ '9', 'A' ~ 'D', '*', '#' are valid inputs. */ public void sendDtmf(char c, Message result) { if (mClosed) { return; } try { miSession.sendDtmf(c, result); } catch (RemoteException e) { } }
/** * Extends this call to the conference call with the specified recipients. * * @participants participant list to be invited to the conference call after extending the call * @see Listener#sessionConferenceExtened, Listener#sessionConferenceExtendFailed */ public void extendToConference(String[] participants) { if (mClosed) { return; } try { miSession.extendToConference(participants); } catch (RemoteException e) { } }
/** * Requests the conference server to remove the specified participants from the conference. * * @param participants participant list to be removed from the conference call * @see Listener#sessionRemoveParticipantsRequestDelivered, * Listener#sessionRemoveParticipantsRequestFailed */ public void removeParticipants(String[] participants) { if (mClosed) { return; } try { miSession.removeParticipants(participants); } catch (RemoteException e) { } }
/** * Merges the active & hold call. When it succeeds, {@link Listener#callSessionMergeStarted} is * called. * * @see Listener#callSessionMergeStarted , Listener#callSessionMergeFailed */ public void merge() { if (mClosed) { return; } try { miSession.merge(); } catch (RemoteException e) { } }
/** * Updates the current call's properties (ex. call mode change: video upgrade / downgrade). * * @param callType call type specified in {@link ImsCallProfile} to be updated * @param profile stream media profile {@link ImsStreamMediaProfile} to be updated * @see Listener#callSessionUpdated, Listener#callSessionUpdateFailed */ public void update(int callType, ImsStreamMediaProfile profile) { if (mClosed) { return; } try { miSession.update(callType, profile); } catch (RemoteException e) { } }
/** * Initiates an IMS conference call with the specified target and call profile. The session * listener is called back upon defined session events. The method is only valid to call when the * session state is in {@link ImsCallSession#State#IDLE}. * * @param participants participant list to initiate an IMS conference call * @param profile call profile to make the call with the specified service type, call type and * media information * @see Listener#callSessionStarted, Listener#callSessionStartFailed */ public void start(String[] participants, ImsCallProfile profile) { if (mClosed) { return; } try { miSession.startConference(participants, profile); } catch (RemoteException e) { } }
/** * Continues a call that's on hold. When it succeeds, {@link Listener#callSessionResumed} is * called. * * @param profile stream media profile {@link ImsStreamMediaProfile} to resume the call * @see Listener#callSessionResumed, Listener#callSessionResumeFailed */ public void resume(ImsStreamMediaProfile profile) { if (mClosed) { return; } try { miSession.resume(profile); } catch (RemoteException e) { } }
/** Stops a DTMF code. */ public void stopDtmf() { if (mClosed) { return; } try { miSession.stopDtmf(); } catch (RemoteException e) { } }
/** * Initiates an IMS call with the specified target and call profile. The session listener is * called back upon defined session events. The method is only valid to call when the session * state is in {@link ImsCallSession#State#IDLE}. * * @param callee dialed string to make the call to * @param profile call profile to make the call with the specified service type, call type and * media information * @see Listener#callSessionStarted, Listener#callSessionStartFailed */ public void start(String callee, ImsCallProfile profile) { if (mClosed) { return; } try { miSession.start(callee, profile); } catch (RemoteException e) { } }
/** * Mutes or unmutes the mic for the active call. * * @param muted true if the call is muted, false otherwise */ public void setMute(boolean muted) { if (mClosed) { return; } try { miSession.setMute(muted); } catch (RemoteException e) { } }
/** * Determines if the session is multiparty. * * @return {@code True} if the session is multiparty. */ public boolean isMultiparty() { if (mClosed) { return false; } try { return miSession.isMultiparty(); } catch (RemoteException e) { return false; } }
/** * Gets the remote call profile that this session is associated with * * @return the remote call profile that this session is associated with */ public ImsCallProfile getRemoteCallProfile() { if (mClosed) { return null; } try { return miSession.getRemoteCallProfile(); } catch (RemoteException e) { return null; } }
/** * Gets the session state. The value returned must be one of the states in {@link State}. * * @return the session state */ public int getState() { if (mClosed) { return State.INVALID; } try { return miSession.getState(); } catch (RemoteException e) { return State.INVALID; } }
/** * Gets the value associated with the specified property of this session. * * @return the string value associated with the specified property */ public String getProperty(String name) { if (mClosed) { return null; } try { return miSession.getProperty(name); } catch (RemoteException e) { return null; } }
/** * Gets the video call provider for the session. * * @return The video call provider. */ public IImsVideoCallProvider getVideoCallProvider() { if (mClosed) { return null; } try { return miSession.getVideoCallProvider(); } catch (RemoteException e) { return null; } }
/** Closes this object. This object is not usable after being closed. */ public synchronized void close() { if (mClosed) { return; } try { miSession.close(); mClosed = true; } catch (RemoteException e) { } }
/** * Gets the call ID of the session. * * @return the call ID */ public String getCallId() { if (mClosed) { return null; } try { return miSession.getCallId(); } catch (RemoteException e) { return null; } }
public ImsCallSession(IImsCallSession iSession) { miSession = iSession; if (iSession != null) { try { iSession.setListener(new IImsCallSessionListenerProxy()); } catch (RemoteException e) { } } else { mClosed = true; } }
/** * Notifies the successful completion of a call merge operation. * * @param session The call session. */ @Override public void callSessionMergeComplete(IImsCallSession newSession) { if (mListener != null) { if (newSession != null) { // Check if the active session is the same session that was // active before the merge request was sent. ImsCallSession validActiveSession = ImsCallSession.this; try { if (!Objects.equals(miSession.getCallId(), newSession.getCallId())) { // New session created after conference validActiveSession = new ImsCallSession(newSession); } } catch (RemoteException rex) { Log.e(TAG, "callSessionMergeComplete: exception for getCallId!"); } mListener.callSessionMergeComplete(validActiveSession); } else { // Session already exists. Hence no need to pass mListener.callSessionMergeComplete(null); } } }