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

FreeSWITCH SVN mikej at freeswitch.org
Fri May 15 09:03:08 PDT 2009


Author: mikej
Date: Fri May 15 11:03:07 2009
New Revision: 13333

Log:
Tue May 12 14:58:43 CDT 2009  Pekka Pessi <first.last at nokia.com>
  * test_soa: check larger sessions
  Ignore-this: fac46a2328bc0db501cd98e7a67309c0


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

Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Fri May 15 11:03:07 2009
@@ -1 +1 @@
-Fri May 15 11:02:00 CDT 2009
+Fri May 15 11:03:00 CDT 2009

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	Fri May 15 11:03:07 2009
@@ -1878,6 +1878,175 @@
 }
 
 
+int test_large_sessions(struct context *ctx)
+{
+  BEGIN();
+  int n;
+
+  soa_session_t *a, *b;
+
+  char const *offer = NONE, *answer = NONE;
+  isize_t offerlen = (isize_t)-1, answerlen = (isize_t)-1;
+
+  sdp_session_t const *a_sdp, *b_sdp;
+  sdp_media_t const *m;
+
+  char const a_caps[] =
+    "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 5556 UDPTL t38\r\n"
+    "m=audio 5004 RTP/AVP 0 8\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 5556 UDPTL t38\r\n"
+    "m=audio 5004 RTP/AVP 0\n"
+    "m=audio1 5006 RTP/AVP 8\n"
+    "m=audio2 5008 RTP/AVP 3\n"
+    "m=audio3 5010 RTP/AVP 9\n"
+    "m=audio4 5010 RTP/AVP 15\n"
+    ;
+
+  char const b_caps[] =
+    "v=0\r\n"
+    "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
+    "c=IN IP4 127.0.0.2\r\n"
+    "m=audio 5008 RTP/AVP 0 8\r\n"
+    ;
+
+  char const b_caps2[] =
+    "v=0\r\n"
+    "o=left 219498671 2 IN IP4 127.0.0.2\r\n"
+    "c=IN IP4 127.0.0.2\r\n"
+    "m=audio 5008 RTP/AVP 0 8\r\n"
+    "m=image 5008 UDPTL t38\r\n"
+    "m=audio00 5008 RTP/AVP 0 8\r\n"
+    "m=audio01 5006 RTP/AVP 8\n"
+    "m=audio02 5008 RTP/AVP 3\n"
+    "m=audio03 5010 RTP/AVP 9\n"
+    "m=audio04 5010 RTP/AVP 15\n"
+    ;
+
+  TEST_1(a = soa_create("static", ctx->root, ctx));
+  TEST_1(b = soa_create("static", ctx->root, ctx));
+
+  TEST_1(soa_set_params(a, SOATAG_ORDERED_USER(1),
+			TAG_END()) > 0);
+  TEST_1(soa_set_params(b, SOATAG_ORDERED_USER(1),
+			TAG_END()) > 0);
+
+  TEST(soa_set_user_sdp(a, 0, a_caps, strlen(a_caps)), 1);
+  TEST(soa_set_user_sdp(b, 0, b_caps, strlen(b_caps)), 1);
+
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(a, NULL, &offer, &offerlen); TEST(n, 1);
+  TEST_1(offer != NULL && offer != NONE);
+  /* printf("offer1: %s\n", offer); */
+  n = soa_set_remote_sdp(b, 0, offer, offerlen); TEST(n, 1);
+  n = soa_get_local_sdp(b, NULL, &answer, &answerlen); TEST(n, 0);
+  n = soa_generate_answer(b, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(b, &b_sdp, &answer, &answerlen); TEST(n, 1);
+  TEST_1(answer != NULL && answer != NONE);
+  /* printf("answer1: %s\n", answer); */
+  n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
+  n = soa_process_answer(a, test_completed); TEST(n, 0);
+
+  n = soa_get_local_sdp(a, &a_sdp, NULL, NULL); TEST(n, 1);
+
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+
+  TEST_1(soa_is_complete(a));
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
+  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_image);
+  TEST_1(a_sdp->sdp_media->m_next);
+  TEST_1(a_sdp->sdp_media->m_next->m_type == sdp_media_audio);
+
+  /* ---------------------------------------------------------------------- */
+  /* Re-O/A - activate image, add incompatible m= lines */
+
+  TEST_1(soa_set_params(b, SOATAG_RTP_MISMATCH(0),
+			SOATAG_USER_SDP_STR(b_caps2),
+			SOATAG_REUSE_REJECTED(1),
+			TAG_END()) > 0);
+
+  n = soa_generate_offer(b, 1, test_completed); TEST(n, 0);
+  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("offer2: %s\n", offer); */
+
+  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("answer2: %s\n", 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);
+
+  TEST_1(soa_is_complete(a));
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+
+  TEST_1(m = a_sdp->sdp_media);
+  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(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(soa_is_audio_active(a), SOA_ACTIVE_SENDRECV);
+  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
+
+  /* 2nd re-offer */
+  /* Add even more incompatible lines */
+  TEST_1(soa_set_params(a, SOATAG_RTP_MISMATCH(0),
+			SOATAG_USER_SDP_STR(a_caps2),
+			TAG_END()) > 0);
+
+  n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(a, NULL, &offer, &offerlen); TEST(n, 1);
+  TEST_1(offer != NULL && offer != NONE);
+  /* printf("offer3: %s\n", offer); */
+  n = soa_set_remote_sdp(b, 0, offer, offerlen); TEST(n, 1);
+  n = soa_get_local_sdp(b, NULL, &answer, &answerlen); TEST(n, 1);
+  n = soa_generate_answer(b, test_completed); TEST(n, 0);
+  n = soa_get_local_sdp(b, &b_sdp, &answer, &answerlen); TEST(n, 1);
+  TEST_1(answer != NULL && answer != NONE);
+  /* printf("answer3: %s\n", answer); */
+  n = soa_set_remote_sdp(a, 0, answer, -1); TEST(n, 1);
+  n = soa_process_answer(a, test_completed); TEST(n, 0);
+
+  n = soa_get_local_sdp(a, &a_sdp, NULL, NULL); TEST(n, 1);
+
+  TEST_1(soa_is_complete(b));
+  TEST(soa_activate(b, NULL), 0);
+
+  TEST_1(soa_is_complete(a));
+  TEST(soa_activate(a, NULL), 0);
+
+  TEST_VOID(soa_terminate(a, NULL));
+  TEST_VOID(soa_terminate(b, NULL));
+
+  TEST_VOID(soa_destroy(a));
+  TEST_VOID(soa_destroy(b));
+
+  END();
+}
+
+
 int test_asynch_offer_answer(struct context *ctx)
 {
   BEGIN();
@@ -2536,7 +2705,7 @@
 
   if (retval == 0) {
     retval |= test_address_selection(ctx); SINGLE_FAILURE_CHECK();
-
+    retval |= test_large_sessions(ctx); SINGLE_FAILURE_CHECK();
     retval |= test_params(ctx); SINGLE_FAILURE_CHECK();
     retval |= test_static_offer_answer(ctx); SINGLE_FAILURE_CHECK();
     retval |= test_codec_selection(ctx); SINGLE_FAILURE_CHECK();



More information about the Freeswitch-svn mailing list