Browse code

b/f:b2bua: if 200 to INV without SDP, use SDP from 18x for caller re-Invite

reported by Andrew Pogrebennyk

Conflicts:

core/AmB2BSession.cpp

Stefan Sayer authored on 23/09/2013 13:52:45
Showing 1 changed files
... ...
@@ -1039,19 +1039,28 @@ void AmB2BCallerSession::onB2BEvent(B2BEvent* ev)
1039 1039
     case NoReply:
1040 1040
     case Ringing:
1041 1041
       if (reply.cseq == invite_req.cseq) {
1042
-	if(reply.code < 200){
1043
-	  if ((!sip_relay_only) && sip_relay_early_media_sdp &&
1044
-	      reply.code>=180 && reply.code<=183 && (!reply.body.empty())) {
1045
-	    DBG("sending re-INVITE to caller with early media SDP\n");
1046
-	    if (reinviteCaller(reply)) {
1047
-	      ERROR("re-INVITEing caller for early session failed - "
1048
-		    "stopping this and other leg\n");
1049
-	      terminateOtherLeg();
1050
-	      terminateLeg();
1042
+
1043
+	if (reply.code < 200) {
1044
+
1045
+	  if ((!sip_relay_only) &&
1046
+	      (reply.code>=180 && reply.code<=183 && (!reply.body.empty()))) {
1047
+	    // save early media SDP
1048
+	    updateSessionDescription(reply.body);
1049
+
1050
+	    if (sip_relay_early_media_sdp) {
1051
+	      if (reinviteCaller(reply)) {
1052
+		ERROR("re-INVITEing caller for early session failed - "
1053
+		      "stopping this and other leg\n");
1054
+		terminateOtherLeg();
1055
+		terminateLeg();
1056
+		break;
1057
+	      }
1051 1058
 	    }
1059
+
1052 1060
 	  }
1053
-	  
1061
+
1054 1062
 	  callee_status = Ringing;
1063
+
1055 1064
 	} else if(reply.code < 300){
1056 1065
 	  
1057 1066
 	  callee_status  = Connected;
... ...
@@ -1060,7 +1069,14 @@ void AmB2BCallerSession::onB2BEvent(B2BEvent* ev)
1060 1069
 	    DBG("received 200 class reply to establishing INVITE: "
1061 1070
 		"switching to SIP relay only mode, sending re-INVITE to caller\n");
1062 1071
 	    sip_relay_only = true;
1063
-	    if (reinviteCaller(reply)) {
1072
+	    AmSipReply n_reply = reply;
1073
+
1074
+	    if (n_reply.body.empty() && !established_body.empty()) {
1075
+	      DBG("callee FR without SDP, using provisional response's (18x) one\n");
1076
+	      n_reply.body = established_body;
1077
+	    }
1078
+
1079
+	    if (reinviteCaller(n_reply)) {
1064 1080
 	      ERROR("re-INVITEing caller failed - stopping this and other leg\n");
1065 1081
 	      terminateOtherLeg();
1066 1082
 	      terminateLeg();