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

Freeswitch SVN mikej at freeswitch.org
Fri Apr 6 19:35:02 EDT 2007


Author: mikej
Date: Fri Apr  6 19:35:02 2007
New Revision: 4874

Modified:
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/RELEASE
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_nua_api.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
   freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am

Log:
merge latest darcs tree from sofia

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	Fri Apr  6 19:35:02 2007
@@ -65,6 +65,8 @@
 Bugs fixed in this release
 --------------------------
 
+- Fixed status code reported to application when REGISTER transaction was
+  restarted by nua stack. Problem reported by Mikhail Zabaluev.
 - 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/libsofia-sip-ua/nta/test_nta.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	Fri Apr  6 19:35:02 2007
@@ -751,6 +751,10 @@
     su_root_step(ag->ag_root, 1);
   }
 
+  TEST_SIZE(su_sendto(s, "\r\n\r\n", 4, 0, (void *)ai->ai_addr, ai->ai_addrlen), 4);
+
+  su_root_step(ag->ag_root, 1);
+
   TEST_SIZE(su_sendto(s, "", 0, 0, ai->ai_addr, ai->ai_addrlen), 0);
 
   su_close(s);

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c	Fri Apr  6 19:35:02 2007
@@ -622,18 +622,20 @@
     return -1;
   nr = nua_dialog_usage_private(du);
 
-  nua_registration_add(&nh->nh_nua->nua_registrations, nr);
-
   if (nua_client_bind(cr, du) < 0)
     return -1;
 
-  if (aor == NULL)
-    aor = sip->sip_from;
-  if (aor == NULL)
-    aor = nh->nh_nua->nua_from;
+  if (!nr->nr_list) {
+    nua_registration_add(&nh->nh_nua->nua_registrations, nr);
 
-  if (nua_registration_set_aor(nh->nh_home, nr, aor) < 0)
-    return -1;
+    if (aor == NULL)
+      aor = sip->sip_from;
+    if (aor == NULL)
+      aor = nh->nh_nua->nua_from;
+
+    if (nua_registration_set_aor(nh->nh_home, nr, aor) < 0)
+      return -1;
+  }
 
   if (nua_registration_set_contact(nh, nr, sip->sip_contact, unreg) < 0)
     return -1;
@@ -800,7 +802,7 @@
 
   /* Restart only if nua_base_client_check_restart() did not try to restart */
   if (restart && retry_count == cr->cr_retry_count)
-    return nua_client_restart(cr, status, phrase);
+    return nua_client_restart(cr, 100, "Outbound NAT Detected");
   
   return 0;
 }

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c	Fri Apr  6 19:35:02 2007
@@ -442,7 +442,7 @@
         return -1;
     }
 
-    return 2;
+    return ob_reregister_now;
   }
 
   return 0;
@@ -1091,6 +1091,9 @@
   m3 = ob->ob_previous;
 
   if (terminating) {
+    if (ob->ob_by_stack && application_contact == NULL)
+      return 0;
+    
     if (ob->ob_contacts)
       previous = ob->ob_rcontact;
   }
@@ -1101,6 +1104,9 @@
       previous = ob->ob_contacts ? ob->ob_rcontact : NULL;
     }
   }
+  else if (ob->ob_by_stack) {
+    return 0;    /* Xyzzy - nothing happens */
+  }
   else if (v) {
     char const *tport = !v->v_next ? v->v_protocol : NULL; 
     char reg_id_param[20];

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_nua_api.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_nua_api.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_nua_api.c	Fri Apr  6 19:35:02 2007
@@ -210,7 +210,10 @@
   run_a_until(ctx, -1, save_until_final_response);
 
   TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_r_unregister);
-  TEST(e->data->e_status, 401);
+  if (e->data->e_status == 401)
+    TEST(e->data->e_status, 401);
+  else
+    TEST(e->data->e_status, 406);
   TEST_1(!e->next);
 
   free_events_in_list(ctx, a->events);

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c	Fri Apr  6 19:35:02 2007
@@ -52,6 +52,7 @@
 #include <sofia-sip/auth_module.h>
 #include <sofia-sip/su_tagarg.h>
 #include <sofia-sip/msg_addr.h>
+#include <sofia-sip/hostdomain.h>
 
 #include <stdlib.h>
 #include <assert.h>
