[Freeswitch-branches] [commit] r4936 - in freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip: . libsofia-sip-ua/iptsec/sofia-sip libsofia-sip-ua/nta libsofia-sip-ua/nua libsofia-sip-ua/soa libsofia-sip-ua/soa/sofia-sip

Freeswitch SVN mikej at freeswitch.org
Sat Apr 14 21:23:41 EDT 2007


Author: mikej
Date: Sat Apr 14 21:23:41 2007
New Revision: 4936

Modified:
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/RELEASE
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/configure.ac
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_offer_answer.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/soa/soa.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_session.h

Log:
sync to sofia darcs tree

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/RELEASE
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/RELEASE	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/RELEASE	Sat Apr 14 21:23:41 2007
@@ -13,6 +13,10 @@
 ------------------------------
 
 libsofia-sip-ua:
+- Use calling/received callstate in nua_i_state event sent because of UPDATE
+  while call is ready
+- Added tag define NUTAG_WITH_CURRENT() as an alias to NUTAG_WITH_THIS()
+- Added tag NUTAG_DIALOG() controlling whether nua_method() creates a dialog.
 - Added tag NUTAG_AUTH_CACHE() <sofia-sip/nua_tag.h> determining when to 
   include credentials in the request
 - Added kqueue and /dev/poll interfaces (su_devpoll_port_create(),
@@ -23,6 +27,9 @@
   ("100rel" and "precondition" extensions now require explicit calls to
   nua_update() and nua_prack() if those methods are included in
   NUTAG_APPL_METHOD())
+- Added auc_clear field and member to authentication client plugin interface
+  in <sofia-sip/auth_client_plugin.h>
+- Added nua_event_is_incoming_request() to <sofia-sip/nua.h>
 - This release is ABI/API compatible with applications linked against 
   any 1.12.x release. However, applications built against this release won't 
   work against an older library. The ABI has been tested with the nua module 
@@ -52,21 +59,30 @@
 X. There is also select-based reactor for systems without poll().
 
 The client authentication in nua has been updated. The nextnonce in
-Authentication-Info or Proxy-Authentication-Info headers is now. The
-NUTAG_AUTH_CACHE() policy determines how the cached credentials are used. By
-default, the credentials are included in each request within the dialog,
-however, with the NUTAG_AUTH_CACHE(nua_auth_cache_challenged) the client
-authenticates requests only after they have been challenged.
+Authentication-Info or Proxy-Authentication-Info headers is now used during
+the next . The NUTAG_AUTH_CACHE() policy determines how the cached
+credentials are used. By default, the credentials are included in each
+request within the dialog, however, with the
+NUTAG_AUTH_CACHE(nua_auth_cache_challenged) the client authenticates
+requests only after they have been challenged.
 
 The application can now fully control the SDP negotiation (when soa is
 disabled with NUTAG_MEDIA_ENABLE(0)). The application can send UPDATE and
-PRACK requests and respond to them.
+PRACK requests and respond to them. The callstate sent in nua_i_state after
+UPDATE while the call has already been completed has been also changed.
 
 Bugs fixed in this release
 --------------------------
 
+- Fixed status code sent to network and returned to the client if there was
+  an internal error while responding to a request. 
+  The problem was reported by Michael Jerris and Joshua Engelbrecht.
+- Fixed #1685249, unclear termination of call in absense of credentials by
+  nua_authenticate(). Problem reported by Mikhail Zabaluev.
 - Fixed status code reported to application when REGISTER transaction was
   restarted by nua stack. Problem reported by Mikhail Zabaluev.
+- An invalid Contact was used if STUN was disabled but there was no STUN
+  server. Problem reported by Miguel Freitas.
 - Fixed problem logging long lines from with TPORT_LOG.
   Problem reported by Mike Murdock and Michael Jerris.
 - Nua now includes the SDP capabilities in the response to the OPTIONS

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/configure.ac
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/configure.ac	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/configure.ac	Sat Apr 14 21:23:41 2007
@@ -11,7 +11,7 @@
 dnl ---------------------------
 
 dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
-AC_INIT([sofia-sip], [1.12.5work3])
+AC_INIT([sofia-sip], [1.12.5work6])
 AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
 AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.12])
 dnl Includedir specific to this sofia version

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_client_plugin.h	Sat Apr 14 21:23:41 2007
@@ -98,7 +98,7 @@
 /** Check if authentication client has been extended. @NEW_1_12_6 */
 #define AUTH_CLIENT_IS_EXTENDED(ca)					\
   ((ca)->ca_auc->auc_plugin_size >					\
-   offsetof(auth_client_plugin_t, auc_clear)				\
+   (int)offsetof(auth_client_plugin_t, auc_clear)			\
    && (ca)->ca_auc->auc_clear != NULL)
 
 SOFIA_END_DECLS

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta	Sat Apr 14 21:23:41 2007
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
 #
 # Run nta_test with our own name server
 #
