1363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang/*
2363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang * Copyright (C) 2010 The Android Open Source Project
3363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang *
4363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang * Licensed under the Apache License, Version 2.0 (the "License");
5363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang * you may not use this file except in compliance with the License.
6363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang * You may obtain a copy of the License at
7363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang *
8363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang *      http://www.apache.org/licenses/LICENSE-2.0
9363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang *
10363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang * Unless required by applicable law or agreed to in writing, software
11363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang * distributed under the License is distributed on an "AS IS" BASIS,
12363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang * See the License for the specific language governing permissions and
14363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang * limitations under the License.
15363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang */
16363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
17363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wangpackage android.net.sip;
18363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
19363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wangimport android.net.sip.ISipSession;
20363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wangimport android.net.sip.SipProfile;
21363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
22363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang/**
23363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang * Listener class to listen to SIP session events.
24363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang * @hide
25363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang */
26363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wanginterface ISipSessionListener {
27363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
28363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when an INVITE request is sent to initiate a new call.
29363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
30363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that carries out the transaction
31363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
32363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    void onCalling(in ISipSession session);
33363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
34363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
35363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when an INVITE request is received.
36363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
37363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that carries out the transaction
38363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param caller the SIP profile of the caller
39363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param sessionDescription the caller's session description
40363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
41363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    void onRinging(in ISipSession session, in SipProfile caller,
4295b15c35608fe3ea679c8a478c6cbd841623371eChia-chi Yeh            String sessionDescription);
43363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
44363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
45363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when a RINGING response is received for the INVITE request sent
46363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
47363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that carries out the transaction
48363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
49363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    void onRingingBack(in ISipSession session);
50363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
51363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
52363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when the session is established.
53363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
54363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that is associated with the dialog
55363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param sessionDescription the peer's session description
56363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
57363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    void onCallEstablished(in ISipSession session,
5895b15c35608fe3ea679c8a478c6cbd841623371eChia-chi Yeh            String sessionDescription);
59363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
60363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
61363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when the session is terminated.
62363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
63363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that is associated with the dialog
64363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
65363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    void onCallEnded(in ISipSession session);
66363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
67363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
68363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when the peer is busy during session initialization.
69363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
70363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that carries out the transaction
71363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
72363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    void onCallBusy(in ISipSession session);
73363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
74363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
751aceda35cc607856ec2e960e0c6cfc6aea87ab8erepo sync     * Called when the call is being transferred to a new one.
761aceda35cc607856ec2e960e0c6cfc6aea87ab8erepo sync     *
771aceda35cc607856ec2e960e0c6cfc6aea87ab8erepo sync     * @param newSession the new session that the call will be transferred to
781aceda35cc607856ec2e960e0c6cfc6aea87ab8erepo sync     * @param sessionDescription the new peer's session description
791aceda35cc607856ec2e960e0c6cfc6aea87ab8erepo sync     */
801aceda35cc607856ec2e960e0c6cfc6aea87ab8erepo sync    void onCallTransferring(in ISipSession newSession, String sessionDescription);
811aceda35cc607856ec2e960e0c6cfc6aea87ab8erepo sync
821aceda35cc607856ec2e960e0c6cfc6aea87ab8erepo sync    /**
83363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when an error occurs during session initialization and
84363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * termination.
85363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
86363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that carries out the transaction
87903e1031605d715e904811b0dd06cc6a518f0048Hung-ying Tyan     * @param errorCode error code defined in {@link SipErrorCode}
88363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param errorMessage error message
89363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
9097963794af1e18674dd111e3ad344d90b16c922cHung-ying Tyan    void onError(in ISipSession session, int errorCode, String errorMessage);
91363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
92363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
93363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when an error occurs during session modification negotiation.
94363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
95363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that carries out the transaction
96903e1031605d715e904811b0dd06cc6a518f0048Hung-ying Tyan     * @param errorCode error code defined in {@link SipErrorCode}
97363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param errorMessage error message
98363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
9997963794af1e18674dd111e3ad344d90b16c922cHung-ying Tyan    void onCallChangeFailed(in ISipSession session, int errorCode,
100363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang            String errorMessage);
101363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
102363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
103363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when a registration request is sent.
104363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
105363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that carries out the transaction
106363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
107363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    void onRegistering(in ISipSession session);
108363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
109363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
110363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when registration is successfully done.
111363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
112363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that carries out the transaction
113363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param duration duration in second before the registration expires
114363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
115363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    void onRegistrationDone(in ISipSession session, int duration);
116363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
117363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
118363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when the registration fails.
119363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
120363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that carries out the transaction
121903e1031605d715e904811b0dd06cc6a518f0048Hung-ying Tyan     * @param errorCode error code defined in {@link SipErrorCode}
122363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param errorMessage error message
123363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
12497963794af1e18674dd111e3ad344d90b16c922cHung-ying Tyan    void onRegistrationFailed(in ISipSession session, int errorCode,
125363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang            String errorMessage);
126363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang
127363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    /**
128363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * Called when the registration gets timed out.
129363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     *
130363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     * @param session the session object that carries out the transaction
131363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang     */
132363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang    void onRegistrationTimeout(in ISipSession session);
133363c2ab82cca4f095e9e0c8465e28f6d27a24bf8Chung-yih Wang}
134