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;
021import org.jivesoftware.smackx.jingleold.JingleSession;
022import org.jivesoftware.smackx.jingleold.media.PayloadType;
023import org.jivesoftware.smackx.jingleold.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     * @throws InterruptedException 
041     */
042    public void sessionEstablished(PayloadType pt, TransportCandidate remoteCandidate,
043                                   TransportCandidate localCandidate, JingleSession jingleSession) throws NotConnectedException, InterruptedException;
044
045    /**
046     * Notification that the session was declined.
047     *
048     * @param reason        the reason (if any).
049     * @param jingleSession Session that called the method
050     */
051    public void sessionDeclined(String reason, JingleSession jingleSession);
052
053    /**
054     * Notification that the session was redirected.
055     *
056     * @param redirection
057     * @param jingleSession session that called the method
058     */
059    public void sessionRedirected(String redirection, JingleSession jingleSession);
060
061    /**
062     * Notification that the session was closed normally.
063     *
064     * @param reason        the reason (if any).
065     * @param jingleSession Session that called the method
066     */
067    public void sessionClosed(String reason, JingleSession jingleSession);
068
069    /**
070     * Notification that the session was closed due to an exception.
071     *
072     * @param e             the exception.
073     * @param jingleSession session that called the method
074     */
075    public void sessionClosedOnError(XMPPException e, JingleSession jingleSession);
076
077    /**
078     * Notification that the Media has arrived for this session.
079     *
080     * @param jingleSession session that called the method
081     * @param participant description of the participant
082     */
083    public void sessionMediaReceived(JingleSession jingleSession, String participant);
084
085}