@@ -708,8 +709,8 @@
 sip_contact_t *binding_contacts(su_home_t *home, struct binding *bindings);
 
 int process_register(struct proxy *proxy,
-       	      nta_incoming_t *irq,
-       	      sip_t const *sip)
+		     nta_incoming_t *irq,
+		     sip_t const *sip)
 {
   auth_status_t *as;
   msg_t *msg;
@@ -752,6 +753,13 @@
 			     sip_t const *sip)
 {
   struct registration_entry *e = NULL;
+  sip_contact_t *m = sip->sip_contact;
+  sip_via_t *v = sip->sip_via;
+
+  if (m && v && v->v_received && m->m_url->url_host
+      && strcasecmp(v->v_received, m->m_url->url_host) 
+      && host_is_ip_address(m->m_url->url_host))
+    return set_status(as, 406, "Unacceptable Contact");
 
   auth_mod_check_client(p->auth, as, sip->sip_authorization,
 			registrar_challenger);

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c	Fri Apr  6 19:35:02 2007
@@ -141,12 +141,25 @@
   run_a_until(ctx, -1, save_until_final_response);
 
   TEST_1(e = a->events->head);
-  TEST_E(e->data->e_event, nua_r_register);
   TEST_1(sip = sip_object(e->data->e_msg));
+  if (ctx->nat) {
+    TEST_E(e->data->e_event, nua_r_register);
+    TEST(e->data->e_status, 100);
+    TEST(sip->sip_status->st_status, 406);
+    /* Check that CSeq included in tags is actually used in the request */
+    TEST(sip->sip_cseq->cs_seq, 13);
+    TEST_1(!sip->sip_contact);
+    TEST_1(e = e->next);
+    TEST_1(sip = sip_object(e->data->e_msg));
+    TEST(sip->sip_cseq->cs_seq, 14);
+  }
+  else {
+    /* Check that CSeq included in tags is actually used in the request */
+    TEST(sip->sip_cseq->cs_seq, 13);
+  }
+  TEST_E(e->data->e_event, nua_r_register);
   TEST(e->data->e_status, 401);
   TEST(sip->sip_status->st_status, 401);
-  /* Check that CSeq included in tags is actually used in the request */
-  TEST(sip->sip_cseq->cs_seq, 13);
   TEST_1(!sip->sip_contact);
   TEST_1(!e->next);
   free_events_in_list(ctx, a->events);
@@ -166,7 +179,6 @@
   TEST_S(sip->sip_contact->m_url->url_user, "a");
   TEST_1(strstr(sip->sip_contact->m_url->url_params, "foo=bar"));
   TEST_S(sip->sip_contact->m_q, "0.9");
-  TEST(sip->sip_cseq->cs_seq, 14);
 
   if (ctx->nat) {
     TEST_1(e = a->specials->head);
@@ -217,7 +229,6 @@
   TEST_S(sip->sip_contact->m_display, "B");
   TEST_S(sip->sip_contact->m_url->url_user, "b");
   free_events_in_list(ctx, b->events);
-  
   if (print_headings)
     printf("TEST NUA-2.3.2: PASSED\n");
 

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c	Fri Apr  6 19:35:02 2007
@@ -417,7 +417,7 @@
     su_free(home, f);
 
     TEST_1(t = sip_to_create(home, (void *)"<sip:joe at bar;tag=bar> (joe)"));
-    TEST_1(sip_is_to((sip_header_t*)f));
+    TEST_1(sip_is_to((sip_header_t*)t));
     TEST_1(sip_to_tag(home, t, "tag=jxahudsf") == 0);
     TEST_S(t->a_tag, "jxahudsf");
     TEST(msg_header_replace_param(home, t->a_common, "tag=bar"), 1);
@@ -516,7 +516,7 @@
 
     v = sip_via_make(home, "SIP/2.0/UDP domain.invalid:5060"); TEST_1(v);
     s = sip_contact_string_from_via(home, v, NULL, v->v_protocol);
-    TEST_S(s, "<sip:domain.invalid:5060;transport=udp>");
+    TEST_S(s, "<sip:domain.invalid;transport=udp>");
     su_free(home, v), su_free(home, s);
 
     TEST_1(sip_transport_has_tls("SIP/2.0/TLS-SCTP"));

Modified: freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am
==============================================================================
--- freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am	(original)
+++ freeswitch/branches/mikej/sofiasip-upgrade/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am	Fri Apr  6 19:35:02 2007
@@ -95,7 +95,6 @@
 			inet_ntop.c inet_pton.c poll.c getopt.c \
 			su_tag_ref.c su_win32_port.c
 
-libsu_la_CFLAGS = 	$(AM_CFLAGS) $(SOFIA_CFLAGS)
 libsu_la_LIBADD = 	$(REPLACE_LIBADD)
 libsu_la_DEPENDENCIES = $(REPLACE_LIBADD)
 



More information about the Freeswitch-branches mailing list