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