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

Freeswitch SVN mikej at freeswitch.org
Fri Jan 25 14:57:47 EST 2008


Author: mikej
Date: Fri Jan 25 14:57:46 2008
New Revision: 7361

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/soa_tag.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/test_soa.c

Log:
Wed Jan 23 10:07:30 EST 2008  Pekka Pessi <Pekka.Pessi at nokia.com>
  * soa_static.c: fixed signedness error
Shall I unpull this patch? (8/128)  [ynWvpxqadjk], or ? for help: y

Tue Jan 22 11:35:44 EST 2008  Pekka.Pessi at nokia.com
  * test_soa.c: testing hold with inactive, offered mode and setting remote activity flags while in hold
Shall I unpull this patch? (15/128)  [ynWvpxqadjk], or ? for help: y

Mon Jan 21 14:08:08 EST 2008  Pekka.Pessi at nokia.com
  * soa_static.c: soa_sdp_mode_set() now includes wanted media state in offer

  The wanted media state is based on original user SDP and SOATAG_HOLD()
  content. Removed soa_sdp_mode_set_is_needed(), using dry-run parameter
  instead.

Shall I unpull this patch? (20/128)  [ynWvpxqadjk], or ? for help: y

Thu Jan 17 11:40:46 EST 2008  Pekka Pessi <Pekka.Pessi at nokia.com>
  * soa_static.c: cleaned inactive hold, added tests
Shall I unpull this patch? (31/128)  [ynWvpxqadjk], or ? for help: y

Fri Jan 11 09:15:18 EST 2008  Pekka.Pessi at nokia.com
  * soa_tag.c: documented SOATAG_HOLD() inactive mode
Shall I unpull this patch? (46/128)  [ynWvpxqadjk], or ? for help: y

Fri Jan 11 09:12:01 EST 2008  Bernhard Suttner <suttner at comdasys.com>
  * Using # in SOATAG_HOLD to set media as inactive instead of sendonly
Shall I unpull this patch? (47/128)  [ynWvpxqadjk], or ? for help: y

revert a few more patches from sofia-sip darcs





Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Fri Jan 25 14:57:46 2008
@@ -1 +1 @@
-Fri Jan 25 12:44:19 EST 2008
+Fri Jan 25 14:56:46 EST 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	Fri Jan 25 14:57:46 2008
@@ -974,28 +974,58 @@
   return 0;
 }
 
+/** Check if @a session mode should be changed. */ 
+static
+int soa_sdp_mode_set_is_needed(sdp_session_t const *session,
+			       sdp_session_t const *remote,
+			       char const *hold)
+{
+  sdp_media_t const *sm, *rm, *rm_next;
+  int hold_all;
+  sdp_mode_t recv_mode;
+
+  SU_DEBUG_7(("soa_sdp_mode_set_is_needed(%p, %p, \"%s\"): called\n",
+	      (void *)session, (void *)remote, hold ? hold : ""));
+
+  if (!session )
+    return 0;
+
+  hold_all = str0cmp(hold, "*") == 0;
+
+  rm = remote ? remote->sdp_media : NULL, rm_next = NULL;
+
+  for (sm = session->sdp_media; sm; sm = sm->m_next, rm = rm_next) {
+    rm_next = rm ? rm->m_next : NULL;
+
+    if (sm->m_rejected)
+      continue;
+
+    if (rm) {
+      /* Mode bits do not match */
+      if (((rm->m_mode & sdp_recvonly) == sdp_recvonly)
+	  != ((sm->m_mode & sdp_sendonly) == sdp_sendonly))
+	return 1;
+    }
+
+    recv_mode = sm->m_mode & sdp_recvonly;
+    if (recv_mode && hold &&
+	(hold_all || strcasestr(hold, sm->m_type_name)))
+      return 1;
+  }
 
-/** Update mode within session.
- *
- * @sa soatag_hold
- *
- * @retval 1 if session was changed (or to be changed, if @a dryrun is nonzero)
- */ 
+  return 0;
+}
+
+
+/** Update mode within session */ 
 static
