001/**
002 *
003 * Copyright 2003-2006 Jive Software.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jivesoftware.smackx.jingleold.listeners;
018
019import org.jivesoftware.smack.SmackException.NotConnectedException;
020import org.jivesoftware.smack.XMPPException;
021
022import org.jivesoftware.smackx.jingleold.JingleSession;
023import org.jivesoftware.smackx.jingleold.media.PayloadType;
024import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;
025
026/**
027 * Interface for listening for session events.
028 * @author Thiago Camargo
029 */
030public interface JingleSessionListener extends JingleListener {
031    /**
032     * Notification that the session has been established. Arguments specify
033     * the payload type and transport to use.
034     *
035     * @param pt            the Payload tyep to use
036     * @param remoteCandidate            the remote candidate to use for connecting to the remote
037     *                      service.
038     * @param localCandidate            the local candidate where we must listen for connections
039     * @param jingleSession Session that called the method
040     * @throws NotConnectedException if the XMPP connection is not connected.
041     * @throws InterruptedException if the calling thread was interrupted.
042     */
043    void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
044                                   TransportCandidate localCandidate, JingleSession jingleSession) throws NotConnectedException, InterruptedException;
045
046    /**
047     * Notification that the session was declined.
048     *
049     * @param reason        the reason (if any).
050     * @param jingleSession Session that called the method
051     */
052    void sessionDeclined(String reason, JingleSession jingleSession);
053
054    /**
055     * Notification that the session was redirected.
056     *
057     * @param redirection TODO javadoc me please
058     * @param jingleSession session that called the method
059     */
060    void sessionRedirected(String redirection, JingleSession jingleSession);
061
062    /**
063     * Notification that the session was closed normally.
064     *
065     * @param reason        the reason (if any).
066     * @param jingleSession Session that called the method
067     */
068    void sessionClosed(String reason, JingleSession jingleSession);
069
070    /**
071     * Notification that the session was closed due to an exception.
072     *
073     * @param e             the exception.
074     * @param jingleSession session that called the method
075     */
076    void sessionClosedOnError(XMPPException e, JingleSession jingleSession);
077
078    /**
079     * Notification that the Media has arrived for this session.
080     *
081     * @param jingleSession session that called the method
082     * @param participant description of the participant
083     */
084    void sessionMediaReceived(JingleSession jingleSession, String participant);
085
086}