1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-10 17:49:38 +02:00

Fixes in Negotiations

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7720 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Thiago Camargo 2007-03-27 04:24:18 +00:00 committed by thiago
parent 99aae28885
commit 6059fb7b82
6 changed files with 145 additions and 99 deletions

View file

@ -136,18 +136,6 @@ public class IncomingJingleSession extends JingleSession {
updatePacketListener();
Jingle packet = initialJingleSessionRequest.getJingle();
if (packet != null) {
// Initialize the session information
setSid(packet.getSid());
respond(packet);
}
else {
throw new XMPPException(
"Session request with null Jingle packet.");
}
}
@ -173,6 +161,20 @@ public class IncomingJingleSession extends JingleSession {
* @throws XMPPException
*/
public void start(JingleSessionRequest initialJingleSessionRequest) throws XMPPException {
Jingle packet = initialJingleSessionRequest.getJingle();
if (packet != null) {
// Initialize the session information
setSid(packet.getSid());
sendAck(packet);
}
else {
throw new XMPPException(
"Session request with null Jingle packet.");
}
// Set the new session state
setState(pending);
}
/**
@ -181,15 +183,16 @@ public class IncomingJingleSession extends JingleSession {
* @throws XMPPException
*/
public void start() throws XMPPException {
start(this.getInitialSessionRequest());
}
/**
* Force a call acceptance. Used to accept a hooked call.
*
* @deprecated Avoid to use this method. Not compliance.
*/
public void accept(){
setState(active);
public void accept() {
setState(active);
}
/**
@ -230,8 +233,6 @@ public class IncomingJingleSession extends JingleSession {
* @throws XMPPException
*/
public Jingle eventInitiate(Jingle inJingle) throws XMPPException {
// Set the new session state
setState(pending);
return super.eventInitiate(inJingle);
}

View file

@ -202,6 +202,7 @@ public abstract class JingleSession extends JingleNegotiator {
/**
* Get the JingleMediaSession of this Jingle Session
*
* @return the JingleMediaSession
*/
public JingleMediaSession getJingleMediaSession() {
@ -428,8 +429,7 @@ public abstract class JingleSession extends JingleNegotiator {
jout = getState().eventInfo(jin);
}
else if (action.equals(Jingle.Action.SESSIONINITIATE)) {
if (getState() != null)
jout = getState().eventInitiate(jin);
jout = getState().eventInitiate(jin);
}
else if (action.equals(Jingle.Action.SESSIONREDIRECT)) {
jout = getState().eventRedirect(jin);
@ -493,7 +493,8 @@ public abstract class JingleSession extends JingleNegotiator {
}
// Acknowledge the IQ reception
sendAck(iq);
if (!(getState() instanceof IncomingJingleSession.Accepting))
sendAck(iq);
// ... and send all these parts in a Jingle response.
response = sendJingleParts(iq, (Jingle) sessionResponse,
@ -502,6 +503,7 @@ public abstract class JingleSession extends JingleNegotiator {
}
catch (JingleException e) {
// Send an error message, if present
System.out.println("E:" + iq);
JingleError error = e.getError();
if (error != null) {
sendFormattedError(iq, error);
@ -511,6 +513,9 @@ public abstract class JingleSession extends JingleNegotiator {
triggerSessionClosedOnError(e);
}
}
else {
System.out.println("K:" + iq);
}
return response;
}

View file

@ -244,6 +244,8 @@ public class STUN extends IQ {
return true;
}
System.out.println(item.getName()+"-"+info.getType());
}
}
catch (XMPPException e) {