-int soa_sdp_mode_set(sdp_session_t const *user,
-		     int const *s2u,
-		     sdp_session_t *session,
+int soa_sdp_mode_set(sdp_session_t *session,
 		     sdp_session_t const *remote,
-		     char const *hold,
-		     int dryrun)
+		     char const *hold)
 {
   sdp_media_t *sm;
-  sdp_media_t const *rm, *rm_next, *um;
-  int retval = 0, i, j;
+  sdp_media_t const *rm, *rm_next;
   int hold_all;
-  int inactive_all;
-  int inactive = 0;
-  char const *hold_media = NULL;
   sdp_mode_t send_mode, recv_mode;
 
   SU_DEBUG_7(("soa_sdp_mode_set(%p, %p, \"%s\"): called\n",
@@ -1007,58 +1037,25 @@
   rm = remote ? remote->sdp_media : NULL, rm_next = NULL;
 
   hold_all = str0cmp(hold, "*") == 0;
-  inactive_all = str0cmp(hold, "#") == 0;
-
-  i = 0;
 
-  for (sm = session->sdp_media; sm; sm = sm->m_next, rm = rm_next, i++) {
+  for (sm = session->sdp_media; sm; sm = sm->m_next, rm = rm_next) {
     rm_next = rm ? rm->m_next : NULL;
-    inactive = 0;
 
     if (sm->m_rejected)
       continue;
 
-    assert(s2u);
-
-    for (j = 0, um = user->sdp_media; j != s2u[i]; um = um->m_next, j++)
-      assert(um);
-    assert(um);
-
-    send_mode = um->m_mode & sdp_sendonly;
+    send_mode = sdp_sendonly;
     if (rm)
       send_mode = (rm->m_mode & sdp_recvonly) ? sdp_sendonly : 0;
 
-    recv_mode = um->m_mode & sdp_recvonly;
-
-    if (rm && rm->m_mode == sdp_inactive) {
-      send_mode = recv_mode = 0;
-    }
-    else if (inactive_all) {
-      send_mode = recv_mode = 0;
-    }
-    else if (hold_all) {
+    recv_mode = sm->m_mode & sdp_recvonly;
+    if (recv_mode && hold && (hold_all || strcasestr(hold, sm->m_type_name)))
       recv_mode = 0;
-    }
-    else if (hold && (hold_media = strcasestr(hold, sm->m_type_name))) {
-      recv_mode = 0;
-      hold_media += strlen(sm->m_type_name);
-      hold_media += strspn(hold_media, " \t");
-      if (hold_media[0] == '=') {
-	hold_media += strspn(hold, " \t");
-	if (strncasecmp(hold_media, "inactive", strlen("inactive")) == 0)
-	  recv_mode = send_mode = 0;
-      }
-    }
-
-    if (sm->m_mode != (unsigned)(recv_mode | send_mode))
-      retval = 1;
 
-    if (!dryrun) {
-      sm->m_mode = recv_mode | send_mode;
-    }
+    sm->m_mode = recv_mode | send_mode;
   }
 
-  return retval;
+  return 0;
 }
 
 enum offer_answer_action {
@@ -1216,22 +1213,16 @@
 
   /* Step D: Set media mode bits */
   switch (action) {
-    int const *s2u_;
-
   case generate_offer:
   case generate_answer:
   case process_answer:
-    s2u_ = s2u;
-
-    if (!s2u_) s2u_ = sss->sss_s2u;
-
-    if (soa_sdp_mode_set(user, s2u_, local, remote, ss->ss_hold, 1)) {
+    if (soa_sdp_mode_set_is_needed(local, remote, ss->ss_hold)) {
       if (local != local0) {
 	*local0 = *local, local = local0;
 	DUP_LOCAL(local);
       }
 
-      soa_sdp_mode_set(user, s2u_, local, remote, ss->ss_hold, 0);
+      soa_sdp_mode_set(local, remote, ss->ss_hold);
     }
     break;
   default:

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa_tag.c	Fri Jan 25 14:57:46 2008
@@ -585,22 +585,12 @@
 
 /**@def SOATAG_HOLD(x)
  *
- * Hold media stream or streams. 
- *
- * The hold media stream will have the attribute a=sendonly (meaning that
- * some hold announcements or pause music is sent to the held party but that
- * the held party should not generate any media) or a=inactive (meaning that
- * no media is sent). 
- *
- * When putting a SIP session on hold with sendonly, the application can
- * include, e.g., SOATAG_HOLD("audio") or SOATAG_HOLD("video") or
- * SOATAG_HOLD("audio, video") or SOATAG_HOLD("*") as @soa parameters. When
- * using inactive instead, the application should use "#" or
- * "audio=inactive" instead. When resuming the session, application should
- * include the tag SOATAG_HOLD(NULL).
- *
- * Note that last SOATAG_HOLD() in the tag list will override the
- * SOATAG_HOLD() tags before it.
+ * Hold media stream or streams. When putting a SIP session on hold, the
+ * application can include, e.g., SOATAG_HOLD("audio") or
+ * SOATAG_HOLD("video") or SOATAG_HOLD("audio, video") or SOATAG_HOLD("*")
+ * as @soa parameters. When resuming the session, it can include
+ * SOATAG_HOLD(NULL). Note that last SOATAG_HOLD() in the tag list will
+ * override the SOATAG_HOLD() tags before it.
  *
  * @par Used with
  *    soa_set_params(), soa_get_params(), soa_get_paramlist() \n

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 Jan 25 14:57:46 2008
@@ -451,67 +451,20 @@
   TEST(soa_is_audio_active(a), SOA_ACTIVE_SENDONLY);
   TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDONLY);
 
-  /* 'A' will put call inactive */
-  offer = NONE;
-  TEST(soa_set_params(a, SOATAG_HOLD("#"), TAG_END()), 1);
-
-  TEST(soa_generate_offer(a, 1, test_completed), 0);
-  TEST(soa_get_local_sdp(a, NULL, &offer, &offerlen), 1);
-  TEST_1(offer != NULL && offer != NONE);
-  TEST_1(strstr(offer, "a=inactive"));
-  TEST(soa_set_remote_sdp(b, 0, offer, offerlen), 1);
-  TEST(soa_generate_answer(b, test_completed), 0);
-  TEST_1(soa_is_complete(b));
-  TEST(soa_activate(b, NULL), 0);
-  TEST(soa_get_local_sdp(b, NULL, &answer, &answerlen), 1);
-  TEST_1(answer != NULL && answer != NONE);
-  TEST_1(strstr(answer, "a=inactive"));
-  TEST(soa_set_remote_sdp(a, 0, answer, -1), 1);
-  TEST(soa_process_answer(a, test_completed), 0);
-  TEST(soa_activate(a, NULL), 0);
-
-  TEST(soa_is_audio_active(a), SOA_ACTIVE_INACTIVE);
-  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_INACTIVE);
-
-  /* B will send an offer to A, but there is no change in O/A status */
-  TEST(soa_generate_offer(b, 1, test_completed), 0);
-  TEST(soa_get_local_sdp(b, NULL, &offer, &offerlen), 1);
-  TEST_1(offer != NULL && offer != NONE);
-  TEST_1(!strstr(offer, "a=inactive"));
-  printf("offer:\n%s", offer);
-  TEST(soa_set_remote_sdp(a, 0, offer, offerlen), 1);
-  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_SENDRECV);
-  TEST(soa_generate_answer(a, test_completed), 0);
-  TEST(soa_is_audio_active(a), SOA_ACTIVE_INACTIVE);
-  TEST(soa_is_remote_audio_active(a), SOA_ACTIVE_INACTIVE);
-  TEST_1(soa_is_complete(a));
-  TEST(soa_activate(a, NULL), 0);
-  TEST(soa_get_local_sdp(a, NULL, &answer, &answerlen), 1);
-  TEST_1(answer != NULL && answer != NONE);
-  TEST_1(strstr(answer, "a=inactive"));
-  printf("answer:\n%s", answer);
-  TEST(soa_set_remote_sdp(b, 0, answer, -1), 1);
-  TEST(soa_process_answer(b, test_completed), 0);
-  TEST(soa_activate(b, NULL), 0);
-
-
-  TEST(soa_is_audio_active(b), SOA_ACTIVE_INACTIVE);
-  TEST(soa_is_remote_audio_active(b), SOA_ACTIVE_INACTIVE);
-
   /* 'A' will release hold. */ 
   TEST(soa_set_params(a, SOATAG_HOLD(NULL), TAG_END()), 1);
 
   TEST(soa_generate_offer(a, 1, test_completed), 0);
   TEST(soa_get_local_sdp(a, NULL, &offer, &offerlen), 1);
   TEST_1(offer != NULL && offer != NONE);
-  TEST_1(!strstr(offer, "a=sendonly") && !strstr(offer, "a=inactive"));
+  TEST_1(!strstr(offer, "a=sendonly"));
   TEST(soa_set_remote_sdp(b, 0, offer, offerlen), 1);
   TEST(soa_generate_answer(b, test_completed), 0);
   TEST_1(soa_is_complete(b));
   TEST(soa_activate(b, NULL), 0);
   TEST(soa_get_local_sdp(b, NULL, &answer, &answerlen), 1);
   TEST_1(answer != NULL && answer != NONE);
-  TEST_1(!strstr(answer, "a=recvonly") && !strstr(answer, "a=inactive"));
+  TEST_1(!strstr(answer, "a=recvonly"));
   TEST(soa_set_remote_sdp(a, 0, answer, -1), 1);
   TEST(soa_process_answer(a, test_completed), 0);
   TEST(soa_activate(a, NULL), 0);



More information about the Freeswitch-svn mailing list