ISipSession.aidl revision 363c2ab82cca4f095e9e0c8465e28f6d27a24bf8
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
17package android.net.sip;
18
19import android.net.sip.ISipSessionListener;
20import android.net.sip.SessionDescription;
21import android.net.sip.SipProfile;
22
23/**
24 * A SIP session that is associated with a SIP dialog or a transaction
25 * (e.g., registration) not within a dialog.
26 * @hide
27 */
28interface ISipSession {
29    /**
30     * Gets the IP address of the local host on which this SIP session runs.
31     *
32     * @return the IP address of the local host
33     */
34    String getLocalIp();
35
36    /**
37     * Gets the SIP profile that this session is associated with.
38     *
39     * @return the SIP profile that this session is associated with
40     */
41    SipProfile getLocalProfile();
42
43    /**
44     * Gets the SIP profile that this session is connected to. Only available
45     * when the session is associated with a SIP dialog.
46     *
47     * @return the SIP profile that this session is connected to
48     */
49    SipProfile getPeerProfile();
50
51    /**
52     * Gets the session state. The value returned must be one of the states in
53     * {@link SipSessionState}. One may convert it to {@link SipSessionState} by
54     * <code>
55     *      Enum.valueOf(SipSessionState.class, session.getState());
56     * </code>
57     *
58     * @return the session state
59     */
60    String getState();
61
62    /**
63     * Checks if the session is in a call.
64     *
65     * @return true if the session is in a call
66     */
67    boolean isInCall();
68
69    /**
70     * Gets the call ID of the session.
71     *
72     * @return the call ID
73     */
74    String getCallId();
75
76
77    /**
78     * Sets the listener to listen to the session events. A {@link ISipSession}
79     * can only hold one listener at a time. Subsequent calls to this method
80     * override the previous listener.
81     *
82     * @param listener to listen to the session events of this object
83     */
84    void setListener(in ISipSessionListener listener);
85
86
87    /**
88     * Performs registration to the server specified by the associated local
89     * profile. The session listener is called back upon success or failure of
90     * registration. The method is only valid to call when the session state is
91     * in {@link SipSessionState#READY_TO_CALL}.
92     *
93     * @param duration duration in second before the registration expires
94     * @see ISipSessionListener
95     */
96    void register(int duration);
97
98    /**
99     * Performs unregistration to the server specified by the associated local
100     * profile. Unregistration is technically the same as registration with zero
101     * expiration duration. The session listener is called back upon success or
102     * failure of unregistration. The method is only valid to call when the
103     * session state is in {@link SipSessionState#READY_TO_CALL}.
104     *
105     * @see ISipSessionListener
106     */
107    void unregister();
108
109    /**
110     * Initiates a call to the specified profile. The session listener is called
111     * back upon defined session events. The method is only valid to call when
112     * the session state is in {@link SipSessionState#READY_TO_CALL}.
113     *
114     * @param callee the SIP profile to make the call to
115     * @param sessionDescription the session description of this call
116     * @see ISipSessionListener
117     */
118    void makeCall(in SipProfile callee,
119            in SessionDescription sessionDescription);
120
121    /**
122     * Answers an incoming call with the specified session description. The
123     * method is only valid to call when the session state is in
124     * {@link SipSessionState#INCOMING_CALL}.
125     *
126     * @param sessionDescription the session description to answer this call
127     */
128    void answerCall(in SessionDescription sessionDescription);
129
130    /**
131     * Ends an established call, terminates an outgoing call or rejects an
132     * incoming call. The method is only valid to call when the session state is
133     * in {@link SipSessionState#IN_CALL},
134     * {@link SipSessionState#INCOMING_CALL},
135     * {@link SipSessionState#OUTGOING_CALL} or
136     * {@link SipSessionState#OUTGOING_CALL_RING_BACK}.
137     */
138    void endCall();
139
140    /**
141     * Changes the session description during a call. The method is only valid
142     * to call when the session state is in {@link SipSessionState#IN_CALL}.
143     *
144     * @param sessionDescription the new session description
145     */
146    void changeCall(in SessionDescription sessionDescription);
147}
148