[Freeswitch-svn] [commit] r8018 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/soa

Freeswitch SVN mikej at freeswitch.org
Thu Apr 3 18:33:40 EDT 2008


Author: mikej
Date: Thu Apr  3 18:33:40 2008
New Revision: 8018

Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c

Log:
Thu Apr  3 11:09:19 EDT 2008  Pekka.Pessi at nokia.com
  * soa_static.c: when generating offer with ordered mode, fill gaps in session
  
  If session has m= lines that user SDP does not, the ordered mode got
  confused when generating 2nd offer (e.g., for re-INVITE).



Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Thu Apr  3 18:33:40 2008
@@ -1 +1 @@
-Thu Apr  3 18:33:04 EDT 2008
+Thu Apr  3 18:33:26 EDT 2008

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c	Thu Apr  3 18:33:40 2008
@@ -805,34 +805,37 @@
 	soa_sdp_media_upgrade_rtpmaps(ss, m, rm);
     }
   }
-  else if (sss->sss_ordered_user) {
-    /* Update session with unused media in u_media */
+  else {
 
-    if (!sss->sss_reuse_rejected) {
-      /* Mark previously used slots */
-      for (i = 0; i < Ns; i++) {
-	if (s_media[i])
-	  continue;
-	s_media[i] = soa_sdp_make_rejected_media(home, o_media[i], session, 0);
+    if (sss->sss_ordered_user) {
+      /* Update session with unused media in u_media */
+
+      if (!sss->sss_reuse_rejected) {
+	/* Mark previously used slots */
+	for (i = 0; i < Ns; i++) {
+	  if (s_media[i])
+	    continue;
+	  s_media[i] = 
+	    soa_sdp_make_rejected_media(home, o_media[i], session, 0);
+	}
       }
-    }
 
-    for (j = 0; j < Nu; j++) {
-      if (u_media[j] == SDP_MEDIA_NONE)
-	continue;
+      for (j = 0; j < Nu; j++) {
+	if (u_media[j] == SDP_MEDIA_NONE)
+	  continue;
 
-      for (i = 0; i < size - 1; i++) {
-	if (s_media[i] == NULL) {
-	  s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
-	  u2s[j] = i, s2u[i] = j;
-	  break;
+	for (i = 0; i < size - 1; i++) {
+	  if (s_media[i] == NULL) {
+	    s_media[i] = u_media[j], u_media[j] = SDP_MEDIA_NONE;
+	    u2s[j] = i, s2u[i] = j;
+	    break;
+	  }
 	}
-      }
 
-      assert(i != size - 1);
+	assert(i != size - 1);
+      }
     }
-  }
-  else {
+
     /* Match unused user media by media types with the existing session */
     for (i = 0; i < Ns; i++) {
       if (s_media[i])

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c	Thu Apr  3 18:33:40 2008
@@ -1389,9 +1389,6 @@
     "v=0\r\n"
     "o=a 432432423423 2 IN IP4 127.0.0.2\r\n"
     "c=IN IP4 127.0.0.2\r\n"
-    "m=audio 5004 RTP/AVP 0 8\n"
-    "a=rtpmap:96 G7231/8000\n"
-    "a=rtpmap:97 G729/8000\n"
     "m=image 5556 UDPTL t38\r\n"
     "a=T38FaxVersion:0\r\n"
     "a=T38MaxBitRate:9600\r\n"
@@ -1399,12 +1396,16 @@
     "a=T38FaxTranscodingMMR:0\r\n"
     "a=T38FaxTranscodingJBIG:0\r\n"
     "a=T38FaxRateManagement:transferredTCF\r\n"
-    "a=T38FaxMaxDatagram:400\r\n";
+    "a=T38FaxMaxDatagram:400\r\n"
+    "m=audio 5004 RTP/AVP 0 8\n"
+    "a=rtpmap:96 G7231/8000\n"
+    "a=rtpmap:97 G729/8000\n";
 
   char const a_caps2[] = 
     "v=0\r\n"
     "o=a 432432423423 2 IN IP4 127.0.0.2\r\n"
     "c=IN IP4 127.0.0.2\r\n"
+    "m=image 0 UDPTL t38\r\n"
     "m=image 5004 UDPTL t38\r\n"
     "a=T38FaxVersion:0\r\n"
     "a=T38MaxBitRate:9600\r\n"
@@ -1464,15 +1465,15 @@
   TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
 
   TEST_1(a_sdp->sdp_media);
-  TEST_1(a_sdp->sdp_media->m_type == sdp_media_audio);
+  TEST_1(a_sdp->sdp_media->m_type == sdp_media_image);
   TEST_1(a_sdp->sdp_media->m_next);
-  TEST_1(a_sdp->sdp_media->m_next->m_type == sdp_media_image);
+  TEST_1(a_sdp->sdp_media->m_next->m_type == sdp_media_audio);
 
   /* ---------------------------------------------------------------------- */
 
   /* Re-O/A: replace media stream */
 
-  /* Accept media without common codecs */
+  /* Do not accept media without common codecs */
   TEST_1(soa_set_params(b, SOATAG_RTP_MISMATCH(0),
 			SOATAG_USER_SDP_STR(b_caps2),
 			TAG_END()) > 0);
@@ -1481,7 +1482,7 @@
   n = soa_get_local_sdp(b, &b_sdp, &offer, &offerlen); TEST(n, 1);
   TEST_1(offer != NULL && offer != NONE);
   n = soa_set_remote_sdp(a, 0, offer, offerlen); TEST(n, 1);
-  /*printf("offer 2:\n%s", offer);*/
+  printf("offer 2:\n%s", offer);
   TEST_1(soa_set_params(a, SOATAG_RTP_MISMATCH(0),
 			SOATAG_USER_SDP_STR(a_caps2),
 			TAG_END()) > 0);
@@ -1489,7 +1490,7 @@
   n = soa_generate_answer(a, test_completed); TEST(n, 0);
   n = soa_get_local_sdp(a, &a_sdp, &answer, &answerlen); TEST(n, 1);
   TEST_1(answer != NULL && answer != NONE);
-  /*printf("answer 2:\n%s", answer);*/
+  printf("answer 2:\n%s", answer);
   n = soa_set_remote_sdp(b, 0, answer, -1); TEST(n, 1);
   n = soa_process_answer(b, test_completed); TEST(n, 0);
   n = soa_get_local_sdp(b, &b_sdp, NULL, NULL); TEST(n, 1);
@@ -1500,13 +1501,15 @@
   TEST_1(soa_is_complete(b));
   TEST(soa_activate(b, NULL), 0);
 
-  TEST_1(m = a_sdp->sdp_media); TEST_1(!m->m_rejected);
+  TEST_1(m = a_sdp->sdp_media); TEST_1(m->m_rejected);
+  TEST_1(m = m->m_next);
   TEST(m->m_type, sdp_media_image);
   TEST(m->m_proto, sdp_proto_udptl);
   TEST_1(m->m_format); 
   TEST_S(m->m_format->l_text, "t38"); 
 
-  TEST_1(m = b_sdp->sdp_media); TEST_1(!m->m_rejected);
+  TEST_1(m = b_sdp->sdp_media); TEST_1(m->m_rejected);
+  TEST_1(m = m->m_next);
   TEST(m->m_type, sdp_media_image);
   TEST(m->m_proto, sdp_proto_udptl);
   TEST_1(m->m_format); 



More information about the Freeswitch-svn mailing list