1 /* 2 * Copyright (C) 2010 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 android.net.sip; 18 19 import android.net.sip.ISipSession; 20 import android.net.sip.SipProfile; 21 22 /** 23 * Listener class to listen to SIP session events. 24 * @hide 25 */ 26 interface ISipSessionListener { 27 /** 28 * Called when an INVITE request is sent to initiate a new call. 29 * 30 * @param session the session object that carries out the transaction 31 */ 32 void onCalling(in ISipSession session); 33 34 /** 35 * Called when an INVITE request is received. 36 * 37 * @param session the session object that carries out the transaction 38 * @param caller the SIP profile of the caller 39 * @param sessionDescription the caller's session description 40 */ 41 void onRinging(in ISipSession session, in SipProfile caller, 42 String sessionDescription); 43 44 /** 45 * Called when a RINGING response is received for the INVITE request sent 46 * 47 * @param session the session object that carries out the transaction 48 */ 49 void onRingingBack(in ISipSession session); 50 51 /** 52 * Called when the session is established. 53 * 54 * @param session the session object that is associated with the dialog 55 * @param sessionDescription the peer's session description 56 */ 57 void onCallEstablished(in ISipSession session, 58 String sessionDescription); 59 60 /** 61 * Called when the session is terminated. 62 * 63 * @param session the session object that is associated with the dialog 64 */ 65 void onCallEnded(in ISipSession session); 66 67 /** 68 * Called when the peer is busy during session initialization. 69 * 70 * @param session the session object that carries out the transaction 71 */ 72 void onCallBusy(in ISipSession session); 73 74 /** 75 * Called when the call is being transferred to a new one. 76 * 77 * @param newSession the new session that the call will be transferred to 78 * @param sessionDescription the new peer's session description 79 */ 80 void onCallTransferring(in ISipSession newSession, String sessionDescription); 81 82 /** 83 * Called when an error occurs during session initialization and 84 * termination. 85 * 86 * @param session the session object that carries out the transaction 87 * @param errorCode error code defined in {@link SipErrorCode} 88 * @param errorMessage error message 89 */ 90 void onError(in ISipSession session, int errorCode, String errorMessage); 91 92 /** 93 * Called when an error occurs during session modification negotiation. 94 * 95 * @param session the session object that carries out the transaction 96 * @param errorCode error code defined in {@link SipErrorCode} 97 * @param errorMessage error message 98 */ 99 void onCallChangeFailed(in ISipSession session, int errorCode, 100 String errorMessage); 101 102 /** 103 * Called when a registration request is sent. 104 * 105 * @param session the session object that carries out the transaction 106 */ 107 void onRegistering(in ISipSession session); 108 109 /** 110 * Called when registration is successfully done. 111 * 112 * @param session the session object that carries out the transaction 113 * @param duration duration in second before the registration expires 114 */ 115 void onRegistrationDone(in ISipSession session, int duration); 116 117 /** 118 * Called when the registration fails. 119 * 120 * @param session the session object that carries out the transaction 121 * @param errorCode error code defined in {@link SipErrorCode} 122 * @param errorMessage error message 123 */ 124 void onRegistrationFailed(in ISipSession session, int errorCode, 125 String errorMessage); 126 127 /** 128 * Called when the registration gets timed out. 129 * 130 * @param session the session object that carries out the transaction 131 */ 132 void onRegistrationTimeout(in ISipSession session); 133 } 134