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.jingle.listeners;
018
019import org.jivesoftware.smack.SmackException.NotConnectedException;
020import org.jivesoftware.smack.XMPPException;
021import org.jivesoftware.smackx.jingle.JingleSession;
022import org.jivesoftware.smackx.jingle.media.PayloadType;
023import org.jivesoftware.smackx.jingle.nat.TransportCandidate;
024
025/**
026 * Interface for listening for session events.
027 * @author Thiago Camargo
028 */
029public interface JingleSessionListener extends JingleListener {
030    /**
031     * Notification that the session has been established. Arguments specify
032     * the payload type and transport to use.
033     *
034     * @param pt            the Payload tyep to use
035     * @param remoteCandidate            the remote candidate to use for connecting to the remote
036     *                      service.
037     * @param localCandidate            the local candidate where we must listen for connections
038     * @param jingleSession Session that called the method
039     * @throws NotConnectedException 
040     */
041    public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
042                                   TransportCandidate localCandidate, JingleSession jingleSession) throws NotConnectedException;
043
044    /**
045     * Notification that the session was declined.
046     *
047     * @param reason        the reason (if any).
048     * @param jingleSession Session that called the method
049     */
050    public void sessionDeclined(String reason, JingleSession jingleSession);
051
052    /**
053     * Notification that the session was redirected.
054     *
055     * @param redirection
056     * @param jingleSession session that called the method
057     */
058    public void sessionRedirected(String redirection, JingleSession jingleSession);
059
060    /**
061     * Notification that the session was closed normally.
062     *
063     * @param reason        the reason (if any).
064     * @param jingleSession Session that called the method
065     */
066    public void sessionClosed(String reason, JingleSession jingleSession);
067
068    /**
069     * Notification that the session was closed due to an exception.
070     *
071     * @param e             the exception.
072     * @param jingleSession session that called the method
073     */
074    public void sessionClosedOnError(XMPPException e, JingleSession jingleSession);
075
076    /**
077     * Notification that the Media has arrived for this session.
078     *
079     * @param jingleSession session that called the method
080     * @param participant description of the participant
081     */
082    public void sessionMediaReceived(JingleSession jingleSession, String participant);
083        
084}