incude human readable text in some session-terminates
This commit is contained in:
parent
6a1df0538e
commit
39e3791345
|
@ -1064,7 +1064,7 @@ public class JingleFileTransferConnection extends AbstractJingleConnection imple
|
|||
|
||||
private void sendSessionTerminate(Reason reason) {
|
||||
final JinglePacket packet = bootstrapPacket(JinglePacket.Action.SESSION_TERMINATE);
|
||||
packet.setReason(reason);
|
||||
packet.setReason(reason, null);
|
||||
this.sendJinglePacket(packet);
|
||||
}
|
||||
|
||||
|
|
|
@ -246,10 +246,10 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
|||
final SessionDescription sessionDescription;
|
||||
try {
|
||||
sessionDescription = SessionDescription.of(contentMap);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (final IllegalArgumentException e) {
|
||||
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable convert offer from session-accept to SDP", e);
|
||||
webRTCWrapper.close();
|
||||
sendSessionTerminate(Reason.FAILED_APPLICATION);
|
||||
sendSessionTerminate(Reason.FAILED_APPLICATION, e.getMessage());
|
||||
return;
|
||||
}
|
||||
org.webrtc.SessionDescription answer = new org.webrtc.SessionDescription(
|
||||
|
@ -276,8 +276,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
|||
} catch (final IllegalArgumentException e) {
|
||||
Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": unable convert offer from session-initiate to SDP", e);
|
||||
webRTCWrapper.close();
|
||||
sendSessionTerminate(Reason.FAILED_APPLICATION);
|
||||
;
|
||||
sendSessionTerminate(Reason.FAILED_APPLICATION, e.getMessage());
|
||||
return;
|
||||
}
|
||||
sendSessionAccept(offer);
|
||||
|
@ -470,10 +469,14 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
|||
}
|
||||
|
||||
private void sendSessionTerminate(final Reason reason) {
|
||||
sendSessionTerminate(reason, null);
|
||||
}
|
||||
|
||||
private void sendSessionTerminate(final Reason reason, final String text) {
|
||||
final State target = reasonToState(reason);
|
||||
transitionOrThrow(target);
|
||||
final JinglePacket jinglePacket = new JinglePacket(JinglePacket.Action.SESSION_TERMINATE, id.sessionId);
|
||||
jinglePacket.setReason(reason);
|
||||
jinglePacket.setReason(reason, text);
|
||||
send(jinglePacket);
|
||||
Log.d(Config.LOGTAG, jinglePacket.toString());
|
||||
jingleConnectionManager.finishConnection(this);
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.support.annotation.NonNull;
|
|||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -81,9 +82,13 @@ public class JinglePacket extends IqPacket {
|
|||
return Reason.UNKNOWN;
|
||||
}
|
||||
|
||||
public void setReason(final Reason reason) {
|
||||
public void setReason(final Reason reason, final String text) {
|
||||
final Element jingle = findChild("jingle", Namespace.JINGLE);
|
||||
jingle.addChild("reason").addChild(reason.toString());
|
||||
final Element reasonElement = jingle.addChild("reason");
|
||||
reasonElement.addChild(reason.toString());
|
||||
if (!Strings.isNullOrEmpty(text)) {
|
||||
reasonElement.addChild("text").setContent(text);
|
||||
}
|
||||
}
|
||||
|
||||
//RECOMMENDED for session-initiate, NOT RECOMMENDED otherwise
|
||||
|
|
Loading…
Reference in New Issue