@@ -50,11 +50,11 @@
 
 me6="::1"
 
-if ../su/localinfo -6 -n -g -s >& /dev/null ; then
+if ../su/localinfo -6 -n -g -s > /dev/null 2>&1 ; then
     ipv6=true aaaa=aaaa v6flag=-6
     me6=$(../su/localinfo -6 -n -s -g | awk '{print $1; exit(0); }')
 else
-    if ! ../su/localinfo '--help' >& /dev/null ; then
+    if ! ../su/localinfo '--help' > /dev/null 2>&1 ; then
 	echo "warning: $0: missing 'localinfo', cannot test IPv6"
     else
 	echo "warning: $0: no valid IPv6 addresses available"
@@ -62,7 +62,7 @@
     ipv6=false aaaa=a
 fi
 
-if type named >& /dev/null && ./portbind --help >& /dev/null
+if type named > /dev/null 2>&1 && ./portbind --help > /dev/null 2>&1
 then
 
 port=$(./portbind $v6flag) sink=$port

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c	Sat Apr 14 21:23:41 2007
@@ -1511,9 +1511,26 @@
 int nua_base_server_respond(nua_server_request_t *sr, tagi_t const *tags)
 {
   msg_t *response = sr->sr_response.msg;
+  sip_t *sip = sr->sr_response.sip;
 
   sr->sr_response.msg = NULL, sr->sr_response.sip = NULL;
 
+  if (sr->sr_status != sip->sip_status->st_status) {
+    msg_header_remove(response, (msg_pub_t *)sip,
+		      (msg_header_t *)sip->sip_status);
+    nta_incoming_complete_response(sr->sr_irq, response,
+				   sr->sr_status,
+				   sr->sr_phrase,    
+				   TAG_END());
+  }
+
+  if (sr->sr_status != sip->sip_status->st_status) {
+    msg_destroy(response);
+    SR_STATUS1(sr, SIP_500_INTERNAL_SERVER_ERROR);
+    nta_incoming_treply(sr->sr_irq, sr->sr_status, sr->sr_phrase, TAG_END());
+    return 0;
+  }
+
   return nta_incoming_mreply(sr->sr_irq, response);
 }
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c	Sat Apr 14 21:23:41 2007
@@ -1063,7 +1063,7 @@
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
   TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
-  TEST(callstate(e->data->e_tags), nua_callstate_completed); /* EARLY */
+  TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_bye);
   TEST(e->data->e_status, 200);
   TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
@@ -1188,13 +1188,13 @@
    |			|
 */
   if (print_headings)
-    printf("TEST NUA-6.4: BYE after sending 401\n");
+    printf("TEST NUA-6.4.1: BYE after sending 401\n");
 
   TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
 
   INVITE(a, a_call, a_call->nh,
 	 TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
-	 SIPTAG_SUBJECT_STR("NUA-6.4"),
+	 SIPTAG_SUBJECT_STR("NUA-6.4.1"),
 	 SOATAG_USER_SDP_STR(a_call->sdp),
 	 NUTAG_AUTOANSWER(0),
 	 TAG_END());
