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 * 95 * @deprecated This is depreacated. 96 */ setListener(in IImsCallSessionListener listener)97 void setListener(in IImsCallSessionListener listener); 98 99 /** 100 * Mutes or unmutes the mic for the active call. 101 * 102 * @param muted true if the call is muted, false otherwise 103 */ setMute(boolean muted)104 void setMute(boolean muted); 105 106 /** 107 * Initiates an IMS call with the specified target and call profile. 108 * The session listener is called back upon defined session events. 109 * The method is only valid to call when the session state is in 110 * {@link ImsCallSession#State#IDLE}. 111 * 112 * @param callee dialed string to make the call to 113 * @param profile call profile to make the call with the specified service type, 114 * call type and media information 115 * @see Listener#callSessionStarted, Listener#callSessionStartFailed 116 */ start(String callee, in ImsCallProfile profile)117 void start(String callee, in ImsCallProfile profile); 118 119 /** 120 * Initiates an IMS call with the specified participants and call profile. 121 * The session listener is called back upon defined session events. 122 * The method is only valid to call when the session state is in 123 * {@link ImsCallSession#State#IDLE}. 124 * 125 * @param participants participant list to initiate an IMS conference call 126 * @param profile call profile to make the call with the specified service type, 127 * call type and media information 128 * @see Listener#callSessionStarted, Listener#callSessionStartFailed 129 */ startConference(in String[] participants, in ImsCallProfile profile)130 void startConference(in String[] participants, in ImsCallProfile profile); 131 132 /** 133 * Accepts an incoming call or session update. 134 * 135 * @param callType call type specified in {@link ImsCallProfile} to be answered 136 * @param profile stream media profile {@link ImsStreamMediaProfile} to be answered 137 * @see Listener#callSessionStarted 138 */ accept(int callType, in ImsStreamMediaProfile profile)139 void accept(int callType, in ImsStreamMediaProfile profile); 140 141 /** 142 * Deflects an incoming call. 143 * 144 * @param deflectNumber number to deflect the call 145 */ deflect(String deflectNumber)146 void deflect(String deflectNumber); 147 148 /** 149 * Rejects an incoming call or session update. 150 * 151 * @param reason reason code to reject an incoming call 152 * @see Listener#callSessionStartFailed 153 */ reject(int reason)154 void reject(int reason); 155 156 /** 157 * Transfer an established call to given number 158 * 159 * @param number number to transfer the call 160 * @param isConfirmationRequired if {@code True}, indicates a confirmed transfer, 161 * if {@code False} it indicates an unconfirmed transfer. 162 */ transfer(String number, boolean isConfirmationRequired)163 void transfer(String number, boolean isConfirmationRequired); 164 165 /** 166 * Transfer an established call to another call session 167 * 168 * @param transferToSession The other ImsCallSession to transfer the ongoing session to. 169 */ consultativeTransfer(in IImsCallSession transferToSession)170 void consultativeTransfer(in IImsCallSession transferToSession); 171 172 /** 173 * Terminates a call. 174 * 175 * @see Listener#callSessionTerminated 176 */ terminate(int reason)177 void terminate(int reason); 178 179 /** 180 * Puts a call on hold. When it succeeds, {@link Listener#callSessionHeld} is called. 181 * 182 * @param profile stream media profile {@link ImsStreamMediaProfile} to hold the call 183 * @see Listener#callSessionHeld, Listener#callSessionHoldFailed 184 */ hold(in ImsStreamMediaProfile profile)185 void hold(in ImsStreamMediaProfile profile); 186 187 /** 188 * Continues a call that's on hold. When it succeeds, {@link Listener#callSessionResumed} 189 * is called. 190 * 191 * @param profile stream media profile {@link ImsStreamMediaProfile} to resume the call 192 * @see Listener#callSessionResumed, Listener#callSessionResumeFailed 193 */ resume(in ImsStreamMediaProfile profile)194 void resume(in ImsStreamMediaProfile profile); 195 196 /** 197 * Merges the active & hold call. When the merge starts, 198 * {@link Listener#callSessionMergeStarted} is called. 199 * {@link Listener#callSessionMergeComplete} is called if the merge is successful, and 200 * {@link Listener#callSessionMergeFailed} is called if the merge fails. 201 * 202 * @see Listener#callSessionMergeStarted, Listener#callSessionMergeComplete, 203 * Listener#callSessionMergeFailed 204 */ merge()205 void merge(); 206 207 /** 208 * Updates the current call's properties (ex. call mode change: video upgrade / downgrade). 209 * 210 * @param callType call type specified in {@link ImsCallProfile} to be updated 211 * @param profile stream media profile {@link ImsStreamMediaProfile} to be updated 212 * @see Listener#callSessionUpdated, Listener#callSessionUpdateFailed 213 */ update(int callType, in ImsStreamMediaProfile profile)214 void update(int callType, in ImsStreamMediaProfile profile); 215 216 /** 217 * Extends this call to the conference call with the specified recipients. 218 * 219 * @param participants participant list to be invited to the conference call after extending the call 220 * @see Listener#sessionConferenceExtened, Listener#sessionConferenceExtendFailed 221 */ extendToConference(in String[] participants)222 void extendToConference(in String[] participants); 223 224 /** 225 * Requests the conference server to invite an additional participants to the conference. 226 * 227 * @param participants participant list to be invited to the conference call 228 * @see Listener#sessionInviteParticipantsRequestDelivered, 229 * Listener#sessionInviteParticipantsRequestFailed 230 */ inviteParticipants(in String[] participants)231 void inviteParticipants(in String[] participants); 232 233 /** 234 * Requests the conference server to remove the specified participants from the conference. 235 * 236 * @param participants participant list to be removed from the conference call 237 * @see Listener#sessionRemoveParticipantsRequestDelivered, 238 * Listener#sessionRemoveParticipantsRequestFailed 239 */ removeParticipants(in String[] participants)240 void removeParticipants(in String[] participants); 241 242 /** 243 * Sends a DTMF code. According to <a href="http://tools.ietf.org/html/rfc2833">RFC 2833</a>, 244 * event 0 ~ 9 maps to decimal value 0 ~ 9, '*' to 10, '#' to 11, event 'A' ~ 'D' to 12 ~ 15, 245 * and event flash to 16. Currently, event flash is not supported. 246 * 247 * @param c the DTMF to send. '0' ~ '9', 'A' ~ 'D', '*', '#' are valid inputs. 248 * @param result. 249 */ sendDtmf(char c, in Message result)250 void sendDtmf(char c, in Message result); 251 252 /** 253 * Start a DTMF code. According to <a href="http://tools.ietf.org/html/rfc2833">RFC 2833</a>, 254 * event 0 ~ 9 maps to decimal value 0 ~ 9, '*' to 10, '#' to 11, event 'A' ~ 'D' to 12 ~ 15, 255 * and event flash to 16. Currently, event flash is not supported. 256 * 257 * @param c the DTMF to send. '0' ~ '9', 'A' ~ 'D', '*', '#' are valid inputs. 258 */ startDtmf(char c)259 void startDtmf(char c); 260 261 /** 262 * Stop a DTMF code. 263 */ stopDtmf()264 void stopDtmf(); 265 266 /** 267 * Sends an USSD message. 268 * 269 * @param ussdMessage USSD message to send 270 */ sendUssd(String ussdMessage)271 void sendUssd(String ussdMessage); 272 273 /** 274 * Returns a binder for the video call provider implementation contained within the IMS service 275 * process. This binder is used by the VideoCallProvider subclass in Telephony which 276 * intermediates between the propriety implementation and Telecomm/InCall. 277 */ getVideoCallProvider()278 IImsVideoCallProvider getVideoCallProvider(); 279 280 /** 281 * Determines if the current session is multiparty. 282 * @return {@code True} if the session is multiparty. 283 */ isMultiparty()284 boolean isMultiparty(); 285 286 /** 287 * Device issues RTT modify request 288 * @param toProfile The profile with requested changes made 289 */ sendRttModifyRequest(in ImsCallProfile toProfile)290 void sendRttModifyRequest(in ImsCallProfile toProfile); 291 292 /* 293 * Device responds to Remote RTT modify request 294 * @param status true : Accepted the request 295 * false : Declined the request 296 */ sendRttModifyResponse(in boolean status)297 void sendRttModifyResponse(in boolean status); 298 299 /* 300 * Device sends RTT message 301 * @param rttMessage RTT message to be sent 302 */ sendRttMessage(in String rttMessage)303 void sendRttMessage(in String rttMessage); 304 305 /* 306 * Device sends RTP header extension(s). 307 * @param extensions the header extensions to be sent 308 */ sendRtpHeaderExtensions(in List<RtpHeaderExtension> extensions)309 void sendRtpHeaderExtensions(in List<RtpHeaderExtension> extensions); 310 311 /* 312 * Deliver the bitrate for the indicated media type, direction and bitrate to the upper layer. 313 * 314 * @param mediaType MediaType is used to identify media stream such as audio or video. 315 * @param direction Direction of this packet stream (e.g. uplink or downlink). 316 * @param bitsPerSecond This value is the bitrate received from the NW through the Recommended 317 * bitrate MAC Control Element message and ImsStack converts this value from MAC bitrate 318 * to audio/video codec bitrate (defined in TS26.114). 319 */ callSessionNotifyAnbr(int mediaType, int direction, int bitsPerSecond)320 void callSessionNotifyAnbr(int mediaType, int direction, int bitsPerSecond); 321 } 322