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