@@ -1208,7 +1208,7 @@
 
   /* re-INVITE A. */
   INVITE(b, b_call, b_call->nh, 
-	 SIPTAG_SUBJECT_STR("NUA-6.4 re-INVITE"),
+	 SIPTAG_SUBJECT_STR("NUA-6.4.1 re-INVITE"),
 	 TAG_END());
   run_ab_until(ctx, -1, reject_reinvite_401, -1, until_final_response);
 
@@ -1229,7 +1229,7 @@
   nua_handle_destroy(b_call->nh), b_call->nh = NULL;
 
   if (print_headings)
-    printf("TEST NUA-6.4: PASSED\n");
+    printf("TEST NUA-6.4.1: PASSED\n");
 
   END();
 }
@@ -1262,13 +1262,13 @@
    |			|
 */
   if (print_headings)
-    printf("TEST NUA-6.5: BYE after receiving 401 to UPDATE\n");
+    printf("TEST NUA-6.4.2: BYE after receiving 401 to UPDATE\n");
 
   TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
 
   INVITE(a, a_call, a_call->nh,
 	 TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
-	 SIPTAG_SUBJECT_STR("NUA-6.5"),
+	 SIPTAG_SUBJECT_STR("NUA-6.4.2"),
 	 SOATAG_USER_SDP_STR(a_call->sdp),
 	 NUTAG_AUTOANSWER(0),
 	 NUTAG_APPL_METHOD("UPDATE"),
@@ -1283,7 +1283,7 @@
 
   /* UPDATE A. */
   UPDATE(b, b_call, b_call->nh, 
-	 SIPTAG_SUBJECT_STR("NUA-6.4 UPDATE"),
+	 SIPTAG_SUBJECT_STR("NUA-6.4.2 UPDATE"),
 	 TAG_END());
   BYE(b, b_call, b_call->nh, TAG_END()); /* Queued until nua_authenticate */
   run_ab_until(ctx, -1, reject_reinvite_401, -1, until_final_response);
@@ -1305,7 +1305,7 @@
   nua_handle_destroy(b_call->nh), b_call->nh = NULL;
 
   if (print_headings)
-    printf("TEST NUA-6.3: PASSED\n");
+    printf("TEST NUA-6.4.2: PASSED\n");
 
   END();
 }
@@ -1343,6 +1343,113 @@
   return 0;
 }
 
