Skip to content

Commit

Permalink
Patch to fail call if SDP negotiation on RE-Invite fails
Browse files Browse the repository at this point in the history
This close #2272
  • Loading branch information
gvagenas committed Jun 22, 2017
1 parent 95c3006 commit 774dd71
Show file tree
Hide file tree
Showing 4 changed files with 304 additions and 33 deletions.
7 changes: 6 additions & 1 deletion restcomm/restcomm.mgcp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,10 @@
<artifactId>akka-testkit_2.10</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>javax.sip</groupId>
<artifactId>jain-sip-ri</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
import org.mobicents.protocols.mgcp.jain.pkg.AUPackage;
import org.restcomm.connect.commons.util.RevolvingCounter;

import javax.sdp.SdpFactory;
import javax.sdp.SdpParseException;
import javax.sdp.SessionDescription;
import java.net.InetAddress;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -363,14 +366,34 @@ private void modifyConnection(final Object message, final ActorRef sender) {
final ActorRef self = self();
final ModifyConnection mdcx = (ModifyConnection) message;
System.out.println(mdcx.toString());
final ReturnCode code = ReturnCode.Transaction_Executed_Normally;
final ModifyConnectionResponse response = new ModifyConnectionResponse(self, code);
final ConnectionDescriptor descriptor = new ConnectionDescriptor(sdp);
response.setLocalConnectionDescriptor(descriptor);
final int transaction = mdcx.getTransactionHandle();
response.setTransactionHandle(transaction);
System.out.println(response.toString());
sender.tell(response, self);
ReturnCode code;
SessionDescription sessionDescription = null;
boolean isNonValidSdp = false;
if (mdcx.getRemoteConnectionDescriptor()!=null) {
try {
sessionDescription = SdpFactory.getInstance().createSessionDescription(mdcx.getRemoteConnectionDescriptor().toString());
isNonValidSdp = sessionDescription.getSessionName().getValue().contains("NonValidSDP");
} catch (SdpParseException e) {
logger.error("Error while trying to get SDP from MDCX");
}
}
if (sessionDescription != null && isNonValidSdp) {
code = ReturnCode.Protocol_Error;
final ModifyConnectionResponse response = new ModifyConnectionResponse(self, code);
final int transaction = mdcx.getTransactionHandle();
response.setTransactionHandle(transaction);
System.out.println(response.toString());
sender.tell(response, self);
} else {
code = ReturnCode.Transaction_Executed_Normally;
final ModifyConnectionResponse response = new ModifyConnectionResponse(self, code);
final ConnectionDescriptor descriptor = new ConnectionDescriptor(sdp);
response.setLocalConnectionDescriptor(descriptor);
final int transaction = mdcx.getTransactionHandle();
response.setTransactionHandle(transaction);
System.out.println(response.toString());
sender.tell(response, self);
}
}

private void deleteConnection(final Object message, final ActorRef sender) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2471,7 +2471,7 @@ private void onMediaServerControllerStateChanged(MediaServerControllerStateChang
break;

case FAILED:
if (is(initializing) || is(updatingMediaSession) || is(joining) || is(leaving)) {
if (is(initializing) || is(updatingMediaSession) || is(joining) || is(leaving) || is(inProgress)) {
fsm.transition(message, failed);
}
break;
Expand Down
Loading

0 comments on commit 774dd71

Please sign in to comment.