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