+int test_bye_to_invalid_contact(struct context *ctx)
+{
+  BEGIN();
+  struct endpoint *a = &ctx->a,  *b = &ctx->b;
+  struct call *a_call = a->call, *b_call = b->call;
+  struct event *e;
+
+  a_call->sdp = "m=audio 5008 RTP/AVP 8";
+  b_call->sdp = "m=audio 5010 RTP/AVP 0 8";
+
+/* Early BYE 2
+
+   A			B
+   |-------INVITE------>|
+   |<----100 Trying-----|
+   |			|
+   |<----180 Ringing----|
+   |<-------200---------|
+   |			|
+   |--------BYE-------->|
+   |<------200 OK-------|
+   |--------ACK-------->|
+   |			|
+   |			|
+*/
+  if (print_headings)
+    printf("TEST NUA-6.4.3: BYE call when completing\n");
+
+  TEST_1(a_call->nh = nua_handle(a->nua, a_call, SIPTAG_TO(b->to), TAG_END()));
+
+  INVITE(a, a_call, a_call->nh,
+	 TAG_IF(!ctx->proxy_tests, NUTAG_URL(b->contact->m_url)),
+	 SOATAG_USER_SDP_STR(a_call->sdp),
+	 SIPTAG_CONTACT(NULL),
+	 SIPTAG_HEADER_STR("Contact: <<sip:xyzzy at com.invalid>"),
+	 TAG_END());
+
+  run_ab_until(ctx, -1, until_ready, -1, accept_call);
+
+  /* Client transitions:
+     INIT -(C1)-> CALLING: nua_invite(), nua_i_state
+     CALLING -(C2)-> PROCEEDING: nua_r_invite(180, nua_i_state, nua_cancel()
+     PROCEEDING -(C6b)-> TERMINATED: nua_r_invite(487), nua_i_state
+  */
+  TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_calling);
+  TEST_1(is_offer_sent(e->data->e_tags));
+
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  TEST(e->data->e_status, 180);
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_proceeding); 
+
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  TEST(e->data->e_status, 200);
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_ready); 
+  TEST_1(!e->next);
+
+  /*
+   Server transitions:
+   INIT -(S1)-> RECEIVED: nua_i_invite, nua_i_state
+   RECEIVED -(S2a)-> EARLY: nua_respond(180), nua_i_state
+   EARLY -(S6b)--> TERMINATED: nua_i_cancel, nua_i_state
+  */
+  TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
+  TEST(e->data->e_status, 100);
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
+  TEST_1(is_offer_recv(e->data->e_tags));
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_completed); /* COMPLETED */
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_ack);
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_ready); /* READY */
+  TEST_1(!e->next);
+
+  free_events_in_list(ctx, a->events);
+  free_events_in_list(ctx, b->events);
+
+  BYE(b, b_call, b_call->nh, TAG_END());
+  
+  run_b_until(ctx, -1, until_terminated);
+
+  /* B transitions:
+   READY --(T2)--> TERMINATING: nua_bye()
+   TERMINATING --(T3)--> TERMINATED: nua_r_bye, nua_i_state
+  */
+  TEST_1(e = b->events->head);  TEST_E(e->data->e_event, nua_r_bye);
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* TERMINATED */
+  TEST_1(!e->next);
+  free_events_in_list(ctx, b->events);
+
+  TEST_1(!nua_handle_has_active_call(b_call->nh));
+  TEST_1(nua_handle_has_active_call(a_call->nh));
+
+  nua_handle_destroy(a_call->nh), a_call->nh = NULL;
+  nua_handle_destroy(b_call->nh), b_call->nh = NULL;
+
+  if (print_headings)
+    printf("TEST NUA-6.4.3: PASSED\n");
+
+  END();
+}
 
 int test_early_bye(struct context *ctx)
 {
@@ -1352,5 +1459,6 @@
     test_bye_after_receiving_401(ctx) ||
     test_bye_after_sending_401(ctx) ||
     test_bye_after_receiving_401_to_update(ctx) ||
+    test_bye_to_invalid_contact(ctx) ||
     0;
 }

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_offer_answer.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_offer_answer.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_offer_answer.c	Sat Apr 14 21:23:41 2007
@@ -349,6 +349,7 @@
     return 0;
   case nua_callstate_early:
     RESPOND(ep, call, nh, SIP_200_OK,
+	    NUTAG_MEDIA_ENABLE(1),
 	    TAG_IF(call->sdp, SOATAG_USER_SDP_STR(call->sdp)),
 	    TAG_END());
     return 0;
@@ -362,8 +363,117 @@
 }
 
 
