198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang/*
298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang * Copyright (C) 2010 The Android Open Source Project
398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang *
498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang * Licensed under the Apache License, Version 2.0 (the "License");
598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang * you may not use this file except in compliance with the License.
698cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang * You may obtain a copy of the License at
798cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang *
898cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang *      http://www.apache.org/licenses/LICENSE-2.0
998cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang *
1098cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang * Unless required by applicable law or agreed to in writing, software
1198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang * distributed under the License is distributed on an "AS IS" BASIS,
1298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang * See the License for the specific language governing permissions and
1498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang * limitations under the License.
1598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang */
1698cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
1798cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wangpackage android.net.sip;
1898cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
1998cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wangimport android.net.sip.ISipSession;
2098cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wangimport android.net.sip.SipProfile;
2198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
2298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang/**
2398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang * Listener class to listen to SIP session events.
2498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang * @hide
2598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang */
2698cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wanginterface ISipSessionListener {
2798cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
2898cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when an INVITE request is sent to initiate a new call.
2998cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
3098cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that carries out the transaction
3198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
3298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    void onCalling(in ISipSession session);
3398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
3498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
3598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when an INVITE request is received.
3698cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
3798cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that carries out the transaction
3898cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param caller the SIP profile of the caller
3998cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param sessionDescription the caller's session description
4098cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
4198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    void onRinging(in ISipSession session, in SipProfile caller,
426d0ef774a2492b0996ded3a43c300c7f72a94897Chia-chi Yeh            String sessionDescription);
4398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
4498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
4598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when a RINGING response is received for the INVITE request sent
4698cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
4798cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that carries out the transaction
4898cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
4998cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    void onRingingBack(in ISipSession session);
5098cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
5198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
5298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when the session is established.
5398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
5498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that is associated with the dialog
5598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param sessionDescription the peer's session description
5698cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
5798cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    void onCallEstablished(in ISipSession session,
586d0ef774a2492b0996ded3a43c300c7f72a94897Chia-chi Yeh            String sessionDescription);
5998cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
6098cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
6198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when the session is terminated.
6298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
6398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that is associated with the dialog
6498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
6598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    void onCallEnded(in ISipSession session);
6698cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
6798cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
6898cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when the peer is busy during session initialization.
6998cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
7098cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that carries out the transaction
7198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
7298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    void onCallBusy(in ISipSession session);
7398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
7498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
7522ecc3df834674605daf86f7edf20169b6ca800brepo sync     * Called when the call is being transferred to a new one.
7622ecc3df834674605daf86f7edf20169b6ca800brepo sync     *
7722ecc3df834674605daf86f7edf20169b6ca800brepo sync     * @param newSession the new session that the call will be transferred to
7822ecc3df834674605daf86f7edf20169b6ca800brepo sync     * @param sessionDescription the new peer's session description
7922ecc3df834674605daf86f7edf20169b6ca800brepo sync     */
8022ecc3df834674605daf86f7edf20169b6ca800brepo sync    void onCallTransferring(in ISipSession newSession, String sessionDescription);
8122ecc3df834674605daf86f7edf20169b6ca800brepo sync
8222ecc3df834674605daf86f7edf20169b6ca800brepo sync    /**
8398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when an error occurs during session initialization and
8498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * termination.
8598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
8698cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that carries out the transaction
872bd51a23644fa0d5a460a4a939e95d5d4e85b891Hung-ying Tyan     * @param errorCode error code defined in {@link SipErrorCode}
8898cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param errorMessage error message
8998cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
90a0171082cfc4b860a82dcf5ebbd498b253f1032fHung-ying Tyan    void onError(in ISipSession session, int errorCode, String errorMessage);
9198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
9298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
9398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when an error occurs during session modification negotiation.
9498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
9598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that carries out the transaction
962bd51a23644fa0d5a460a4a939e95d5d4e85b891Hung-ying Tyan     * @param errorCode error code defined in {@link SipErrorCode}
9798cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param errorMessage error message
9898cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
99a0171082cfc4b860a82dcf5ebbd498b253f1032fHung-ying Tyan    void onCallChangeFailed(in ISipSession session, int errorCode,
10098cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang            String errorMessage);
10198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
10298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
10398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when a registration request is sent.
10498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
10598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that carries out the transaction
10698cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
10798cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    void onRegistering(in ISipSession session);
10898cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
10998cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
11098cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when registration is successfully done.
11198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
11298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that carries out the transaction
11398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param duration duration in second before the registration expires
11498cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
11598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    void onRegistrationDone(in ISipSession session, int duration);
11698cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
11798cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
11898cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when the registration fails.
11998cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
12098cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that carries out the transaction
1212bd51a23644fa0d5a460a4a939e95d5d4e85b891Hung-ying Tyan     * @param errorCode error code defined in {@link SipErrorCode}
12298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param errorMessage error message
12398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
124a0171082cfc4b860a82dcf5ebbd498b253f1032fHung-ying Tyan    void onRegistrationFailed(in ISipSession session, int errorCode,
12598cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang            String errorMessage);
12698cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang
12798cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    /**
12898cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * Called when the registration gets timed out.
12998cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     *
13098cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     * @param session the session object that carries out the transaction
13198cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang     */
13298cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang    void onRegistrationTimeout(in ISipSession session);
13398cee0ce2354234e72bafb836864ec10a490ea4dChung-yih Wang}
134