1 /* 2 * Copyright (c) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.ims.internal; 18 19 import android.os.Message; 20 import android.telephony.ims.aidl.IImsCallSessionListener; 21 import android.telephony.ims.ImsCallProfile; 22 import android.telephony.ims.ImsStreamMediaProfile; 23 import android.telephony.ims.RtpHeaderExtension; 24 25 import com.android.ims.internal.IImsVideoCallProvider; 26 27 /** 28 * An IMS session that is associated with a SIP dialog which is established from/to 29 * INVITE request or a mid-call transaction to control the session. 30 * {@hide} 31 */ 32 interface IImsCallSession { 33 /** 34 * Closes the object. This object is not usable after being closed. 35 */ close()36 void close(); 37 38 /** 39 * Gets the call ID of the session. 40 * 41 * @return the call ID 42 */ getCallId()43 String getCallId(); 44 45 /** 46 * Gets the call profile that this session is associated with 47 * 48 * @return the call profile that this session is associated with 49 */ getCallProfile()50 ImsCallProfile getCallProfile(); 51 52 /** 53 * Gets the local call profile that this session is associated with 54 * 55 * @return the local call profile that this session is associated with 56 */ getLocalCallProfile()57 ImsCallProfile getLocalCallProfile(); 58 59 /** 60 * Gets the remote call profile that this session is associated with 61 * 62 * @return the remote call profile that this session is associated with 63 */ getRemoteCallProfile()64 ImsCallProfile getRemoteCallProfile(); 65 66 /** 67 * Gets the value associated with the specified property of this session. 68 * 69 * @return the string value associated with the specified property 70 */ getProperty(String name)71 String getProperty(String name); 72 73 /** 74 * Gets the session state. The value returned must be one of the states in 75 * {@link ImsCallSession#State}. 76 * 77 * @return the session state 78 */ getState()79 int getState(); 80 81 /** 82 * Checks if the session is in a call. 83 * 84 * @return true if the session is in a call 85 */ isInCall()86 boolean isInCall(); 87 88 /** 89 * Sets the listener to listen to the session events. A {@link IImsCallSession} 90 * can only hold one listener at a time. Subsequent calls to this method 91 * override the previous listener. 92 * 93 * @param listener to listen to the session events of this object 94 */ setListener(in IImsCallSessionListener listener)95 void setListener(in IImsCallSessionListener listener); 96 97 /** 98 * Mutes or unmutes the mic for the active call. 99 * 100 * @param muted true if the call is muted, false otherwise 101 */ setMute(boolean muted)102 void setMute(boolean muted); 103 104 /** 105 * Initiates an IMS call with the specified target and call profile. 106 * The session listener is called back upon defined session events. 107 * The method is only valid to call when the session state is in 108 * {@link ImsCallSession#State#IDLE}. 109 * 110 * @param callee dialed string to make the call to 111 * @param profile call profile to make the call with the specified service type, 112 * call type and media information 113 * @see Listener#callSessionStarted, Listener#callSessionStartFailed 114 */ start(String callee, in ImsCallProfile profile)115 void start(String callee, in ImsCallProfile profile); 116 117 /** 118 * Initiates an IMS call with the specified participants and call profile. 119 * The session listener is called back upon defined session events. 120 * The method is only valid to call when the session state is in 121 * {@link ImsCallSession#State#IDLE}. 122 * 123 * @param participants participant list to initiate an IMS conference call 124 * @param profile call profile to make the call with the specified service type, 125 * call type and media information 126 * @see Listener#callSessionStarted, Listener#callSessionStartFailed 127 */ startConference(in String[] participants, in ImsCallProfile profile)128 void startConference(in String[] participants, in ImsCallProfile profile); 129 130 /** 131 * Accepts an incoming call or session update. 132 * 133 * @param callType call type specified in {@link ImsCallProfile} to be answered 134 * @param profile stream media profile {@link ImsStreamMediaProfile} to be answered 135 * @see Listener#callSessionStarted 136 */ accept(int callType, in ImsStreamMediaProfile profile)137 void accept(int callType, in ImsStreamMediaProfile profile); 138 139 /** 140 * Deflects an incoming call. 141 * 142 * @param deflectNumber number to deflect the call 143 */ deflect(String deflectNumber)144 void deflect(String deflectNumber); 145 146 /** 147 * Rejects an incoming call or session update. 148 * 149 * @param reason reason code to reject an incoming call 150 * @see Listener#callSessionStartFailed 151 */ reject(int reason)152 void reject(int reason); 153 154 /** 155 * Transfer an established call to given number 156 * 157 * @param number number to transfer the call 158 * @param isConfirmationRequired if {@code True}, indicates a confirmed transfer, 159 * if {@code False} it indicates an unconfirmed transfer. 160 */ transfer(String number, boolean isConfirmationRequired)161 void transfer(String number, boolean isConfirmationRequired); 162 163 /** 164 * Transfer an established call to another call session 165 * 166 * @param transferToSession The other ImsCallSession to transfer the ongoing session to. 167 */ consultativeTransfer(in IImsCallSession transferToSession)168 void consultativeTransfer(in IImsCallSession transferToSession); 169 170 /** 171 * Terminates a call. 172 * 173 * @see Listener#callSessionTerminated 174 */ terminate(int reason)175 void terminate(int reason); 176 177 /** 178 * Puts a call on hold. When it succeeds, {@link Listener#callSessionHeld} is called. 179 * 180 * @param profile stream media profile {@link ImsStreamMediaProfile} to hold the call 181 * @see Listener#callSessionHeld, Listener#callSessionHoldFailed 182 */ hold(in ImsStreamMediaProfile profile)183 void hold(in ImsStreamMediaProfile profile); 184 185 /** 186 * Continues a call that's on hold. When it succeeds, {@link Listener#callSessionResumed} 187 * is called. 188 * 189 * @param profile stream media profile {@link ImsStreamMediaProfile} to resume the call 190 * @see Listener#callSessionResumed, Listener#callSessionResumeFailed 191 */ resume(in ImsStreamMediaProfile profile)192 void resume(in ImsStreamMediaProfile profile); 193 194 /** 195 * Merges the active & hold call. When the merge starts, 196 * {@link Listener#callSessionMergeStarted} is called. 197 * {@link Listener#callSessionMergeComplete} is called if the merge is successful, and 198 * {@link Listener#callSessionMergeFailed} is called if the merge fails. 199 * 200 * @see Listener#callSessionMergeStarted, Listener#callSessionMergeComplete, 201 * Listener#callSessionMergeFailed 202 */ merge()203 void merge(); 204 205 /** 206 * Updates the current call's properties (ex. call mode change: video upgrade / downgrade). 207 * 208 * @param callType call type specified in {@link ImsCallProfile} to be updated 209 * @param profile stream media profile {@link ImsStreamMediaProfile} to be updated 210 * @see Listener#callSessionUpdated, Listener#callSessionUpdateFailed 211 */ update(int callType, in ImsStreamMediaProfile profile)212 void update(int callType, in ImsStreamMediaProfile profile); 213 214 /** 215 * Extends this call to the conference call with the specified recipients. 216 * 217 * @param participants participant list to be invited to the conference call after extending the call 218 * @see Listener#sessionConferenceExtened, Listener#sessionConferenceExtendFailed 219 */ extendToConference(in String[] participants)220 void extendToConference(in String[] participants); 221 222 /** 223 * Requests the conference server to invite an additional participants to the conference. 224 * 225 * @param participants participant list to be invited to the conference call 226 * @see Listener#sessionInviteParticipantsRequestDelivered, 227 * Listener#sessionInviteParticipantsRequestFailed 228 */ inviteParticipants(in String[] participants)229 void inviteParticipants(in String[] participants); 230 231 /** 232 * Requests the conference server to remove the specified participants from the conference. 233 * 234 * @param participants participant list to be removed from the conference call 235 * @see Listener#sessionRemoveParticipantsRequestDelivered, 236 * Listener#sessionRemoveParticipantsRequestFailed 237 */ removeParticipants(in String[] participants)238 void removeParticipants(in String[] participants); 239 240 /** 241 * Sends a DTMF code. According to <a href="http://tools.ietf.org/html/rfc2833">RFC 2833</a>, 242 * event 0 ~ 9 maps to decimal value 0 ~ 9, '*' to 10, '#' to 11, event 'A' ~ 'D' to 12 ~ 15, 243 * and event flash to 16. Currently, event flash is not supported. 244 * 245 * @param c the DTMF to send. '0' ~ '9', 'A' ~ 'D', '*', '#' are valid inputs. 246 * @param result. 247 */ sendDtmf(char c, in Message result)248 void sendDtmf(char c, in Message result); 249 250 /** 251 * Start a DTMF code. According to <a href="http://tools.ietf.org/html/rfc2833">RFC 2833</a>, 252 * event 0 ~ 9 maps to decimal value 0 ~ 9, '*' to 10, '#' to 11, event 'A' ~ 'D' to 12 ~ 15, 253 * and event flash to 16. Currently, event flash is not supported. 254 * 255 * @param c the DTMF to send. '0' ~ '9', 'A' ~ 'D', '*', '#' are valid inputs. 256 */ startDtmf(char c)257 void startDtmf(char c); 258 259 /** 260 * Stop a DTMF code. 261 */ stopDtmf()262 void stopDtmf(); 263 264 /** 265 * Sends an USSD message. 266 * 267 * @param ussdMessage USSD message to send 268 */ sendUssd(String ussdMessage)269 void sendUssd(String ussdMessage); 270 271 /** 272 * Returns a binder for the video call provider implementation contained within the IMS service 273 * process. This binder is used by the VideoCallProvider subclass in Telephony which 274 * intermediates between the propriety implementation and Telecomm/InCall. 275 */ getVideoCallProvider()276 IImsVideoCallProvider getVideoCallProvider(); 277 278 /** 279 * Determines if the current session is multiparty. 280 * @return {@code True} if the session is multiparty. 281 */ isMultiparty()282 boolean isMultiparty(); 283 284 /** 285 * Device issues RTT modify request 286 * @param toProfile The profile with requested changes made 287 */ sendRttModifyRequest(in ImsCallProfile toProfile)288 void sendRttModifyRequest(in ImsCallProfile toProfile); 289 290 /* 291 * Device responds to Remote RTT modify request 292 * @param status true : Accepted the request 293 * false : Declined the request 294 */ sendRttModifyResponse(in boolean status)295 void sendRttModifyResponse(in boolean status); 296 297 /* 298 * Device sends RTT message 299 * @param rttMessage RTT message to be sent 300 */ sendRttMessage(in String rttMessage)301 void sendRttMessage(in String rttMessage); 302 303 /* 304 * Device sends RTP header extension(s). 305 * @param extensions the header extensions to be sent 306 */ sendRtpHeaderExtensions(in List<RtpHeaderExtension> extensions)307 void sendRtpHeaderExtensions(in List<RtpHeaderExtension> extensions); 308 } 309