+/* No offer in INVITE, no user SDP in 200 OK */
+int test_missing_user_sdp(struct context *ctx)
+{
+  BEGIN();
+
+  struct endpoint *a = &ctx->a,  *b = &ctx->b;
+  struct call *a_call = a->call, *b_call = b->call;
+  struct event *e;
+
+  if (print_headings)
+    printf("TEST NUA-6.6.2: No SDP offer from caller\n");
+
+  a_call->sdp = "v=0\r\n"
+    "o=- 1 1 IN IP4 127.0.0.1\r\n"
+    "s=-\r\n"
+    "c=IN IP4 127.0.0.1\r\n"
+    "t=0 0\r\n"
+    "m=audio 5008 RTP/AVP 8\r\n";
+
+  b_call->sdp = NULL;
+
+  nua_set_params(b->nua, NUTAG_MEDIA_ENABLE(0), TAG_END());
+  run_b_until(ctx, nua_r_set_params, until_final_response);
+
+  TEST_1(a_call->nh = nua_handle(a->nua, a_call, 
+				 SIPTAG_TO_STR("<sip:b at x.org>"),
+				 TAG_END()));
+
+  TEST_1(!nua_handle_has_active_call(a_call->nh));
+  TEST_1(!nua_handle_has_call_on_hold(a_call->nh));
+
+  INVITE(a, a_call, a_call->nh,
+	 NUTAG_MEDIA_ENABLE(0),
+	 NUTAG_URL(b->contact->m_url),
+	 NUTAG_AUTOACK(1),
+	 TAG_END());
+
+  run_ab_until(ctx, -1, until_terminated,
+	       -1, accept_call_until_terminated);
+
+  /* Client transitions:
+     INIT -(C1)-> CALLING: nua_invite(), nua_i_state
+     CALLING -(C2)-> PROCEEDING: nua_r_invite, nua_i_state
+     PROCEEDING -(C3+C4)-> READY: nua_r_invite, nua_i_state
+  */
+  TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_calling); /* CALLING */
+  TEST_1(!is_offer_sent(e->data->e_tags));
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  TEST(e->data->e_status, 180);
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_proceeding); /* PROCEEDING */
+  TEST_1(!is_answer_recv(e->data->e_tags));
+  TEST_1(!is_offer_recv(e->data->e_tags));
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_r_invite);
+  TEST(e->data->e_status, 500);
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* READY */
+  TEST_1(!e->next);
+  free_events_in_list(ctx, a->events);
+
+  TEST_1(!nua_handle_has_active_call(a_call->nh));
+  TEST_1(!nua_handle_has_call_on_hold(a_call->nh));
+
+  /*
+   Server transitions:
+   INIT -(S1)-> RECEIVED: nua_i_invite, nua_i_state
+   RECEIVED -(S2a)-> EARLY: nua_respond(), nua_i_state
+   EARLY -(S3b)-> COMPLETED: nua_respond(), nua_i_state
+   COMPLETED -(S4)-> READY: nua_i_ack, nua_i_state
+  */
+  TEST_1(e = b->events->head); TEST_E(e->data->e_event, nua_i_invite);
+  TEST(e->data->e_status, 100);
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_received); /* RECEIVED */
+  TEST_1(!is_offer_recv(e->data->e_tags));
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_early); /* EARLY */
+  TEST_1(!is_answer_sent(e->data->e_tags));
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_error);
+  TEST(e->data->e_status, 500);
+  TEST_1(e = e->next); TEST_E(e->data->e_event, nua_i_state);
+  TEST(callstate(e->data->e_tags), nua_callstate_terminated); /* COMPLETED */
+  TEST_1(!e->next);
+  free_events_in_list(ctx, b->events);
+
+  TEST_1(!nua_handle_has_active_call(b_call->nh));
+  TEST_1(!nua_handle_has_call_on_hold(b_call->nh));
+
+  nua_handle_destroy(a_call->nh), a_call->nh = NULL;
+  nua_handle_destroy(b_call->nh), b_call->nh = NULL;
+
+  nua_set_params(b->nua,
+		 NUTAG_MEDIA_ENABLE(1), 
+		 SOATAG_USER_SDP_STR("m=audio 5006 RTP/AVP 8 0"),
+		 TAG_END());
+  run_b_until(ctx, nua_r_set_params, until_final_response);
+
+  if (print_headings)
+    printf("TEST NUA-6.6.2: PASSED\n");
+
+  END();
+}
+
+
 
 int test_offer_answer(struct context *ctx)
 {
-  return test_no_answer_1(ctx) || test_no_answer_2(ctx);
+  return
+    test_no_answer_1(ctx) ||
+    test_no_answer_2(ctx) ||
+    test_missing_user_sdp(ctx) ||
+    0;
 }

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/soa/soa.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/soa/soa.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/soa/soa.c	Sat Apr 14 21:23:41 2007
@@ -1799,49 +1799,65 @@
 /** Return true if audio has been activated. */
 int soa_is_audio_active(soa_session_t const *ss)
 {
-  return ss ? ss->ss_local_activity->ma_audio : SOA_ACTIVE_DISABLED;
+  int ma = ss ? ss->ss_local_activity->ma_audio : SOA_ACTIVE_DISABLED;
+  if (ma >= 4) ma |= -8;
+  return ma;
 }
 
 /** Return true if video has been activated. */
 int soa_is_video_active(soa_session_t const *ss)
 {
-  return ss ? ss->ss_local_activity->ma_video : SOA_ACTIVE_DISABLED;
+  int ma = ss ? ss->ss_local_activity->ma_video : SOA_ACTIVE_DISABLED;
+  if (ma >= 4) ma |= -8;
+  return ma;
 }
 
 /** Return true if image sharing has been activated. */
 int soa_is_image_active(soa_session_t const *ss)
 {
-  return ss ? ss->ss_local_activity->ma_image : SOA_ACTIVE_DISABLED;
+  int ma = ss ? ss->ss_local_activity->ma_image : SOA_ACTIVE_DISABLED;
+  if (ma >= 4) ma |= -8;
+  return ma;
 }
 
 /** Return true if messaging session has been activated. */
 int soa_is_chat_active(soa_session_t const *ss)
 {
-  return ss ? ss->ss_local_activity->ma_chat : SOA_ACTIVE_DISABLED;
+  int ma = ss ? ss->ss_local_activity->ma_chat : SOA_ACTIVE_DISABLED;
+  if (ma >= 4) ma |= -8;
+  return ma;
 }
 
 /** Return true if remote audio is active (not on hold). */
 int soa_is_remote_audio_active(soa_session_t const *ss)
 {
-  return ss ? ss->ss_remote_activity->ma_audio : SOA_ACTIVE_DISABLED;
+  int ma = ss ? ss->ss_remote_activity->ma_audio : SOA_ACTIVE_DISABLED;
+  if (ma >= 4) ma |= -8;
+  return ma;
 }
 
 /** Return true if remote video is active (not on hold). */
 int soa_is_remote_video_active(soa_session_t const *ss)
 {
-  return ss ? ss->ss_remote_activity->ma_video : SOA_ACTIVE_DISABLED;
+  int ma = ss ? ss->ss_remote_activity->ma_video : SOA_ACTIVE_DISABLED;
+  if (ma >= 4) ma |= -8;
+  return ma;
 }
 
 /** Return true if image sharing is active (not on hold). */
 int soa_is_remote_image_active(soa_session_t const *ss)
 {
-  return ss ? ss->ss_remote_activity->ma_image : SOA_ACTIVE_DISABLED;
+  int ma = ss ? ss->ss_remote_activity->ma_image : SOA_ACTIVE_DISABLED;
+  if (ma >= 4) ma |= -8;
+  return ma;
 }
 
 /** Return true if chat session is active (not on hold). */
 int soa_is_remote_chat_active(soa_session_t const *ss)
 {
-  return ss ? ss->ss_remote_activity->ma_chat : SOA_ACTIVE_DISABLED;
+  int ma = ss ? ss->ss_remote_activity->ma_chat : SOA_ACTIVE_DISABLED;
+  if (ma >= 4) ma |= -8;
+  return ma;
 }
 
 /* ======================================================================== */

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_session.h
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_session.h	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/soa/sofia-sip/soa_session.h	Sat Apr 14 21:23:41 2007
@@ -163,10 +163,10 @@
 
   struct soa_media_activity
   {
-    signed ma_audio:4; /**< Audio activity (send/recv) */
-    signed ma_video:4; /**< Video activity (send/recv) */
-    signed ma_image:4; /**< Image activity (send/recv) for JPIP */
-    signed ma_chat:4;  /**< Chat activity (send/recv) */
+    unsigned ma_audio:4; /**< Audio activity (send/recv) */
+    unsigned ma_video:4; /**< Video activity (send/recv) */
+    unsigned ma_image:4; /**< Image activity (send/recv) for JPIP */
+    unsigned ma_chat:4;  /**< Chat activity (send/recv) */
   } ss_local_activity[1], ss_remote_activity[1];
 
   /** Capabilities as specified by application */



More information about the Freeswitch-branches mailing list