[Freeswitch-trunk] [commit] r5574 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua-glib/su-glib libsofia-sip-ua/bnf libsofia-sip-ua/docs libsofia-sip-ua/features libsofia-sip-ua/http libsofia-sip-ua/ipt libsofia-sip-ua/iptsec libsofia-sip-ua/iptsec/sofia-sip libsofia-sip-ua/msg libsofia-sip-ua/nea libsofia-sip-ua/nta libsofia-sip-ua/nta/sofia-sip libsofia-sip-ua/nth libsofia-sip-ua/nua libsofia-sip-ua/nua/sofia-sip libsofia-sip-ua/sdp libsofia-sip-ua/sip libsofia-sip-ua/sip/sofia-sip libsofia-sip-ua/soa libsofia-sip-ua/sresolv libsofia-sip-ua/sresolv/sofia-resolv libsofia-sip-ua/stun libsofia-sip-ua/su libsofia-sip-ua/su/sofia-sip libsofia-sip-ua/tport open_c open_c/group open_c/sis utils win32 win32/libsofia-sip-ua win32/libsofia-sip-ua-static win32/sofia-sip win32/utils/stunc

Freeswitch SVN mikej at freeswitch.org
Mon Aug 6 15:24:14 EDT 2007


Author: mikej
Date: Mon Aug  6 15:24:10 2007
New Revision: 5574

Added:
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/torture_sresolv.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/heap.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_open_c_localinfo.cpp
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_heap.c
   freeswitch/trunk/libs/sofia-sip/open_c/group/libsofia-sip-ua-glib.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/su_source_test.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/su_source_test_reg.rss
   freeswitch/trunk/libs/sofia-sip/open_c/group/test_http.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/test_http_reg.rss
   freeswitch/trunk/libs/sofia-sip/open_c/group/test_nua.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/test_nua_reg.rss
   freeswitch/trunk/libs/sofia-sip/open_c/group/test_tport.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/test_tport_reg.rss
   freeswitch/trunk/libs/sofia-sip/open_c/sis/
   freeswitch/trunk/libs/sofia-sip/open_c/sis/libsofia-sip-ua-glib.pkg
   freeswitch/trunk/libs/sofia-sip/open_c/sis/libsofia-sip-ua.pkg
   freeswitch/trunk/libs/sofia-sip/open_c/sis/su_source_test.pkg
   freeswitch/trunk/libs/sofia-sip/open_c/sis/test_nua.pkg
   freeswitch/trunk/libs/sofia-sip/open_c/sis/test_tport.pkg
   freeswitch/trunk/libs/sofia-sip/utils/utils.docs
Modified:
   freeswitch/trunk/libs/sofia-sip/RELEASE
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source_test.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/torture_bnf.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.aliases
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/conformance.docs
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/features/features.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http.docs
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/test_http.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/ipt/Makefile.am
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/ipt/ipt.docs
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_tag.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/iptsec.docs
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/iptsec_debug.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_plugin.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_class.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_table.c.in
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea.docs
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_debug.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/Doxyfile.in
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.docs
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta_tag.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta_api.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/nth.docs
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua.docs
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_common.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_extension.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_message.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_options.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_init.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nat.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_nua_api.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip.docs
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_bad_mask
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_basic.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_extra.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sip_extra_headers.txt
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_extra.h.in
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/soa/soa.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
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/Makefile.am
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_cache.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_cache.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/test_sresolv.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/stun/stun_tag.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/Doxyfile.in
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/Makefile.am
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_config.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_configure.h.in
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_time.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_types.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_wait.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su.docs
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_addrinfo.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_default_log.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_global_log.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_log.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_port.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_root.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_time.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_time0.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/su_timer.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/tag_dll.awk
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/test_poll.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_tag.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_time.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/su/torture_su_timer.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/test_tport.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c
   freeswitch/trunk/libs/sofia-sip/open_c/build_sources.cmd
   freeswitch/trunk/libs/sofia-sip/open_c/config.h.in
   freeswitch/trunk/libs/sofia-sip/open_c/group/bld.inf
   freeswitch/trunk/libs/sofia-sip/open_c/group/libsofia-sip-ua.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/test_msg.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/test_msg_reg.rss
   freeswitch/trunk/libs/sofia-sip/open_c/group/torture_sip.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/torture_sip_reg.rss
   freeswitch/trunk/libs/sofia-sip/open_c/group/torture_su_alloc.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/torture_su_alloc_reg.rss
   freeswitch/trunk/libs/sofia-sip/open_c/group/torture_su_root.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/torture_su_root_reg.rss
   freeswitch/trunk/libs/sofia-sip/open_c/group/torture_su_tag.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/torture_su_tag_reg.rss
   freeswitch/trunk/libs/sofia-sip/open_c/group/torture_url.mmp
   freeswitch/trunk/libs/sofia-sip/open_c/group/torture_url_reg.rss
   freeswitch/trunk/libs/sofia-sip/utils/Doxyfile.in
   freeswitch/trunk/libs/sofia-sip/utils/Makefile.am
   freeswitch/trunk/libs/sofia-sip/utils/sip-options.c
   freeswitch/trunk/libs/sofia-sip/win32/README.txt
   freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua-static/libsofia_sip_ua_static.dsp
   freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua-static/libsofia_sip_ua_static.vcproj
   freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp
   freeswitch/trunk/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj
   freeswitch/trunk/libs/sofia-sip/win32/sofia-sip/su_configure.h
   freeswitch/trunk/libs/sofia-sip/win32/utils/stunc/stunc.vcproj

Log:
sync with latest sofia tree.

Modified: freeswitch/trunk/libs/sofia-sip/RELEASE
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/RELEASE	(original)
+++ freeswitch/trunk/libs/sofia-sip/RELEASE	Mon Aug  6 15:24:10 2007
@@ -9,6 +9,9 @@
  and in less than 10 lines, written in 3rd person English, with
  complete sentences />
 
+The stack now compiles and runs on Symbian SDK with Open C support
+enabled.
+
 Bugs in blaa and foo have been fixed. The stack now supports
 use of foobar...
 
@@ -24,10 +27,13 @@
 New features in API are marked with Doxytag macro @VERSION_1_12_7.
 
 libsofia-sip-ua:
+- Added access point selection functionality for Open C / Symbian
 - Removed extra system headers from <sofia-sip/stun_common.h>
 - Added global variable su_socket_blocking. If it is set to true,
   sockets are created as blocking.
 - Added accessor function nta_outgoing_branch()
+- Added SIP headers Alert-Info and Reply-To.
+- Added macros SIP_HAVE_XXXX for extra headers, e.g., SIP_HAVE_ALERT_INFO().
 - **template**: Added foobar() function (sofia-sip/foobar.h).
 - This release is ABI/API compatible with applications linked against 
   any 1.12.x release. However, applications built against this release won't 
@@ -52,7 +58,7 @@
  - roughly sorted by number of patches accepted
 /> 
 
-- **template**: First Surname (patch to nua/soa/msg)
+- Kai Vehmanen (fixes to win32 VC6/2005 project files)
 
 See the AUTHORS file in the distribution package.
 
@@ -65,6 +71,13 @@
  - section may be omitted for minor releases
 /> 
 
+IPv6 support can now be disabled in VC6/VC2005 builds, by
+setting SU_HAVE_IN6 to zero `win32/sofia-sip/su_configure.h'.
+
+Symbian Open C build and packaging (SIS) files for libsofia-sip-ua,
+libsofia-sip-ua-glib and for several test apps have been added under
+sofia-sip/open_c.
+
 Bugs fixed in this release
 --------------------------
 
@@ -74,6 +87,5 @@
  - other bugs as fixed in CVS/darcs
 />
 
-- **template**: #9499652 sf.net bug item title
 - Fixed #1472682 sf.net bug: ACK does not find INVITE when
   To URI has been changed.

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c	Mon Aug  6 15:24:10 2007
@@ -36,12 +36,15 @@
  * 
  */
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <glib.h>
 
+#if HAVE_OPEN_C
+#include <glib/gthread.h>
+#include <glib_global.h>
+#endif
+
 #define SU_PORT_IMPLEMENTATION 1
 
 #define SU_MSG_ARG_T union { char anoymous[4]; }

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source_test.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source_test.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source_test.c	Mon Aug  6 15:24:10 2007
@@ -32,9 +32,7 @@
  * @date Created: Thu Mar 18 19:40:51 1999 pessi
  */
 
-#if HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdlib.h>
 #include <string.h>
@@ -52,6 +50,7 @@
 #include "sofia-sip/su_wait.h"
 #include "sofia-sip/su_log.h"
 
+#include <glib/gthread.h>
 #include "sofia-sip/su_glib.h"
 
 struct pinger {
@@ -373,11 +372,13 @@
   }
 }
 
+#if HAVE_SIGNAL
 static
 RETSIGTYPE term(int n)
 {
   exit(1);
 }
+#endif
 
 void
 time_test(void)
@@ -433,6 +434,10 @@
 
   char *argv0 = argv[0];
 
+#if HAVE_OPEN_C
+  dup2(1, 2);
+#endif
+  
   while (argv[1]) {
     if (strcmp(argv[1], "-v") == 0) {
       opt_verbatim = 1;
@@ -457,7 +462,15 @@
     }
   }
 
+#if HAVE_OPEN_C
+  opt_verbatim = 1;
+  opt_singlethread = 1;
+  su_log_soft_set_level(su_log_default, 9);  
+#endif
+  
+#if HAVE_SIGNAL
   signal(SIGTERM, term);
+#endif
 
   su_init(); atexit(su_deinit);
 
@@ -509,9 +522,15 @@
     printf("%s exiting\n", argv0); 
 
 #ifndef HAVE_WIN32
+#if HAVE_SIGNAL
    if (sleeppid)
      kill(sleeppid, SIGTERM);
 #endif
+#endif
 
+#if HAVE_OPEN_C
+   sleep(7);
+#endif
+   
   return 0;
 }

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/torture_bnf.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/torture_bnf.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/bnf/torture_bnf.c	Mon Aug  6 15:24:10 2007
@@ -320,13 +320,14 @@
   TEST(host_has_domain_invalid("valid."), 0);
   TEST(host_has_domain_invalid("1-.invalid."), 0);
 
-  /* Invalid IP4 addresses (extra leading zeros) */
+  /* Invalid IP4 address (extra leading zeros) */
   TEST_1(!host_cmp("127.0.0.1", "127.0.0.01"));
-  TEST_1(!host_cmp("[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]", 
-		  "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
   /* Invalid reference (extra leading zeros) */
   TEST_1(host_cmp("[0ffff:0ffff:0ffff:0ffff:0ffff:0ffff:255.255.255.255]", 
 		  "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
+#if SU_HAVE_IN6
+  TEST_1(!host_cmp("[ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]", 
+		  "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
   TEST_1(!host_cmp("::1", "::001"));
   TEST_1(!host_cmp("[::1]", "::1"));
   TEST_1(!host_cmp("[::1]", "::0.0.0.1"));
@@ -334,6 +335,7 @@
   TEST_1(!host_cmp("::ffff:127.0.0.1", "::ffff:7f00:1"));
   TEST_1(!host_cmp("::ffff:127.0.0.1", "::ffff:7f00:1"));
   TEST_1(!host_cmp("[::ffff:127.0.0.1]", "[::7f00:1]"));
+#endif
   TEST_1(host_cmp("::", "0.0.0.0"));
   TEST_1(host_cmp("::1", "0.0.0.1"));
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.aliases
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.aliases	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.aliases	Mon Aug  6 15:24:10 2007
@@ -49,4 +49,7 @@
  "VERSION_1_12_6=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.6.txt\">1.12.6</a>" \
  "NEW_1_12_6=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.6.txt\">1.12.6</a>" \
  "EXP_1_12_6=@since Experimental in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.6.txt\">1.12.6</a>, available if --enable-experimental configuration option is given" \
+ "VERSION_1_12_7=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.7.txt\">1.12.7</a>" \
+ "NEW_1_12_7=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.7.txt\">1.12.7</a>" \
+ "EXP_1_12_7=@since Experimental in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.7.txt\">1.12.7</a>, available if --enable-experimental configuration option is given" \
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/conformance.docs
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/conformance.docs	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/docs/conformance.docs	Mon Aug  6 15:24:10 2007
@@ -66,9 +66,9 @@
    <th>Notes</td>
 </tr>
 
+<a name="3261"></a>
 <tr valign=top>
     <th align="left">
-       <a name="3261"></a>
 	@RFC3261: Basic SIP Protocol
     </th>
     <td>
@@ -90,9 +90,9 @@
     </td>
 </tr>
 
+<a name="3261.19"></a> <a name="3261.20"></a>
 <tr valign=top>
     <th align="left">
-       <a name="3261.19"></a> <a name="3261.20"></a>
 	@RFC3261 Sections&nbsp;19&nbsp;and&nbsp;20:<br>
 	Syntax and encoding
     </td>
@@ -116,6 +116,7 @@
 	@ref sip_accept "Accept",
 	@ref sip_accept_encoding "Accept-Encoding",
 	@ref sip_accept_language "Accept-Language",
+	@ref sip_alert_info "Alert-Info" (@VERSION_1_12_7),
 	@ref sip_allow "Allow",
 	@ref sip_authentication_info "Authentication-Info",
 	@ref sip_authorization "Authorization",
@@ -142,6 +143,7 @@
 	@ref sip_proxy_authorization "Proxy-Authorization",
 	@ref sip_proxy_require "Proxy-Require",
 	@ref sip_record_route "Record-Route",
+	@ref sip_reply_to "Reply-To" (@VERSION_1_12_7),
 	@ref sip_require "Require",
 	@ref sip_retry_after "Retry-After",
 	@ref sip_route "Route",
@@ -163,18 +165,15 @@
         parsers.
     </td>
     <td>
-    	- Unsupported headers:
-	  Alert-Info,
-	  Reply-To
 	- Automatic escaping of reserved characters has not been
 	  implemented.
 	- Using NUL (zero byte) in doublequoted strings has not been implemented
    </td>
 </tr>
 
+<a name="3261.18"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3261.18"></a>
 	@RFC3261 Section 18:<br>
 	UDP and TCP transports
     </th>
@@ -201,9 +200,9 @@
     </td>
 </tr>
 
+<a name="3261.17"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3261.17"></a>
 	@RFC3261 Section 17:<br> Transactions
     </th>
     <td>
@@ -214,7 +213,7 @@
 
 	Default values for SIP timers are those specified by @RFC3261. The
 	defaults for T1, T1x64, T2 and T4 can be changed via
-        configuration tags defined in <nta_tag.h>.
+        configuration tags defined in <sofia-sip/nta_tag.h>.
     </td>
     <td>
 	&nbsp;
@@ -222,9 +221,9 @@
 </tr>
 
 
+<a name="3261.26"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3261.26"></a>
 	@RFC3261 Section 26:<br> Security
     </th>
     <td>
@@ -234,19 +233,19 @@
     </td>
     <td>
 	Missing:
-	- TLS certificate checking
+	- Authorizing connections with TLS certificates
 	- S/MIME
     </td>
 </tr>
 
+<a name="2617"></a>
 <tr valign=top>
     <th align="left">
-	<a name="2617"></a>
 	@RFC2617: HTTP Digest Authentication
     </th>
     <td>
-	Sofia-SIP an authentication client and server modules implementing
-        HTTP Digest authentication.
+	Sofia-SIP includes authentication client and server modules
+	implementing HTTP Digest authentication.
 
 	HTTP Digest is a simple challenge-response authentication
 	scheme defined in @RFC2617 based on the UA sending a checksum
@@ -283,9 +282,9 @@
     </td>
 </tr>
 
+<a name="3262"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3262"></a>
 	@RFC3262: PRACK and 100rel
     </th>
     <td>
@@ -305,9 +304,9 @@
     </td>
 </tr>
 
+<a name="3263"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3263"></a>
 	@RFC3263: Locating SIP Servers
     </th>
     <td>
@@ -320,9 +319,9 @@
     </td>
 </tr>
 
+<a name="3265"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3265"></a>
 	@RFC3265: SIP Event Notifications
     </th>
     <td>
@@ -347,9 +346,9 @@
     </td>
 </tr>
 
+<a name="2806"></a>
 <tr valign=top>
     <th align="left">
-	<a name="2806"></a>
 	@RFC2806: tel URI
     </th>
     <td>
@@ -362,9 +361,9 @@
     </td>
 </tr>
 
+<a name="2976"></a>
 <tr valign=top>
     <th align="left">
-	<a name="2976"></a>
 	@RFC2976: INFO
     </th>
     <td>
@@ -377,9 +376,9 @@
 </tr>
 
 
+<a name="3311"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3311"></a>
 	@RFC3311: UPDATE
     </th>
     <td>
@@ -396,9 +395,9 @@
 </tr>
 
 
+<a name="3313"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3313"></a>
 	@RFC3313: Media Authentication
     </th>
     <td>
@@ -413,9 +412,9 @@
 </tr>
 
 
+<a name="3323"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3323"></a>
 	@RFC3323: Privacy
     </th>
     <td>
@@ -441,9 +440,9 @@
 </tr>
 
 
+<a name="3326"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3326"></a>
 	@RFC3326: Reason
     </th>
     <td>
@@ -457,9 +456,9 @@
 </tr>
 
 
+<a name="3325"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3325"></a>
 	@RFC3325: Asserted Identity
     </th>
     <td>
@@ -476,9 +475,9 @@
     </td>
 </tr>
 
+<a name="3327"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3327"></a>
 	@RFC3327: Path
     </th>
     <td>
@@ -493,9 +492,9 @@
     </td>
 </tr>
 
+<a name="3329"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3329"></a>
 	@RFC3329:
 	Security Agreement
     </th>
@@ -517,9 +516,9 @@
     </td>
 </tr>
 
+<a name="3361"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3361"></a>
 	@RFC3361: DHCPv4 option for locating SIP servers.
     </th>
     <td>
@@ -532,9 +531,9 @@
     </td>
 </tr>
 
+<a name="3420"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3420"></a>
 	@RFC3420: message/sipfrag
     </th>
     <td>
@@ -547,9 +546,9 @@
     </td>
 </tr>
 
+<a name="3428"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3428"></a>
 	@RFC3428: MESSAGE
     </th>
     <td>
@@ -560,9 +559,9 @@
     </td>
 </tr>
 
+<a name="3486"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3486"></a>
 	@RFC3486: Compressing SIP
     </th>
     <td>
@@ -575,9 +574,9 @@
     </td>
 </tr>
 
+<a name="3515"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3515"></a>
 	@RFC3515: REFER
     </th>
     <td>
@@ -600,9 +599,9 @@
     </td>
 </tr>
 
+<a name="3608"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3608"></a>
 	@RFC3608: Service-Route
     </th>
     <td>
@@ -619,9 +618,9 @@
     </td>
 </tr>
 
+<a name="3680"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3680"></a>
 	@RFC3680: "reg" event
     </th>
     <td>
@@ -643,9 +642,9 @@
     </td>
 </tr>
 
+<a name="3824"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3824"></a>
 	@RFC3824: ENUM
     </th>
     <td>
@@ -659,9 +658,9 @@
     </td>
 </tr>
 
+<a name="3840"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3840"></a>
 	@RFC3840: Callee Capabilities
     </th>
     <td>
@@ -681,9 +680,9 @@
 </tr>
 
 
+<a name="3841"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3841"></a>
 	@RFC3841: Caller Preferences
     </th>
     <td>
@@ -712,9 +711,9 @@
     </td>
 </tr>
 
+<a name="3842"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3842"></a>
 	@RFC3842: Message waiting event
     </th>
     <td>
@@ -734,9 +733,9 @@
     </td>
 </tr>
 
+<a name="3856"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3856"></a>
 	@RFC3856: Presence
     </th>
     <td>
@@ -760,9 +759,9 @@
     </td>
 </tr>
 
+<a name="3857"></a> <a name="3858"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3857"></a> <a name="3858"></a>
 	@RFC3857: "winfo" event template package<br>
 	@RFC3858: winfo format
     </th>
@@ -783,9 +782,9 @@
     </td>
 </tr>
 
+<a name="3891"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3891"></a>
 	@RFC3891: Replaces
     </th>
     <td>
@@ -799,9 +798,9 @@
     </td>
 </tr>
 
+<a name="3892"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3892"></a>
 	@RFC3892: Referred-By
     </th>
     <td>
@@ -819,9 +818,9 @@
     </td>
 </tr>
 
+<a name="3903"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3903"></a>
 	@RFC3903: PUBLISH
     </th>
     <td>
@@ -839,9 +838,9 @@
     </td>
 </tr>
 
+<a name="4028"></a>
 <tr valign=top>
     <th align="left">
-	<a name="4028"></a>
 	@RFC4028: Session Timers
     </th>
     <td>
@@ -865,9 +864,9 @@
     </td>
 </tr>
 
+<a name="4320"></a>
 <tr valign=top>
     <th align="left">
-	<a name="4320"></a>
 	@RFC4320: Actions Addressing Identified Issues with SIP's Non-INVITE Transaction
     </th>
     <td>
@@ -896,10 +895,12 @@
    <th>Notes</td>
 </tr>
 
+<a name="4566"></a>
+<a name="2327"></a>
+<a name="3266"></a>
 <tr valign=top>
     <th align="left" align="left">
-	<a name="2327"></a>
-	@RFC2327: SDP (Session Description Protocol)
+	@RFC4566: SDP: Session Description Protocol
     </th>
     <td>
 	Generic support (generating, parsing and syntax checking) for SDP.
@@ -920,17 +921,20 @@
 	The attributes "a=sendrecv", "a=sendonly", "a=recvonly",
 	"a=inactive", @ref sdp_rtpmap_s "a=rtpmap", and "a=fmtp" are parsed.
 
-	The implementation tries to follow draft-ietf-mmusic-sdp-new-25,
-	draft Internet Standard for SDP in progress.
+	The implementation partially implements @RFC4566. Note that
+	definiton of 'token' was updated in @RFC4566 and the parser has not
+	been updated yet.
     </td>
     <td>
-    - see also <a href="#4566">RFC 4566</a>
+      @RFC4566 obsoletes
+      - @RFC2327: SDP (Session Description Protocol)
+      - @RFC3266: IP6 in SDP
     </td>
 </tr>
 
+<a name="3264"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3264"></a>
 	@RFC3264: SDP Offer/Answer Negotiation
     </th>
     <td>
@@ -942,22 +946,9 @@
     </td>
 </tr>
 
+<a name="3312"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3266"></a>
-	@RFC3266: IP6 in SDP
-    </th>
-    <td>
-	Representation of IP6 addresses within SDP message.
-    </td>
-    <td>
-    - see also <a href="#4566">RFC 4566</a>
-    </td>
-</tr>
-
-<tr valign=top>
-    <th align="left">
-	<a name="3312"></a>
 	@RFC3312: Preconditions
     </th>
     <td>
@@ -978,9 +969,9 @@
     </td>
 </tr>
 
+<a name="3388"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3388"></a>
 	@RFC3388: Grouping of Media Lines
     </th>
     <td>
@@ -998,9 +989,9 @@
 </tr>
 
 
+<a name="3407"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3407"></a>
 	@RFC3407: Capability Declaration
     </th>
     <td>
@@ -1016,9 +1007,9 @@
 </tr>
 
 
+<a name="3524"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3524"></a>
 	@RFC3524: SRF
     </th>
     <td>
@@ -1032,9 +1023,9 @@
     </td>
 </tr>
 
+<a name="3556"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3556"></a>
 	@RFC3556: Bandwidth
     </th>
     <td>
@@ -1048,9 +1039,9 @@
     </td>
 </tr>
 
+<a name="3605"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3605"></a>
 	@RFC3605: RTCP attribute
     </th>
     <td>
@@ -1064,9 +1055,9 @@
     </td>
 </tr>
 
+<a name="3890"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3890"></a>
 	@RFC3890: TIAS
     </th>
     <td>
@@ -1080,9 +1071,16 @@
     </td>
 </tr>
 
+</table>
+
+
+*/
+
+/* Overflow:
+
+<a name="4566"></a>
 <tr valign=top>
     <th align="left">
-	<a name="4566"></a>
 	@RFC4566: SDP: Session Description Protocol
     </th>
     <td>
@@ -1093,15 +1091,10 @@
     </td>
 </tr>
 
-</table>
-
-*/
-
-/* Overflow:
 
+<a name="3320"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3320"></a>
 	@RFC3320: SigComp
     </th>
     <td>
@@ -1116,9 +1109,9 @@
     </td>
 </tr>
 
+<a name="3321"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3321"></a>
 	@RFC3321: SigComp Extended operations
     </th>
     <td>
@@ -1132,9 +1125,9 @@
     </td>
 </tr>
 
+<a name="3325"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3325"></a>
 	@RFC3325: Asserted Identity
     </th>
     <td>
@@ -1147,9 +1140,9 @@
     </td>
 </tr>
 
+<a name="3485"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3485"></a>
 	@RFC3485: SIP/SDP Dictionary
     </th>
     <td>
@@ -1166,9 +1159,9 @@
 
 	- Implicitly registered user identities
 
+<a name="3959"></a>
 <tr valign=top>
     <th align="left">
-	<a name="3959"></a>
 	@RFC3959: early-session
     </th>
     <td>

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/features/features.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/features/features.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/features/features.c	Mon Aug  6 15:24:10 2007
@@ -35,7 +35,7 @@
 #include <stddef.h>
 
 #include <sofia-sip/su_configure.h>
-#include <tport_tls.h>
+#include "tport_tls.h"
 #include "sofia-sip/sofia_features.h"
 
 /** The name and version of software package providing Sofia-SIP-UA library.

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http.docs
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http.docs	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http.docs	Mon Aug  6 15:24:10 2007
@@ -20,7 +20,7 @@
  * documented in a <a href="modules.html">submodule</a> for the header. In
  * addition to the header structure, there is defined a @em header @em class
  * structure and some standard functions for each header in the
- * <http_header.h> include file. For header @c X, there are types,
+ * <sofia-sip/http_header.h> include file. For header @c X, there are types,
  * functions, macros and header class as follows:
  *
  *  - @c http_X_t is the structure used to store parsed header,

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/http_basic.c	Mon Aug  6 15:24:10 2007
@@ -140,7 +140,7 @@
  *
  * Note that version string is not copied; it @b MUST remain constant during
  * lifetime of the @c http_request_t object. You can use constants
- * http_version_1_1 or http_version_1_0 declared in <http_header.h>.
+ * http_version_1_1 or http_version_1_0 declared in <sofia-sip/http_header.h>.
  */
 http_request_t *http_request_create(su_home_t *home,
 				    http_method_t method, char const *name,

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/test_http.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/test_http.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/http/test_http.c	Mon Aug  6 15:24:10 2007
@@ -112,6 +112,10 @@
       usage(1);
   }
 
+#if HAVE_OPEN_C
+  tstflags |= tst_verbatim;
+#endif
+
   if (!test_mclass)
     test_mclass = http_default_mclass();
 
@@ -125,6 +129,10 @@
   retval |= http_chunk_test(); fflush(stdout);
   retval |= test_query_parser(); fflush(stdout);
 
+#if HAVE_OPEN_C
+  sleep(5);
+#endif
+
   return retval;
 }
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/ipt/Makefile.am
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/ipt/Makefile.am	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/ipt/Makefile.am	Mon Aug  6 15:24:10 2007
@@ -23,14 +23,14 @@
 # Rules for building the targets
 
 nobase_include_sofia_HEADERS = \
-			sofia-sip/rc4.h \
 			sofia-sip/base64.h \
-		  sofia-sip/token64.h \
+			sofia-sip/token64.h \
 			sofia-sip/uniqueid.h
 
 libipt_la_SOURCES = 	base64.c token64.c
 
 EXTRA_DIST = 		sofia-sip/utf8.h \
+			sofia-sip/rc4.h \
 			utf8internal.h \
 			utf8.c ucs2.c ucs4.c rc4.c \
 			utf8test.c

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/ipt/ipt.docs
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/ipt/ipt.docs	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/ipt/ipt.docs	Mon Aug  6 15:24:10 2007
@@ -15,9 +15,6 @@
  * @section ipt_overview Overview
  *
  * This module contain some routines useful for IPT applications, like 
- * - base64.h BASE64 encoding/decoding, 
- * - token64.h encoding/decoding binary as SIP/HTTP token, 
- * - utf8.h UTF8 encoding/decoding, 
- * - sha1.h SHA1 hash routines, and
- * - rc4.h arcfour random number generator.
+ * - <sofia-sip/base64.h> BASE64 encoding/decoding, 
+ * - <sofia-sip/token64.h> encoding/decoding binary as SIP/HTTP token, 
  */

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c	Mon Aug  6 15:24:10 2007
@@ -133,6 +133,7 @@
   char const *realm = NULL, *opaque = NULL, *db = NULL, *allows = NULL;
   char const *qop = NULL, *algorithm = NULL;
   unsigned expires = 60 * 60, next_expires = 5 * 60;
+  unsigned max_ncount = 0;
   unsigned blacklist = 5;
   int forbidden = 0;
   int anonymous = 0;
@@ -152,6 +153,7 @@
 	  AUTHTAG_ALGORITHM_REF(algorithm),
 	  AUTHTAG_EXPIRES_REF(expires),
 	  AUTHTAG_NEXT_EXPIRES_REF(next_expires),
+	  AUTHTAG_MAX_NCOUNT_REF(max_ncount),
 	  AUTHTAG_BLACKLIST_REF(blacklist),
 	  AUTHTAG_FORBIDDEN_REF(forbidden),
 	  AUTHTAG_ANONYMOUS_REF(anonymous),
@@ -172,6 +174,7 @@
     msg_commalist_d(am->am_home, &s, &am->am_allow, NULL);
   am->am_expires = expires;
   am->am_next_exp = next_expires;
+  am->am_max_ncount = max_ncount;
   am->am_blacklist = blacklist;
   am->am_forbidden = forbidden;
   am->am_anonymous = anonymous;
@@ -1437,6 +1440,16 @@
     as->as_stale = 1;
   }
 
+  if (am->am_max_ncount && ar->ar_nc) {
+    unsigned long nc = strtoul(ar->ar_nc, NULL, 10);
+
+    if (nc == 0 || nc > am->am_max_ncount) {
+      SU_DEBUG_5(("auth_method_digest: nonce used %s times, max %u\n",
+		  ar->ar_nc, am->am_max_ncount));
+      as->as_stale = 1;
+    }
+  }
+
   /* We should also check cnonce, nc... */
 
   return 0;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_tag.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_tag.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_tag.c	Mon Aug  6 15:24:10 2007
@@ -64,7 +64,7 @@
  * authentication module, like "Digest" or "Basic", or an plugin module,
  * like "SGMF+Digest". 
  *
- * @sa See <auth_plugin.h> for plugin interface.
+ * @sa See <sofia-sip/auth_plugin.h> for plugin interface.
  */
 tag_typedef_t authtag_method = STRTAG_TYPEDEF(method);
 
@@ -150,6 +150,17 @@
  */
 tag_typedef_t authtag_next_expires = UINTTAG_TYPEDEF(next_expires);
 
+/**@def AUTHTAG_MAX_NCOUNT()
+ *
+ * Max nonce count value.
+ * 
+ * The tag AUTHTAG_MAX_NCOUNT() specifies the maximum number of times a
+ * nonce should be used. 
+ *
+ * @todo Count actual usages and don't trust "nc" parameter only.
+ */
+tag_typedef_t authtag_max_ncount = UINTTAG_TYPEDEF(max_ncount);
+
 /**@def AUTHTAG_BLACKLIST()
  *
  * Blacklist time.

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/iptsec.docs
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/iptsec.docs	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/iptsec.docs	Mon Aug  6 15:24:10 2007
@@ -19,11 +19,10 @@
  *
  * @section auth_module Server Verifying Authentication
  *
- * The file <auth_module.h> defines the interface used by a server verifying
- * the authentication from client. After the server has created an @ref
- * auth_mod_t "authentication module", the usual authentication operation is
- * simple enough:
-
+ * The file <sofia-sip/auth_module.h> defines the interface used by a server
+ * verifying the authentication from client. After the server has created an
+ * @ref auth_mod_t "authentication module", the usual authentication
+ * operation is simple enough:
  * -# server initializes an #auth_status_t structure with information from
  *    the request
  * -# server calls auth_mod_method() 
@@ -42,8 +41,8 @@
  *
  * When the server creates the authentication module with auth_mod_create(),
  * it can specify numerous parameters affecting the authentication protocol
- * and algorithms. The parameter tags are defined in <auth_module.h>. The
- * most important parameters include:
+ * and algorithms. The parameter tags are defined in
+ * <sofia-sip/auth_module.h>. The most important parameters include:
  *
  * - AUTHTAG_METHOD(),
  * - AUTHTAG_ALGORITHM(),
@@ -52,7 +51,7 @@
  *
  * @section auth_client Client Authenticating User
  *
- * The file <auth_client.h> defines the interface used by a client
+ * The file <sofia-sip/auth_client.h> defines the interface used by a client
  * authenticating a user with a server. Because there may be multiple
  * servers or proxies requiring authentication, the client-side
  * authentication information is represented using a list of #auth_client_t

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/iptsec_debug.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/iptsec_debug.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/iptsec_debug.c	Mon Aug  6 15:24:10 2007
@@ -44,7 +44,7 @@
  * The IPTSEC_DEBUG environment variable is used to determine the debug
  * logging level for @b iptsec module. The default level is 3.
  * 
- * @sa <su_debug.h>, iptsec_log, SOFIA_DEBUG
+ * @sa <sofia-sip/su_debug.h>, iptsec_log, SOFIA_DEBUG
  */
 extern char const IPTSEC_DEBUG[];
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_module.h	Mon Aug  6 15:24:10 2007
@@ -322,6 +322,13 @@
   authtag_next_expires_ref, tag_uint_vr((&x))
 SOFIAPUBVAR tag_typedef_t authtag_next_expires_ref;
 
+/** Maximum nonce count allowed. */
+#define AUTHTAG_MAX_NCOUNT(x)    authtag_max_ncount, tag_uint_v((x))
+SOFIAPUBVAR tag_typedef_t authtag_max_ncount;
+
+#define AUTHTAG_MAX_NCOUNT_REF(x)    authtag_max_ncount_ref, tag_uint_vr((&x))
+SOFIAPUBVAR tag_typedef_t authtag_max_ncount_ref;
+
 /** Extra delay when responding if provided invalid credentials or nonce. */
 #define AUTHTAG_BLACKLIST(x)    authtag_blacklist, tag_uint_v((x))
 SOFIAPUBVAR tag_typedef_t authtag_blacklist;
@@ -343,13 +350,6 @@
 #define AUTHTAG_ANONYMOUS_REF(x)    authtag_anonymous_ref, tag_bool_vr((&x))
 SOFIAPUBVAR tag_typedef_t authtag_anonymous_ref;
 
-/** Fake authentication procedure - do not check result. */
-#define AUTHTAG_FAKE(x)    authtag_fake, tag_bool_v((x))
-SOFIAPUBVAR tag_typedef_t authtag_fake;
-
-#define AUTHTAG_FAKE_REF(x)    authtag_fake_ref, tag_bool_vr((&x))
-SOFIAPUBVAR tag_typedef_t authtag_fake_ref;
-
 /** HSS client structure. */
 #define AUTHTAG_HSS(x)        authtag_hss, tag_ptr_v((x))
 SOFIAPUBVAR tag_typedef_t authtag_hss;

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_plugin.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_plugin.h	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/sofia-sip/auth_plugin.h	Mon Aug  6 15:24:10 2007
@@ -164,6 +164,8 @@
   
   su_md5_t       am_hmac_ipad;	/**< MD5 with inner pad */
   su_md5_t       am_hmac_opad;	/**< MD5 with outer pad */
+
+  unsigned       am_max_ncount:1; /**< If nonzero, challenge with new nonce after ncount */
 };
 
 SOFIAPUBFUN

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/iptsec/test_auth_digest.c	Mon Aug  6 15:24:10 2007
@@ -92,11 +92,9 @@
 
 unsigned offset;
 
-void su_time(su_time_t *tv)
+void offset_time(su_time_t *tv)
 {
-  tv->tv_sec = time(NULL) + offset + 
-    /* Seconds from 1.1.1900 to 1.1.1970 */ 2208988800UL ;
-  tv->tv_usec = 555555;
+  tv->tv_sec += offset;
 }
 
 int test_digest()
@@ -896,6 +894,7 @@
 				AUTHTAG_QOP("auth,auth-int"),
 				AUTHTAG_FORBIDDEN(1),
 				AUTHTAG_ANONYMOUS(1),
+				AUTHTAG_MAX_NCOUNT(1),
 				TAG_END()));
 
     reinit_as(as);
@@ -942,6 +941,36 @@
     TEST(as->as_status, 401);
     TEST_1(au = (void *)as->as_response); TEST_1(au->au_params);
     TEST_S(msg_params_find(au->au_params, "stale="), "true");
+
+    TEST(auc_challenge(&aucs, home, (msg_auth_t *)as->as_response, 
+		       sip_authorization_class), 1);
+    msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
+			   (url_t *)"sip:surf3 at ims3.so.noklab.net", 
+			   sip->sip_payload), 1);
+    TEST_1(sip->sip_authorization);
+    TEST_S(msg_header_find_param(sip->sip_authorization->au_common, "nc="),
+	   "00000001");
+
+    reinit_as(as);
+    auth_mod_check_client(am, as, sip->sip_authorization, ach);
+    TEST(as->as_status, 0);
+
+    /* Test nonce count check */
+    msg_header_remove(m2, (void *)sip, (void *)sip->sip_authorization);
+    TEST(auc_authorization(&aucs, m2, (msg_pub_t*)sip, rq->rq_method_name, 
+			   (url_t *)"sip:surf3 at ims3.so.noklab.net", 
+			   sip->sip_payload), 1);
+    TEST_1(sip->sip_authorization);
+    TEST_S(msg_header_find_param(sip->sip_authorization->au_common, "nc="),
+	   "00000002");
+
+    reinit_as(as);
+    auth_mod_check_client(am, as, sip->sip_authorization, ach);
+    TEST(as->as_status, 401);
+    TEST_1(au = (void *)as->as_response); TEST_1(au->au_params);
+    TEST_S(msg_params_find(au->au_params, "stale="), "true");
+
     aucs = NULL;
 
     /* Test anonymous operation */
@@ -1210,6 +1239,9 @@
 {
   int retval = 0;
   int i;
+  extern void (*_su_time)(su_time_t *tv);
+
+  _su_time = offset_time;
 
   argv0 = argv[0];
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_class.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_class.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_class.c	Mon Aug  6 15:24:10 2007
@@ -42,10 +42,10 @@
 
 #define TAG_NAMESPACE "tst"
 
-#include <test_class.h>
+#include "test_class.h"
 #include <sofia-sip/msg_parser.h>
 #include <sofia-sip/msg_mclass.h>
-#include <test_protos.h>
+#include "test_protos.h"
 #include <sofia-sip/msg_addr.h>
 
 extern msg_mclass_t const msg_test_mclass[1];

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_table.c.in
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_table.c.in	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/msg/test_table.c.in	Mon Aug  6 15:24:10 2007
@@ -47,8 +47,8 @@
 #include <stddef.h>
 #include <string.h>
 
-#include <test_class.h>
-#include <test_protos.h>
+#include "test_class.h"
+#include "test_protos.h"
 #include <sofia-sip/msg_mime_protos.h>
 
 #include <sofia-sip/msg_mclass.h>

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea.docs
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea.docs	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea.docs	Mon Aug  6 15:24:10 2007
@@ -6,7 +6,7 @@
  *
  * Sofia Event API provides an interface to different events used in SIP
  * presence and conferencing. Interface used both in client and server sides
- * is presented in <nea.h>.
+ * is presented in <sofia-sip/nea.h>.
  *
  * @CONTACT Pekka Pessi <Pekka.Pessi at nokia.com>
  *

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_debug.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_debug.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nea/nea_debug.c	Mon Aug  6 15:24:10 2007
@@ -67,7 +67,7 @@
  * The NEA_DEBUG environment variable is used to determine the debug
  * logging level for @b nea module. The default level is 3.
  * 
- * @sa <su_debug.h>, nea_log, SOFIA_DEBUG
+ * @sa <sofia-sip/su_debug.h>, nea_log, SOFIA_DEBUG
  */
 extern char const NEA_DEBUG[];
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/Doxyfile.in
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/Doxyfile.in	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/Doxyfile.in	Mon Aug  6 15:24:10 2007
@@ -14,6 +14,7 @@
 TAGFILES           += ../docs/sip.doxytags=../sip
 TAGFILES           += ../docs/sresolv.doxytags=../sresolv
 TAGFILES           += ../docs/tport.doxytags=../tport
+TAGFILES           += ../docs/nua.doxytags=../nua
 
 GENERATE_TAGFILE    = ../docs/nta.doxytags
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.c	Mon Aug  6 15:24:10 2007
@@ -282,7 +282,7 @@
  * The NTA_DEBUG environment variable is used to determine the default
  * debug logging level. The normal level is 3.
  * 
- * @sa <su_debug.h>, #su_log_global, #SOFIA_DEBUG
+ * @sa <sofia-sip/su_debug.h>, #su_log_global, #SOFIA_DEBUG
  */
 #ifdef DOXYGEN
 extern char const NTA_DEBUG[]; /* dummy declaration for Doxygen */
@@ -336,13 +336,36 @@
  * @param contact_url   URL that agent uses to bind the server sockets
  * @param callback      pointer to callback function
  * @param magic         pointer to user data
- * @param tag,value,... other arguments
+ * @param tag,value,... tagged arguments
  *
- * @note It is possible to provide -1 as @a contact_url.
+ * @TAGS
+ * NTATAG_ALIASES(),
+ * NTATAG_BAD_REQ_MASK(), NTATAG_BAD_RESP_MASK(), NTATAG_BLACKLIST(),
+ * NTATAG_CANCEL_2543(), NTATAG_CANCEL_487(), NTATAG_CLIENT_RPORT(),
+ * NTATAG_DEBUG_DROP_PROB(), NTATAG_DEFAULT_PROXY(),
+ * NTATAG_EXTRA_100(),
+ * NTATAG_MAXSIZE(), NTATAG_MAX_FORWARDS(), NTATAG_MERGE_482(), NTATAG_MCLASS()
+ * NTATAG_PASS_100(), NTATAG_PASS_408(), NTATAG_PRELOAD(), NTATAG_PROGRESS(), 
+ * NTATAG_REL100(), 
+ * NTATAG_SERVER_RPORT(),
+ * NTATAG_SIPFLAGS(),
+ * NTATAG_SIP_T1X64(), NTATAG_SIP_T1(), NTATAG_SIP_T2(), NTATAG_SIP_T4(),
+ * NTATAG_STATELESS(),
+ * NTATAG_TAG_3261(), NTATAG_TCP_RPORT(), NTATAG_TIMEOUT_408(),
+ * NTATAG_TIMER_C(),
+ * NTATAG_UA(), NTATAG_UDP_MTU(), NTATAG_USER_VIA(),
+ * NTATAG_USE_NAPTR(), NTATAG_USE_SRV() and NTATAG_USE_TIMESTAMP().
+ *
+ * @note The value from following tags are stored, but they currently do nothing:
+ * NTATAG_SIGCOMP_ALGORITHM(), NTATAG_SIGCOMP_OPTIONS(), NTATAG_SMIME()
+ *
+ * @note It is possible to provide @c (url_string_t*)-1 as @a contact_url. 
+ * In that case, no server sockets are bound.
  * 
  * @retval handle to the agent when successful,
  * @retval NULL upon an error.
  *
+ * @sa NUTAG_
  */
 nta_agent_t *nta_agent_create(su_root_t *root,
 			      url_string_t const *contact_url,
@@ -359,6 +382,8 @@
   ta_start(ta, tag, value);
 
   if ((agent = su_home_new(sizeof(*agent)))) {
+    unsigned timer_c;
+
     agent->sa_root = root;
     agent->sa_callback = callback;
     agent->sa_magic = magic;
@@ -366,13 +391,20 @@
 
     agent->sa_maxsize         = 2 * 1024 * 1024; /* 2 MB */
     agent->sa_bad_req_mask    = 
-      (unsigned) ~(sip_mask_response | sip_mask_proxy);
+      /*
+       * Bit-wise not of these - what is left is suitable for UAs with 
+       * 100rel, timer, events, publish 
+       */
+      (unsigned) ~(sip_mask_response | sip_mask_proxy | sip_mask_registrar | 
+		   sip_mask_pref | sip_mask_privacy);
     agent->sa_bad_resp_mask   = 
-      (unsigned) ~(sip_mask_request | sip_mask_proxy);
+      (unsigned) ~(sip_mask_request | sip_mask_proxy | sip_mask_registrar | 
+		   sip_mask_pref | sip_mask_privacy);
     agent->sa_t1 	      = NTA_SIP_T1;
     agent->sa_t2 	      = NTA_SIP_T2;
     agent->sa_t4              = NTA_SIP_T4;
     agent->sa_t1x64 	      = 64 * NTA_SIP_T1;
+    agent->sa_timer_c         = 185 * 1000;
     agent->sa_drop_prob       = 0;
     agent->sa_is_a_uas        = 0;
     agent->sa_progress        = 60 * 1000;
@@ -421,7 +453,9 @@
     outgoing_queue_init(agent->sa_out.terminated, 0); 
     /* Special queues (states) for outgoing INVITE transactions */
     outgoing_queue_init(agent->sa_out.inv_calling, agent->sa_t1x64); /* B */
-    outgoing_queue_init(agent->sa_out.inv_proceeding, 0); 
+    timer_c = (agent->sa_use_timer_c || !agent->sa_is_a_uas)
+      ? agent->sa_timer_c : 0;
+    outgoing_queue_init(agent->sa_out.inv_proceeding, timer_c); /* C */
     outgoing_queue_init(agent->sa_out.inv_completed, 32000); /* Timer D */
 
     if (leg_htable_resize(agent->sa_home, agent->sa_dialogs, 0) < 0 ||
@@ -841,17 +875,25 @@
  * 0 selects the default value.
  *
  * @TAGS
- * NTATAG_ALIASES(), NTATAG_BAD_REQ_MASK(), NTATAG_BAD_RESP_MASK(),
- * NTATAG_CANCEL_2543(), NTATAG_CANCEL_487(), NTATAG_DEBUG_DROP_PROB(),
- * NTATAG_DEFAULT_PROXY(), NTATAG_EXTRA_100(), NTATAG_MAXSIZE(),
- * NTATAG_MAX_FORWARDS(),
- * NTATAG_UDP_MTU(), NTATAG_MERGE_482(), NTATAG_PASS_100(),
- * NTATAG_PRELOAD(), NTATAG_REL100(), NTATAG_RPORT(), NTATAG_SERVER_RPORT(),
- * NTATAG_TCP_RPORT(),
- * NTATAG_SIPFLAGS(), NTATAG_SIP_T1X64(), NTATAG_SIP_T1(), NTATAG_SIP_T2(),
- * NTATAG_SIP_T4(), NTATAG_SMIME(), NTATAG_STATELESS(), NTATAG_TAG_3261(),
- * NTATAG_TIMEOUT_408(), NTATAG_PASS_408(), NTATAG_UA(), NTATAG_USER_VIA(),
- * and NTATAG_USE_TIMESTAMP().
+ * NTATAG_ALIASES(),
+ * NTATAG_BAD_REQ_MASK(), NTATAG_BAD_RESP_MASK(), NTATAG_BLACKLIST(),
+ * NTATAG_CANCEL_2543(), NTATAG_CANCEL_487(), NTATAG_CLIENT_RPORT(),
+ * NTATAG_DEBUG_DROP_PROB(), NTATAG_DEFAULT_PROXY(),
+ * NTATAG_EXTRA_100(),
+ * NTATAG_MAXSIZE(), NTATAG_MAX_FORWARDS(), NTATAG_MERGE_482(), NTATAG_MCLASS()
+ * NTATAG_PASS_100(), NTATAG_PASS_408(), NTATAG_PRELOAD(), NTATAG_PROGRESS(), 
+ * NTATAG_REL100(), 
+ * NTATAG_SERVER_RPORT(),
+ * NTATAG_SIPFLAGS(),
+ * NTATAG_SIP_T1X64(), NTATAG_SIP_T1(), NTATAG_SIP_T2(), NTATAG_SIP_T4(),
+ * NTATAG_STATELESS(),
+ * NTATAG_TAG_3261(), NTATAG_TCP_RPORT(), NTATAG_TIMEOUT_408(),
+ * NTATAG_TIMER_C(),
+ * NTATAG_UA(), NTATAG_UDP_MTU(), NTATAG_USER_VIA(),
+ * NTATAG_USE_NAPTR(), NTATAG_USE_SRV() and NTATAG_USE_TIMESTAMP().
+ *
+ * @note The value from following tags are stored, but they currently do nothing:
+ * NTATAG_SIGCOMP_ALGORITHM(), NTATAG_SIGCOMP_OPTIONS(), NTATAG_SMIME()
  */
 int nta_agent_set_params(nta_agent_t *agent,
 			 tag_type_t tag, tag_value_t value, ...)
@@ -875,7 +917,7 @@
 static
 int agent_set_params(nta_agent_t *agent, tagi_t *tags)
 {
-  int n, m;
+  int n, nC, m;
   unsigned bad_req_mask = agent->sa_bad_req_mask;
   unsigned bad_resp_mask = agent->sa_bad_resp_mask;
   usize_t  maxsize    = agent->sa_maxsize;
@@ -885,6 +927,7 @@
   unsigned sip_t2     = agent->sa_t2;
   unsigned sip_t4     = agent->sa_t4;
   unsigned sip_t1x64  = agent->sa_t1x64;
+  unsigned timer_c    = agent->sa_timer_c;
   unsigned blacklist  = agent->sa_blacklist;
   int ua              = agent->sa_is_a_uas;
   unsigned progress   = agent->sa_progress;
@@ -919,50 +962,54 @@
   su_home_t *home = agent->sa_home;
 
   n = tl_gets(tags,
-	      NTATAG_MCLASS_REF(mclass),
+	      NTATAG_ALIASES_REF(aliases),
 	      NTATAG_BAD_REQ_MASK_REF(bad_req_mask),
 	      NTATAG_BAD_RESP_MASK_REF(bad_resp_mask),
-	      NTATAG_ALIASES_REF(aliases),
-	      NTATAG_UA_REF(ua),
-	      NTATAG_STATELESS_REF(stateless),
-	      NTATAG_MAXSIZE_REF(maxsize),
-	      NTATAG_MAX_FORWARDS_REF(max_forwards),
-	      NTATAG_UDP_MTU_REF(udp_mtu),
-	      NTATAG_SIP_T1_REF(sip_t1),
-	      NTATAG_SIP_T2_REF(sip_t2),
-	      NTATAG_SIP_T4_REF(sip_t4),
-	      NTATAG_SIP_T1X64_REF(sip_t1x64),
-	      NTATAG_PROGRESS_REF(progress),
 	      NTATAG_BLACKLIST_REF(blacklist),
+	      NTATAG_CANCEL_2543_REF(cancel_2543),
+	      NTATAG_CANCEL_487_REF(cancel_487),
 	      NTATAG_DEBUG_DROP_PROB_REF(drop_prob),
-	      NTATAG_USER_VIA_REF(user_via),
+	      NTATAG_DEFAULT_PROXY_REF(proxy),
 	      NTATAG_EXTRA_100_REF(extra_100),
+	      NTATAG_MAXSIZE_REF(maxsize),
+	      NTATAG_MAX_FORWARDS_REF(max_forwards),
+	      NTATAG_MCLASS_REF(mclass),
+	      NTATAG_MERGE_482_REF(merge_482),
 	      NTATAG_PASS_100_REF(pass_100),
-	      NTATAG_TIMEOUT_408_REF(timeout_408),
 	      NTATAG_PASS_408_REF(pass_408),
-	      NTATAG_MERGE_482_REF(merge_482),
-	      NTATAG_DEFAULT_PROXY_REF(proxy),
-	      NTATAG_CANCEL_2543_REF(cancel_2543),
-	      NTATAG_CANCEL_487_REF(cancel_487),
+	      NTATAG_PRELOAD_REF(preload),
+	      NTATAG_PROGRESS_REF(progress),
 	      NTATAG_REL100_REF(invite_100rel),
-	      NTATAG_USE_TIMESTAMP_REF(use_timestamp),
-	      NTATAG_USE_NAPTR_REF(use_naptr),
-	      NTATAG_USE_SRV_REF(use_srv),
+	      NTATAG_RPORT_REF(rport),
+	      NTATAG_SERVER_RPORT_REF(server_rport),
+	      NTATAG_SIGCOMP_ALGORITHM_REF(algorithm),
+	      NTATAG_SIGCOMP_OPTIONS_REF(sigcomp),
+	      NTATAG_SIPFLAGS_REF(flags),
+	      NTATAG_SIP_T1X64_REF(sip_t1x64),
+	      NTATAG_SIP_T1_REF(sip_t1),
+	      NTATAG_SIP_T2_REF(sip_t2),
+	      NTATAG_SIP_T4_REF(sip_t4),
 #if HAVE_SOFIA_SMIME
 	      NTATAG_SMIME_REF(smime),
 #endif
-	      NTATAG_SIPFLAGS_REF(flags),
-	      NTATAG_RPORT_REF(rport),
-	      NTATAG_SERVER_RPORT_REF(server_rport),
+	      NTATAG_STATELESS_REF(stateless),
 	      NTATAG_TCP_RPORT_REF(tcp_rport),
-	      NTATAG_PRELOAD_REF(preload),
+	      NTATAG_TIMEOUT_408_REF(timeout_408),
+	      NTATAG_UA_REF(ua),
+	      NTATAG_UDP_MTU_REF(udp_mtu),
+	      NTATAG_USER_VIA_REF(user_via),
+	      NTATAG_USE_NAPTR_REF(use_naptr),
+	      NTATAG_USE_SRV_REF(use_srv),
+	      NTATAG_USE_TIMESTAMP_REF(use_timestamp),
 #ifdef TPTAG_THRPSIZE
 	      /* If threadpool is enabled, start a separate "reaper thread" */
 	      TPTAG_THRPSIZE_REF(threadpool),
 #endif
-	      NTATAG_SIGCOMP_OPTIONS_REF(sigcomp),
-	      NTATAG_SIGCOMP_ALGORITHM_REF(algorithm),
 	      TAG_END());
+  nC = tl_gets(tags,
+	       NTATAG_TIMER_C_REF(timer_c),
+	       TAG_END());
+  n += nC;
 
   if (mclass != NONE)
     agent->sa_mclass = mclass ? mclass : sip_default_mclass();
@@ -972,7 +1019,7 @@
     m = tport_set_params(tport, TAG_NEXT(tags));
   }
 
-  if (n == 0 || m == -1)
+  if (m == -1)
     return m;
 
   n += m;
@@ -1065,6 +1112,14 @@
     outgoing_queue_adjust(agent, agent->sa_out.inv_calling, sip_t1x64);
   }
   agent->sa_t1x64 = sip_t1x64;
+  if (nC == 1) {
+    agent->sa_use_timer_c = 1;
+    if (timer_c == 0)
+      timer_c = 185 * 1000;
+    agent->sa_timer_c = timer_c;
+    outgoing_queue_adjust(agent, agent->sa_out.inv_proceeding, timer_c);
+  }
+
   agent->sa_blacklist = blacklist;
 
   if (progress == 0)
@@ -1123,16 +1178,25 @@
  * INVITE transactions, or how the @Via headers are generated.
  *
  * @TAGS
- * NTATAG_ALIASES_REF(), NTATAG_CANCEL_2543_REF(), NTATAG_CANCEL_487_REF(),
- * NTATAG_CONTACT_REF(), NTATAG_DEBUG_DROP_PROB_REF(),
- * NTATAG_DEFAULT_PROXY_REF(), NTATAG_EXTRA_100_REF(), NTATAG_MAXSIZE_REF(),
- * NTATAG_MAX_FORWARDS_REF(),
- * NTATAG_MERGE_482_REF(), NTATAG_PASS_100_REF(), NTATAG_PRELOAD_REF(),
- * NTATAG_REL100_REF(), NTATAG_RPORT_REF(), NTATAG_SIPFLAGS_REF(),
- * NTATAG_SIP_T1X64_REF(), NTATAG_SIP_T1_REF(), NTATAG_SIP_T2_REF(),
+ * NTATAG_ALIASES_REF(), NTATAG_BLACKLIST_REF(), 
+ * NTATAG_CANCEL_2543_REF(), NTATAG_CANCEL_487_REF(),
+ * NTATAG_CLIENT_RPORT_REF(), NTATAG_CONTACT_REF(), 
+ * NTATAG_DEBUG_DROP_PROB_REF(), NTATAG_DEFAULT_PROXY_REF(),
+ * NTATAG_EXTRA_100_REF(),
+ * NTATAG_MAXSIZE_REF(), NTATAG_MAX_FORWARDS_REF(), NTATAG_MCLASS_REF(),
+ * NTATAG_MERGE_482_REF(), 
+ * NTATAG_PASS_100_REF(), NTATAG_PASS_408_REF(), NTATAG_PRELOAD_REF(),
+ * NTATAG_PROGRESS_REF(),
+ * NTATAG_REL100_REF(), 
+ * NTATAG_SERVER_RPORT_REF(), 
+ * NTATAG_SIGCOMP_ALGORITHM_REF(), NTATAG_SIGCOMP_OPTIONS_REF(),
+ * NTATAG_SIPFLAGS_REF(),
+ * NTATAG_SIP_T1_REF(), NTATAG_SIP_T1X64_REF(), NTATAG_SIP_T2_REF(),
  * NTATAG_SIP_T4_REF(), NTATAG_SMIME_REF(), NTATAG_STATELESS_REF(),
- * NTATAG_TAG_3261_REF(), NTATAG_TIMEOUT_408_REF(), NTATAG_PASS_408_REF(),
- * NTATAG_UA_REF(), NTATAG_USER_VIA_REF(), and NTATAG_USE_TIMESTAMP_REF().
+ * NTATAG_TAG_3261_REF(), NTATAG_TIMEOUT_408_REF(), NTATAG_TIMER_C_REF(),
+ * NTATAG_UA_REF(), NTATAG_UDP_MTU_REF(), NTATAG_USER_VIA_REF(), 
+ * NTATAG_USE_NAPTR_REF(), NTATAG_USE_SRV_REF(),
+ * and NTATAG_USE_TIMESTAMP_REF().
  *
  */
 int nta_agent_get_params(nta_agent_t *agent,
@@ -1145,12 +1209,11 @@
     ta_start(ta, tag, value);
     n = agent_get_params(agent, ta_args(ta));
     ta_end(ta);
-  } else {
-    su_seterrno(EINVAL);
-    n = -1;
+    return n;
   }
 
-  return n;
+  su_seterrno(EINVAL);
+  return -1;
 }
 
 /** Get NTA parameters */
@@ -1159,46 +1222,49 @@
 {
   return
     tl_tgets(tags,
-	     NTATAG_MCLASS(agent->sa_mclass),
-	     NTATAG_CONTACT(agent->sa_contact),
 	     NTATAG_ALIASES(agent->sa_aliases),
-	     NTATAG_UA(agent->sa_is_a_uas),
-	     NTATAG_STATELESS(agent->sa_is_stateless),
-	     NTATAG_MAXSIZE(agent->sa_maxsize),
-	     NTATAG_MAX_FORWARDS(agent->sa_max_forwards->mf_count),
-	     NTATAG_UDP_MTU(agent->sa_udp_mtu),
-	     NTATAG_SIP_T1(agent->sa_t1),
-	     NTATAG_SIP_T2(agent->sa_t2),
-	     NTATAG_SIP_T4(agent->sa_t4),
-	     NTATAG_SIP_T1X64(agent->sa_t1x64),
 	     NTATAG_BLACKLIST(agent->sa_blacklist),
+	     NTATAG_CANCEL_2543(agent->sa_cancel_2543),
+	     NTATAG_CANCEL_487(agent->sa_cancel_487),
+	     NTATAG_CLIENT_RPORT(agent->sa_rport),
+	     NTATAG_CONTACT(agent->sa_contact),
 	     NTATAG_DEBUG_DROP_PROB(agent->sa_drop_prob),
-	     NTATAG_USER_VIA(agent->sa_user_via),
+	     NTATAG_DEFAULT_PROXY(agent->sa_default_proxy),
 	     NTATAG_EXTRA_100(agent->sa_extra_100),
+	     NTATAG_MAXSIZE(agent->sa_maxsize),
+	     NTATAG_MAX_FORWARDS(agent->sa_max_forwards->mf_count),
+	     NTATAG_MCLASS(agent->sa_mclass),
+	     NTATAG_MERGE_482(agent->sa_merge_482),
 	     NTATAG_PASS_100(agent->sa_pass_100),
-	     NTATAG_TIMEOUT_408(agent->sa_timeout_408),
 	     NTATAG_PASS_408(agent->sa_pass_408),
-	     NTATAG_MERGE_482(agent->sa_merge_482),
-	     NTATAG_DEFAULT_PROXY(agent->sa_default_proxy),
-	     NTATAG_CANCEL_2543(agent->sa_cancel_2543),
-	     NTATAG_CANCEL_487(agent->sa_cancel_487),
-	     NTATAG_TAG_3261(1),
+	     NTATAG_PRELOAD(agent->sa_preload),
+	     NTATAG_PROGRESS(agent->sa_progress),
 	     NTATAG_REL100(agent->sa_invite_100rel),
-	     NTATAG_USE_TIMESTAMP(agent->sa_timestamp),
-	     NTATAG_USE_NAPTR(agent->sa_use_naptr),
-	     NTATAG_USE_SRV(agent->sa_use_srv),
+	     NTATAG_SERVER_RPORT(agent->sa_server_rport),
+	     NTATAG_SIGCOMP_ALGORITHM(agent->sa_algorithm),
+	     NTATAG_SIGCOMP_OPTIONS(agent->sa_sigcomp_options ?
+				    agent->sa_sigcomp_options :
+				    "sip"),
+	     NTATAG_SIPFLAGS(agent->sa_flags),
+	     NTATAG_SIP_T1(agent->sa_t1),
+	     NTATAG_SIP_T1X64(agent->sa_t1x64),
+	     NTATAG_SIP_T2(agent->sa_t2),
+	     NTATAG_SIP_T4(agent->sa_t4),
 #if HAVE_SOFIA_SMIME
 	     NTATAG_SMIME(agent->sa_smime),
 #else
 	     NTATAG_SMIME(NULL),
 #endif
-	     NTATAG_SIPFLAGS(agent->sa_flags),
-	     NTATAG_RPORT(agent->sa_rport),
-	     NTATAG_PRELOAD(agent->sa_preload),
-	     NTATAG_SIGCOMP_ALGORITHM(agent->sa_algorithm),
-	     NTATAG_SIGCOMP_OPTIONS(agent->sa_sigcomp_options ?
-				    agent->sa_sigcomp_options :
-				    "sip"),
+	     NTATAG_STATELESS(agent->sa_is_stateless),
+	     NTATAG_TAG_3261(1),
+	     NTATAG_TIMEOUT_408(agent->sa_timeout_408),
+	     NTATAG_TIMER_C(agent->sa_timer_c),
+	     NTATAG_UA(agent->sa_is_a_uas),
+	     NTATAG_UDP_MTU(agent->sa_udp_mtu),
+	     NTATAG_USER_VIA(agent->sa_user_via),
+	     NTATAG_USE_NAPTR(agent->sa_use_naptr),
+	     NTATAG_USE_SRV(agent->sa_use_srv),
+	     NTATAG_USE_TIMESTAMP(agent->sa_timestamp),
 	     TAG_END());
 }
 
@@ -1207,8 +1273,38 @@
  * The nta_agent_get_stats() function retrieves the stack statistics.
  *
  * @TAGS
- * @TAG NTATAG_S_*
- *
+ * NTATAG_S_ACKED_TR_REF(),
+ * NTATAG_S_BAD_MESSAGE_REF(),
+ * NTATAG_S_BAD_REQUEST_REF(),
+ * NTATAG_S_BAD_RESPONSE_REF(),
+ * NTATAG_S_CANCELED_TR_REF(),
+ * NTATAG_S_CLIENT_TR_REF(),
+ * NTATAG_S_DIALOG_TR_REF(),
+ * NTATAG_S_DROP_REQUEST_REF(),
+ * NTATAG_S_DROP_RESPONSE_REF(),
+ * NTATAG_S_IRQ_HASH_REF(),
+ * NTATAG_S_IRQ_HASH_USED_REF(),
+ * NTATAG_S_LEG_HASH_REF(),
+ * NTATAG_S_LEG_HASH_USED_REF(),
+ * NTATAG_S_MERGED_REQUEST_REF(),
+ * NTATAG_S_ORQ_HASH_REF(),
+ * NTATAG_S_ORQ_HASH_USED_REF(),
+ * NTATAG_S_RECV_MSG_REF(),
+ * NTATAG_S_RECV_REQUEST_REF(),
+ * NTATAG_S_RECV_RESPONSE_REF(),
+ * NTATAG_S_RECV_RETRY_REF(),
+ * NTATAG_S_RETRY_REQUEST_REF(),
+ * NTATAG_S_RETRY_RESPONSE_REF(),
+ * NTATAG_S_SENT_MSG_REF(),
+ * NTATAG_S_SENT_REQUEST_REF(),
+ * NTATAG_S_SENT_RESPONSE_REF(),
+ * NTATAG_S_SERVER_TR_REF(),
+ * NTATAG_S_TOUT_REQUEST_REF(), 
+ * NTATAG_S_TOUT_RESPONSE_REF(),
+ * NTATAG_S_TRLESS_200_REF(),
+ * NTATAG_S_TRLESS_REQUEST_REF(),
+ * NTATAG_S_TRLESS_RESPONSE_REF(), and
+ * NTATAG_S_TRLESS_TO_TR_REF(),
  */
 int nta_agent_get_stats(nta_agent_t *agent,
 			tag_type_t tag, tag_value_t value, ...)
@@ -1622,7 +1718,6 @@
     tport_tcreate(self, nta_agent_class, self->sa_root,
 		  TPTAG_SDWN_ERROR(0),
 		  TPTAG_IDLE(1800000),
-		  TPTAG_DEBUG_DROP(self->sa_drop_prob),
 		  TAG_NEXT(tags));
 
   if (!self->sa_tports)
@@ -2119,6 +2214,16 @@
 	      URL_PRINT_ARGS(sip->sip_request->rq_url),
 	      sip->sip_request->rq_version, cseq));
 
+  if (agent->sa_drop_prob && !tport_is_reliable(tport)) {
+    if ((unsigned)su_randint(0, 1000) < agent->sa_drop_prob) {
+      SU_DEBUG_5(("nta: %s (%u) is %s\n", 
+		  method_name, cseq, "dropped simulating packet loss"));
+      agent->sa_stats->as_drop_request++;
+      msg_destroy(msg);
+      return;
+    }
+  }
+
   stream = tport_is_stream(tport);
 
   /* Try to use compression on reverse direction if @Via has comp=sigcomp  */
@@ -2304,8 +2409,9 @@
   }
   else {
     agent->sa_stats->as_trless_request++;
-    SU_DEBUG_5(("nta: %s (%u) no place to go: %d %s\n",
-		method_name, cseq, SIP_501_NOT_IMPLEMENTED));
+    SU_DEBUG_5(("nta: %s (%u) %s\n",
+		method_name, cseq, 
+		"not processed by application: returning 501"));
     if (method != sip_method_ack)
       nta_msg_treply(agent, msg, SIP_501_NOT_IMPLEMENTED,
 		     NTATAG_TPORT(tport),
@@ -2493,6 +2599,16 @@
   SU_DEBUG_5(("nta: received %03d %s for %s (%u)\n", 
 	      status, phrase, method, cseq));
 
+  if (agent->sa_drop_prob && !tport_is_reliable(tport)) {
+    if ((unsigned)su_randint(0, 1000) < agent->sa_drop_prob) {
+      SU_DEBUG_5(("nta: %03d %s %s\n",
+		  status, phrase, "dropped simulating packet loss"));
+      agent->sa_stats->as_drop_response++;
+      msg_destroy(msg);
+      return;
+    }
+  }
+
   if (agent->sa_bad_resp_mask)
     errors = msg_extract_errors(msg) & agent->sa_bad_resp_mask;
   else
@@ -2505,7 +2621,10 @@
     agent->sa_stats->as_bad_response++;
     agent->sa_stats->as_bad_message++;
 
-    SU_DEBUG_5(("nta: %03d %s failed sanity check\n", status, phrase));
+    SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase,
+		errors
+		? "has fatal syntax errors"
+		: "failed sanity check"));
 
     for (h = (sip_header_t const *)sip->sip_error; h; h = h->sh_next) {
       if (h->sh_class->hc_name) {
@@ -2532,7 +2651,7 @@
     /* Drop response messages to ACK */
     agent->sa_stats->as_bad_response++;
     agent->sa_stats->as_bad_message++;
-    SU_DEBUG_5(("nta: %03d %s is response to ACK\n", status, phrase));
+    SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase, "is response to ACK"));
     msg_destroy(msg);
     return;
   }
@@ -2540,7 +2659,8 @@
   /* XXX - should check if msg should be discarded based on via? */
 
   if ((orq = outgoing_find(agent, msg, sip, sip->sip_via))) {
-    SU_DEBUG_5(("nta: %03d %s going to a transaction\n", status, phrase));
+    SU_DEBUG_5(("nta: %03d %s %s\n", 
+		status, phrase, "is going to a transaction"));
     if (outgoing_recv(orq, status, msg, sip) == 0)
       return;
   }
@@ -2548,12 +2668,13 @@
   agent->sa_stats->as_trless_response++;
 
   if ((orq = agent->sa_default_outgoing)) {
-    SU_DEBUG_5(("nta: %03d %s to the default transaction\n", status, phrase));
+    SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase, 
+		"to the default transaction"));
     outgoing_default_recv(orq, status, msg, sip);
     return;
   }
   else if (agent->sa_callback) {
-    SU_DEBUG_5(("nta: %03d %s to message callback\n", status, phrase));
+    SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase, "to message callback"));
     /*
      * Store message and transport to hook for the duration of the callback
      * so that the transport can be obtained by nta_transport().
@@ -2569,13 +2690,15 @@
       && sip->sip_via && !sip->sip_via->v_next 
       && agent_has_via(agent, sip->sip_via)) {
     agent->sa_stats->as_trless_200++;
-    /* Orphan 200 Ok to INVITE. ACK and BYE it */
-    SU_DEBUG_5(("nta: %03d %s must be ACK&BYE\n", status, phrase));
-    if (nta_msg_ackbye(agent, msg) != -1)
-      return;
+    if (agent->sa_is_a_uas) {
+      /* Orphan 200 Ok to INVITE. ACK and BYE it */
+      SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase, "is ACK&BYE"));
+      if (nta_msg_ackbye(agent, msg) != -1)
+	return;
+    }
   }
 
-  SU_DEBUG_5(("nta: %03d %s was discarded\n", status, phrase));
+  SU_DEBUG_5(("nta: %03d %s %s\n", status, phrase, "was discarded"));
   msg_destroy(msg);
 }
 
@@ -2817,6 +2940,7 @@
 	  NTATAG_TPORT_REF(tport),
 	  NTATAG_INCOMPLETE_REF(incomplete),
 	  TPTAG_COMPARTMENT_REF(cc),
+	  /* XXX - should also check ntatag_sigcomp_close() */
 	  TAG_END());
 
   if (reply == NULL) {
@@ -3340,6 +3464,7 @@
   nta_leg_t *leg;
   su_home_t *home;
   url_t *url;
+  char const *what = NULL;
 
   if (agent == NULL)
     return su_seterrno(EINVAL), NULL;
@@ -3423,32 +3548,35 @@
   leg->leg_url = url;
 
   if (from && from != NONE && leg->leg_local == NULL) {
-    SU_DEBUG_3(("nta_leg_tcreate(): cannot duplicate local address\n"));
+    what = "cannot duplicate local address";
     goto err;
   }
   else if (to && to != NONE && leg->leg_remote == NULL) {
-    SU_DEBUG_3(("nta_leg_tcreate(): cannot duplicate remote address\n"));
+    what = "cannot duplicate remote address";
     goto err;
   }
   else if (route && route != NONE && leg->leg_route == NULL) {
-    SU_DEBUG_3(("nta_leg_tcreate(): cannot duplicate route\n"));
+    what = "cannot duplicate route";
     goto err;
   }
   else if (contact && contact != NONE && leg->leg_target == NULL) {
-    SU_DEBUG_3(("nta_leg_tcreate(): cannot duplicate target\n"));
+    what = "cannot duplicate target";
     goto err;
   }
   else if (url_string && leg->leg_url == NULL) {
-    SU_DEBUG_3(("nta_leg_tcreate(): cannot duplicate local destination\n"));
+    what = "cannot duplicate local destination";
     goto err;
   }
 
   if (!no_dialog) {
     if (!leg->leg_local || !leg->leg_remote) {
       /* To and/or From header missing */
-      SU_DEBUG_3(("nta_leg_tcreate(): missing%s%s header\n",
-		  !leg->leg_remote ? " To" : "",
-		  !leg->leg_local ? " From" : ""));
+      if (leg->leg_remote)
+	what = "Missing local dialog address";
+      else if (leg->leg_local)
+	what = "Missing remote dialog address";
+      else 
+	what = "Missing dialog addresses";
       goto err;
     }
 
@@ -3462,7 +3590,7 @@
       leg->leg_id = sip_call_id_create(home, NULL);
 
     if (!leg->leg_id) {
-      SU_DEBUG_3(("nta_leg_tcreate(): cannot create Call-ID\n"));
+      what = "cannot create Call-ID";
       goto err;
     }
 
@@ -3498,7 +3626,7 @@
   else {
     /* This is "default leg" without a destination URL. */
     if (agent->sa_default_leg) {
-      SU_DEBUG_1(("leg_create(): tried to create second default leg\n"));
+      SU_DEBUG_1(("%s(): %s\n", "nta_leg_tcreate", "tried to create second default leg"));
       su_seterrno(EEXIST);
       goto err;
     }
@@ -3515,11 +3643,14 @@
 
   leg_insert(agent, leg);
 
-  SU_DEBUG_9(("nta_leg_create(%p)\n", (void *)leg));
+  SU_DEBUG_9(("%s(%p)\n", "nta_leg_tcreate", (void *)leg));
 
   return leg;
 
  err:
+  if (what)
+    SU_DEBUG_9(("%s(): %s\n", "nta_leg_tcreate", what));
+
   su_home_zap(leg->leg_home);
 
   return NULL;
@@ -4478,7 +4609,7 @@
     } 
     else {
       queue = agent->sa_in.proceeding;
-	/* draft-sparks-sip-nit-actions-03:
+	/* RFC 4320 (nit-actions-03):
 
    Blacklisting on a late response occurs even over reliable transports.
    Thus, if an element processing a request received over a reliable
@@ -5661,7 +5792,7 @@
       irq->irq_method != sip_method_invite && 
       !agent->sa_pass_408 &&
       !irq->irq_default) {
-    /* draft-sparks-sip-nit-actions-03 Action 2:
+    /* RFC 4320 nit-actions-03 Action 2:
        
    A transaction-stateful SIP element MUST NOT send a response with
    Status-Code of 408 to a non-INVITE request.  As a consequence, an
@@ -6199,6 +6330,9 @@
 static size_t outgoing_timer_bf(outgoing_queue_t *q, 
 				char const *timer, 
 				su_duration_t now);
+static size_t outgoing_timer_c(outgoing_queue_t *q, 
+			       char const *timer, 
+			       su_duration_t now);
 
 static void outgoing_ack(nta_outgoing_t *orq, msg_t *msg, sip_t *sip);
 static msg_t *outgoing_ackmsg(nta_outgoing_t *, sip_method_t, char const *,
@@ -6303,7 +6437,7 @@
  * NTATAG_STATELESS(), NTATAG_DELAY_SENDING(), NTATAG_BRANCH_KEY(),
  * NTATAG_ACK_BRANCH(), NTATAG_DEFAULT_PROXY(), NTATAG_PASS_100(),
  * NTATAG_USE_TIMESTAMP(), NTATAG_USER_VIA(), TPTAG_IDENT(), NTATAG_TPORT(). All
- * SIP tags from <sip_tag.h> can be used to manipulate the request message. 
+ * SIP tags from <sofia-sip/sip_tag.h> can be used to manipulate the request message. 
  * SIP tags after SIPTAG_END() are ignored, however.
  */
 nta_outgoing_t *nta_outgoing_tcreate(nta_leg_t *leg,
@@ -6385,13 +6519,13 @@
  * transaction is freed before returning from the function.
  *
  * @sa
- * nta_outgoing_tcreate(), nnta_outgoing_tcancel(), nta_outgoing_destroy().
+ * nta_outgoing_tcreate(), nta_outgoing_tcancel(), nta_outgoing_destroy().
  *
  * @TAGS
  * NTATAG_STATELESS(), NTATAG_DELAY_SENDING(), NTATAG_BRANCH_KEY(),
  * NTATAG_ACK_BRANCH(), NTATAG_DEFAULT_PROXY(), NTATAG_PASS_100(),
  * NTATAG_USE_TIMESTAMP(), NTATAG_USER_VIA(), TPTAG_IDENT(), NTATAG_TPORT(). All
- * SIP tags from <sip_tag.h> can be used to manipulate the request message. 
+ * SIP tags from <sofia-sip/sip_tag.h> can be used to manipulate the request message. 
  * SIP tags after SIPTAG_END() are ignored, however.
  */
 nta_outgoing_t *nta_outgoing_mcreate(nta_agent_t *agent,
@@ -6611,7 +6745,7 @@
   return orq != NULL && orq != NONE ? orq->orq_delay : UINT_MAX;
 }
 
-/** Get the branch parameter. */
+/** Get the branch parameter. @NEW_1_12_7 */
 char const *nta_outgoing_branch(nta_outgoing_t const *orq)
 {
   return orq != NULL && orq != NONE && orq->orq_branch
@@ -6713,6 +6847,8 @@
   char const *scheme = NULL;
   char const *port = NULL;
   int invalid, resolved, stateless = 0, user_via = agent->sa_user_via;
+  int invite_100rel = agent->sa_invite_100rel;
+
   tagi_t const *t;
   tport_t const *override_tport = NULL;
 
@@ -6777,6 +6913,9 @@
     else if (ntatag_tport == tt) {
       override_tport = (tport_t *)t->t_value;
     }
+    else if (ntatag_rel100 == tt) {
+      invite_100rel = t->t_value != 0;
+    }
   }
 
   orq->orq_agent    = agent;
@@ -6798,6 +6937,8 @@
   orq->orq_delay     = UINT_MAX;
   orq->orq_stateless = stateless != 0;
   orq->orq_user_via  = user_via != 0 && sip->sip_via;
+  orq->orq_100rel    = invite_100rel;
+
   if (cc)
     orq->orq_cc = nta_compartment_ref(cc);
 
@@ -7332,17 +7473,18 @@
   supported[i = 0] = NULL;
 
   if (orq->orq_method == sip_method_invite) {
-    int add_100rel = agent->sa_invite_100rel;
     int require_100rel = sip_has_feature(sip->sip_require, "100rel");
 
-    tl_gets(tags,
-	    NTATAG_REL100_REF(add_100rel),
-	    TAG_END());
-    if (add_100rel && !require_100rel &&
-	!sip_has_feature(sip->sip_supported, "100rel"))
-      supported[i++] = "100rel";
-
-    orq->orq_must_100rel = require_100rel;
+    if (require_100rel) {
+      orq->orq_must_100rel = 1;
+      orq->orq_100rel = 1;
+    }
+    else if (sip_has_feature(sip->sip_supported, "100rel")) {
+      orq->orq_100rel = 1;
+    }
+    else if (orq->orq_100rel) {
+	supported[i++] = "100rel";
+    }
   }
 
   if (i) {
@@ -7404,7 +7546,8 @@
   latest = set_timeout(sa, queue->q_timeout = timeout);
 
   for (orq = queue->q_head; orq; orq = orq->orq_next) {
-    if (orq->orq_timeout - latest > 0)
+    if (orq->orq_timeout == 0 ||
+	orq->orq_timeout - latest > 0)
       orq->orq_timeout = latest;
   }
 }
@@ -7659,6 +7802,7 @@
     sa->sa_out.inv_calling->q_length;
   size_t completed = sa->sa_out.completed->q_length + 
     sa->sa_out.inv_completed->q_length;
+  outgoing_queue_t *proceeding = sa->sa_out.inv_proceeding;
 
   outgoing_queue_init(sa->sa_out.free = rq, 0);
 
@@ -7712,9 +7856,12 @@
 
   timeout
     = outgoing_timer_bf(sa->sa_out.inv_calling, "B", now)
+    + outgoing_timer_c(proceeding, "C", now)
     + outgoing_timer_bf(sa->sa_out.trying, "F", now);
 
   next = NEXT_TIMEOUT(next, sa->sa_out.inv_calling->q_head, orq_timeout, now);
+  if (proceeding->q_timeout)
+    next = NEXT_TIMEOUT(next, proceeding->q_head, orq_timeout, now);
   next = NEXT_TIMEOUT(next, sa->sa_out.trying->q_head, orq_timeout, now);
 
   destroyed = outgoing_mass_destroy(sa, rq);
@@ -7791,6 +7938,38 @@
   return timeout;
 }
 
+/** Handle timer C */
+static
+size_t outgoing_timer_c(outgoing_queue_t *q, 
+			char const *timer, 
+			su_duration_t now)
+{
+  nta_outgoing_t *orq;
+  size_t timeout = 0;
+
+  if (q->q_timeout == 0)
+    return 0;
+
+  while ((orq = q->q_head)) {
+    if (orq->orq_timeout - now > 0 || timeout >= timer_max_timeout)
+      break;
+
+    timeout++;
+    
+    SU_DEBUG_5(("nta: timer %s fired, %s %s (%u)\n",
+		timer, "CANCEL and timeout", 
+		orq->orq_method_name, orq->orq_cseq->cs_seq));
+
+    nta_outgoing_tcancel(orq, NULL, NULL, TAG_NULL());
+
+    outgoing_timeout(orq, now);
+
+    assert(q->q_head != orq);
+  }
+
+  return timeout;
+}
+
 /** @internal Signal transaction timeout to the application. */
 void outgoing_timeout(nta_outgoing_t *orq, su_duration_t now)
 {
@@ -8074,6 +8253,13 @@
 	orq->orq_status = status;
 	outgoing_queue(sa->sa_out.inv_proceeding, orq);
       }
+      else if (orq->orq_queue == sa->sa_out.inv_proceeding) {
+	orq->orq_status = status;
+	if (sa->sa_out.inv_proceeding->q_timeout) {
+	  outgoing_remove(orq);
+	  outgoing_queue(sa->sa_out.inv_proceeding, orq);
+	}
+      }
 
       /* Handle 100rel */
       if (sip && sip->sip_rseq)
@@ -8092,6 +8278,10 @@
 	  return 0;
 
 	if (sip && sa->sa_is_a_uas) {
+	  /*
+	   * We silently discard duplicate final responses to INVITE below
+	   * with outgoing_duplicate()
+	   */
 	  su_home_t *home = msg_home(orq->orq_request);
 	  orq->orq_tag = su_strdup(home, sip->sip_to->a_tag);
 	}
@@ -8119,6 +8309,10 @@
       assert(orq_status < 200); (void)orq_status;
 
       if (status < 200) {
+	/* @RFC3261 17.1.2.1:
+	 * retransmissions continue for unreliable transports, 
+	 * but at an interval of T2 
+	 */
 	if (!orq->orq_reliable)
 	  outgoing_set_timer(orq, sa->sa_t2);
       } 
@@ -8324,6 +8518,33 @@
   if (!sip)
     return NULL;
 
+  if (tags) {
+    sip_add_tl(msg, sip, TAG_NEXT(tags));
+    /* Bug sf.net # 173323:
+     * Ensure that request-URI, topmost Via, From, To, Call-ID, CSeq, 
+     * Max-Forward, Route, Accept-Contact, Reject-Contact and
+     * Request-Disposition are copied from original request
+     */
+    if (sip->sip_from)
+      sip_header_remove(msg, sip, (void *)sip->sip_from);
+    if (sip->sip_to)
+      sip_header_remove(msg, sip, (void *)sip->sip_to);
+    if (sip->sip_call_id)
+      sip_header_remove(msg, sip, (void *)sip->sip_call_id);
+    while (sip->sip_route)
+      sip_header_remove(msg, sip, (void *)sip->sip_route);
+    while (sip->sip_accept_contact)
+      sip_header_remove(msg, sip, (void *)sip->sip_accept_contact);
+    while (sip->sip_reject_contact)
+      sip_header_remove(msg, sip, (void *)sip->sip_reject_contact);
+    if (sip->sip_request_disposition)
+      sip_header_remove(msg, sip, (void *)sip->sip_request_disposition);
+    while (sip->sip_via)
+      sip_header_remove(msg, sip, (void *)sip->sip_via);
+    if (sip->sip_max_forwards)
+      sip_header_remove(msg, sip, (void *)sip->sip_max_forwards);
+  }
+
   sip->sip_request =
     sip_request_create(home, m, mname, (url_string_t *)orq->orq_url, NULL);
 
@@ -8335,6 +8556,7 @@
   sip_add_dup(msg, sip, (sip_header_t *)old->sip_accept_contact);
   sip_add_dup(msg, sip, (sip_header_t *)old->sip_reject_contact);
   sip_add_dup(msg, sip, (sip_header_t *)old->sip_request_disposition);
+  sip_add_dup(msg, sip, (sip_header_t *)old->sip_max_forwards);
 
   if (old->sip_via) {
     /* Add only the topmost Via header */
@@ -8344,12 +8566,6 @@
 
   sip->sip_cseq = sip_cseq_create(home, old->sip_cseq->cs_seq, m, mname);
 
-  if (tags)
-    sip_add_tl(msg, sip, TAG_NEXT(tags));
-
-  if (!sip->sip_max_forwards)
-    sip_add_dup(msg, sip, (sip_header_t *)orq->orq_agent->sa_max_forwards);
-
   if (sip->sip_request &&
       sip->sip_to &&
       sip->sip_from &&
@@ -8418,7 +8634,9 @@
   /* Create response message, if needed */
   if (!orq->orq_stateless &&
       !(orq->orq_callback == outgoing_default_cb) &&
-      !(status == 408 && !orq->orq_agent->sa_timeout_408)) {
+      !(status == 408 &&
+	orq->orq_method != sip_method_invite && 
+	!orq->orq_agent->sa_timeout_408)) {
     char const *to_tag;
 
     msg = nta_msg_create(agent, NTA_INTERNAL_MSG);

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.docs
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.docs	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta.docs	Mon Aug  6 15:24:10 2007
@@ -24,8 +24,9 @@
  * (#nta_incoming_t).
  * 
  * NTA also uses SIP message objects #msg_t and #sip_t for handling
- * messages, as defined in <msg.h> and <sip.h>, respectively. The various
- * SIP headers are also defined in <sip.h>.
+ * messages, as defined in <sofia-sip/msg.h> and <sofia-sip/sip.h>,
+ * respectively. The various SIP headers are also defined in
+ * <sofia-sip/sip.h>.
  * 
  * @section nta_agent_t Creating an NTA Agent
  * 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h	Mon Aug  6 15:24:10 2007
@@ -160,10 +160,13 @@
   /** Progress timer - interval between provisional responses sent */
   unsigned              sa_progress;
 
+  /** SIP timer C - interval between provisional responses receivedxs */
+  unsigned              sa_timer_c;
+
   /** Blacklisting period */
   unsigned              sa_blacklist;
 
-  /** NTA is used to test packet drop */
+    /** NTA is used to test packet drop */
   unsigned              sa_drop_prob : 10;
   /** NTA is acting as an User Agent server */
   unsigned              sa_is_a_uas : 1;
@@ -226,6 +229,9 @@
 
   /** Set when executing timer */
   unsigned              sa_in_timer:1;
+  
+  /** Set if application has set value for timer C */
+  unsigned              sa_use_timer_c:1;
 
   unsigned              :0;
 
@@ -307,7 +313,7 @@
 
     /* Special queues (states) for outgoing INVITE transactions */
     outgoing_queue_t  inv_calling[1];	/* Timer B/A */
-    outgoing_queue_t  inv_proceeding[1];
+    outgoing_queue_t  inv_proceeding[1]; /* Timer C */
     outgoing_queue_t  inv_completed[1];	/* Timer D */
 
     /* Temporary queue for transactions waiting to be freed */
@@ -517,6 +523,7 @@
   unsigned orq_sigcomp_zap:1;	/**< Reset SigComp after completing */
   unsigned orq_must_100rel : 1;
   unsigned orq_timestamp : 1;	/**< Insert @Timestamp header. */
+  unsigned orq_100rel:1;	/**< Support 100rel */
   unsigned : 0;	/* pad */
 
 #if HAVE_SOFIA_SRESOLV

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c	Mon Aug  6 15:24:10 2007
@@ -76,6 +76,7 @@
 tag_typedef_t ntatag_sip_t2 = UINTTAG_TYPEDEF(sip_t2);
 tag_typedef_t ntatag_sip_t4 = UINTTAG_TYPEDEF(sip_t4);
 tag_typedef_t ntatag_progress = UINTTAG_TYPEDEF(progress);
+tag_typedef_t ntatag_timer_c = UINTTAG_TYPEDEF(timer_c);
 tag_typedef_t ntatag_blacklist = UINTTAG_TYPEDEF(blacklist);
 tag_typedef_t ntatag_debug_drop_prob = UINTTAG_TYPEDEF(debug_drop_prob);
 

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta_tag.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta_tag.h	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/sofia-sip/nta_tag.h	Mon Aug  6 15:24:10 2007
@@ -58,7 +58,25 @@
 /* Tags for parameters */
 
 NTA_DLL extern tag_typedef_t ntatag_mclass;
-/** Message class used by NTA. @HI */
+/** Message class used by NTA. 
+ *
+ * The nta can use a custom or extended parser created with
+ * msg_mclass_clone().
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    pointer to #msg_mclass_t.
+ *
+ * @par Values
+ *    - custom or extended parser created with msg_mclass_clone()
+ *    - NULL - use default parser
+ *
+ * @sa NTATAG_SIPFLAGS()
+ */
 #define NTATAG_MCLASS(x) ntatag_mclass, tag_cptr_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_mclass_ref;
@@ -68,9 +86,33 @@
 /** Mask for bad request messages. 
  * 
  * If an incoming request has erroneous headers matching with the mask, nta
- * automatically returns a 400 Bad Message response to them. If no mask is
- * specified, all requests with any bad header are dropped.
+ * automatically returns a 400 Bad Message response to them. 
+ *
+ * If mask ~0U (all bits set) is specified, all requests with any bad header
+ * are dropped. By default only the requests with bad headers essential for
+ * request processing or proxying are dropped.
  * 
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    unsigned int
+ *
+ * @par Values
+ *    - bitwise or of enum #sip_bad_mask values
+ *
+ * @sa enum #sip_bad_mask, NTATAG_BAD_RESP_MASK()
+ *
+ * @note
+ * The following headers are considered essential by default:
+ * - @ref sip_request \"request line\"", @From, @To, @CSeq, @CallID,
+ *   @ContentLength, @Via, @ContentType, @ContentDisposition,
+ *   @ContentEncoding, @Supported, @Contact, @Require, @RecordRoute, @RAck,
+ *   @RSeq, @Event, @Expires, @SubscriptionState, @SessionExpires,
+ *   @MinSE, @SIPEtag, and @SIPIfMatch.
+ *  
  */
 #define NTATAG_BAD_REQ_MASK(x) ntatag_bad_req_mask, tag_uint_v((x))
 
@@ -81,8 +123,32 @@
 /** Mask for bad response messages. 
  * 
  * If an incoming response has erroneous headers matching with the mask, nta
- * drops the response message. If no mask is specified, all responses with
- * any bad header are dropped.
+ * drops the response message. 
+ *
+ * If mask ~0U (all bits set) is specified, all responses with any bad header
+ * are dropped. By default only the responses with bad headers essential for
+ * response processing or proxying are dropped.
+ * 
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    unsigned int
+ *
+ * @par Values
+ *    - bitwise or of enum #sip_bad_mask values
+ *
+ * @sa enum #sip_bad_mask, NTATAG_BAD_REQ_MASK()
+ *
+ * @note
+ * The following headers are considered essential by default:
+ * - @ref sip_status \"status line\"", @From, @To, @CSeq, @CallID,
+ *   @ContentLength, @Via, @ContentType, @ContentDisposition,
+ *   @ContentEncoding, @Supported, @Contact, @Require, @RecordRoute, @RAck,
+ *   @RSeq, @Event, @Expires, @SubscriptionState, @SessionExpires, 
+ *   @MinSE, @SIPEtag, and @SIPIfMatch.
  */
 #define NTATAG_BAD_RESP_MASK(x) ntatag_bad_resp_mask, tag_uint_v((x))
 
@@ -90,18 +156,37 @@
 #define NTATAG_BAD_RESP_MASK_REF(x) ntatag_bad_resp_mask_ref, tag_uint_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_default_proxy;
-/** URL for (default) proxy. @HI */
-#define NTATAG_DEFAULT_PROXY(x) \
-ntatag_default_proxy, urltag_url_v((x))
+/** URL for (default) proxy.
+ *
+ * The requests are sent towards the <i>default outbound proxy</i> regardless
+ * the values of request-URI or @Route headers in the request. The URL of
+ * the default proxy is not added to the request in the @Route header or in
+ * the request-URI (against the recommendation of @RFC3261 section 8.1.2).
+ *
+ * The outbound proxy set by NTATAG_DEFAULT_PROXY() is used even if the
+ * dialog had an established route set or registration provided User-Agent
+ * with a @ServiceRoute set.
+ *
+ * @par Used with
+ *    nua_create(), nta_agent_create(), nta_agent_set_params() \n
+ *    nta_outgoing_mcreate(), nta_outgoing_tcreate(),
+ *    nta_outgoing_tcancel(), nta_outgoing_prack(), nta_msg_tsend()
+ *
+ * @par Parameter type
+ *    Pointer to a url_t structure or a string containg a SIP or SIPS URI
+ *
+ * @par Values
+ *    - Valid SIP or SIPS URI
+ */
+#define NTATAG_DEFAULT_PROXY(x) ntatag_default_proxy, urltag_url_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_default_proxy_ref;
 #define NTATAG_DEFAULT_PROXY_REF(x) \
 ntatag_default_proxy_ref, urltag_url_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_contact;
-/** Contact used by NTA. @HI */
-#define NTATAG_CONTACT(x) \
-ntatag_contact, siptag_contact_v((x))
+/** Contact used by NTA. */
+#define NTATAG_CONTACT(x) ntatag_contact, siptag_contact_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_contact_ref;
 #define NTATAG_CONTACT_REF(x) \
@@ -136,21 +221,42 @@
 
 NTA_DLL extern tag_typedef_t ntatag_ack_branch;
 /** Branch for ACKed transaction. @HI */
-#define NTATAG_ACK_BRANCH(x) \
-ntatag_ack_branch, tag_str_v((x))
+#define NTATAG_ACK_BRANCH(x) ntatag_ack_branch, tag_str_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_ack_branch_ref;
-#define NTATAG_ACK_BRANCH_REF(x) \
-ntatag_ack_branch_ref, tag_str_vr(&(x))
+#define NTATAG_ACK_BRANCH_REF(x) ntatag_ack_branch_ref, tag_str_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_comp;
-/** Compression algorithm. @HI */
-#define NTATAG_COMP(x) \
-ntatag_comp, tag_str_v((x))
+/** Compression algorithm. 
+ *
+ * Set compression algorithm for request as described in @RFC3486.
+ *
+ * @note This tag is has no effect without a compression plugin.
+ *
+ * @par Used with
+ *    nta_outgoing_mcreate(), nta_outgoing_tcreate(),
+ *    nta_outgoing_tcancel(), nta_outgoing_prack(), nta_msg_tsend()
+ *
+ * @par
+ * Note that NTATAG_COMP(NULL) can be used with nta_incoming_set_params()
+ * and nta_incoming_treply(), too. It indicates that the response is sent
+ * uncompressed, no matter what the client has in @a comp parameter of @Via
+ * header.
+ *
+ * @par Parameter type
+ *    string
+ *
+ * @par Values
+ *    - name of the compression algorithm ("sigcomp")
+ *
+ * @sa @RFC3320, @RFC3486, TPTAG_COMPARTMENT(),
+ * NTATAG_SIGCOMP_ALGORITHM(), NTATAG_SIGCOMP_AWARE(),
+ * NTATAG_SIGCOMP_CLOSE(), NTATAG_SIGCOMP_OPTIONS()
+ */
+#define NTATAG_COMP(x) ntatag_comp, tag_str_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_comp_ref;
-#define NTATAG_COMP_REF(x) \
-ntatag_comp_ref, tag_str_vr(&(x))
+#define NTATAG_COMP_REF(x) ntatag_comp_ref, tag_str_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_msg;
 /** Pass a SIP message to treply()/tcreate() functions. @HI */
@@ -181,14 +287,49 @@
 #define NTATAG_SMIME_REF(x) ntatag_smime_ref, tag_ptr_vr(&(x), (x))
  
 NTA_DLL extern tag_typedef_t ntatag_maxsize;
-/** Maximum size of incoming message. @HI */
+/** Maximum size of incoming message. @HI 
+ *
+ * If the size of an incoming request message would exceed the
+ * given limit, the stack will automatically respond with <i>413 Request
+ * Entity Too Large</i>.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    usize_t 
+ *
+ * @par Values
+ *    - Maximum acceptable size of an incoming request message.
+ *      Default value is 2 megabytes (2097152 bytes).
+ *
+ * @sa msg_maxsize()
+ */
 #define NTATAG_MAXSIZE(x) ntatag_maxsize, tag_usize_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_maxsize_ref;
 #define NTATAG_MAXSIZE_REF(x) ntatag_maxsize_ref, tag_usize_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_udp_mtu;
-/** Maximum size of outgoing UDP request. @HI */
+/** Maximum size of outgoing UDP request. @HI 
+ *
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    
+ *
+ * @par Values
+ *    - 
+ *
+ * @sa
+ *
+ */
 #define NTATAG_UDP_MTU(x) ntatag_udp_mtu, tag_usize_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_udp_mtu_ref;
@@ -197,8 +338,22 @@
 NTA_DLL extern tag_typedef_t ntatag_max_forwards;
 /** Default value for @MaxForwards header. 
  *
+ * The default value of @MaxForwards header added to the requests. The
+ * initial value recommended by @RFC3261 is 70, but usually SIP proxies use
+ * much lower default value, such as 24.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    unsigned
+ *
+ * @par Values
+ *    - Default value added to the @MaxForwards header in the sent requests
+ *
  * @since New in @VERSION_1_12_2.
- * @hideinitializer 
  */
 #define NTATAG_MAX_FORWARDS(x) ntatag_max_forwards, tag_uint_v((x))
 
@@ -206,42 +361,194 @@
 #define NTATAG_MAX_FORWARDS_REF(x) ntatag_max_forwards_ref, tag_uint_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_sip_t1;
-/** Initial retransmission interval (in milliseconds) @HI */
+/** Initial retransmission interval (in milliseconds) @HI 
+ *
+ * Set the T1 retransmission interval used by the SIP transaction engine. The
+ * T1 is the initial duration used by request retransmission timers A and E
+ * (UDP) as well as response retransmission timer G.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    unsigned int
+ *
+ * @par Values
+ *    - Value of SIP T1 in milliseconds 
+ *
+ * @sa @RFC3261 appendix A, NTATAG_SIP_T1X4(), NTATAG_SIP_T1(), NTATAG_SIP_T4()
+ */
 #define NTATAG_SIP_T1(x) ntatag_sip_t1, tag_uint_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_sip_t1_ref;
 #define NTATAG_SIP_T1_REF(x) ntatag_sip_t1_ref, tag_uint_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_sip_t1x64;
-/** Transaction timeout (defaults to T1 * 64). @HI */
+/** Transaction timeout (defaults to T1 * 64). @HI 
+ *
+ * Set the T1x64  timeout value used by the SIP transaction engine. The T1x64 is
+ * duration used for timers B, F, H, and J (UDP) by the SIP transaction engine. 
+ * The timeout value T1x64 can be adjusted separately from the initial
+ * retransmission interval T1, which is set with NTATAG_SIP_T1().
+ * 
+ * The default value for T1x64 is 64 times value of T1, or 32000 milliseconds.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    unsigned int
+ *
+ * @par Values
+ *    - Value of T1x64 in milliseconds
+ *
+ * @sa @RFC3261 appendix A, NTATAG_SIP_T1(), NTATAG_SIP_T2(), NTATAG_SIP_T4()
+ *
+ */
 #define NTATAG_SIP_T1X64(x) ntatag_sip_t1x64, tag_uint_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_sip_t1x64_ref;
 #define NTATAG_SIP_T1X64_REF(x) ntatag_sip_t1x64_ref, tag_uint_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_sip_t2;
-/** Maximum retransmission interval (in milliseconds) @HI */
+/** Maximum retransmission interval (in milliseconds) @HI 
+ *
+ * Set the maximum retransmission interval used by the SIP transaction
+ * engine. The T2 is the maximum duration used for the timers E (UDP) and G
+ * by the SIP transaction engine. Note that the timer A is not capped by T2. 
+ * Retransmission interval of INVITE requests grows exponentially until the
+ * timer B fires.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    unsigned int
+ *
+ * @par Values
+ *    - Value of SIP T2 in milliseconds 
+ *
+ * @sa @RFC3261 appendix A, NTATAG_SIP_T1(), NTATAG_SIP_T1X4(), NTATAG_SIP_T4()
+ */
 #define NTATAG_SIP_T2(x) ntatag_sip_t2, tag_uint_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_sip_t2_ref;
 #define NTATAG_SIP_T2_REF(x) ntatag_sip_t2_ref, tag_uint_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_sip_t4;
-/** Transaction lifetime (in milliseconds) @HI */
+/** Transaction lifetime (in milliseconds) @HI 
+ *
+ * Set the lifetime for completed transactions used by the SIP transaction
+ * engine. A completed transaction is kept around for the duration of T4 in
+ * order to catch late responses. The T4 is the maximum duration for the
+ * messages to stay in the network and the duration of SIP timer K.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    unsigned int
+ *
+ * @par Values
+ *    - Value of SIP T4 in milliseconds
+ *
+ * @sa @RFC3261 appendix A, NTATAG_SIP_T1(), NTATAG_SIP_T1X4(), NTATAG_SIP_T2()
+ */
 #define NTATAG_SIP_T4(x)    ntatag_sip_t4, tag_uint_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_sip_t4_ref;
 #define NTATAG_SIP_T4_REF(x) ntatag_sip_t4_ref, tag_uint_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_progress;
-/** Progress timer for User-Agents (interval for retranmitting 1XXs) @HI */
+/** Progress timer for User-Agents (interval for retranmitting 1XXs) @HI.
+ *
+ * The UAS should retransmit preliminary responses to the INVITE
+ * transactions every minute in order to re-set the timer C within the
+ * intermediate proxies.
+ *
+ * The default value for the progress timer is 60000.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    unsigned int
+ *
+ * @par Values
+ *    Value of progress timer in milliseconds.
+ *
+ * @sa @RFC3261 sections 13.3.1.1, 16.7 and 16.8, NTATAG_TIMER_C(),
+ * NTATAG_SIP_T1(), NTATAG_SIP_T1X4(), NTATAG_SIP_T2(), NTATAG_SIP_T4()
+ */
 #define NTATAG_PROGRESS(x)    ntatag_progress, tag_uint_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_progress_ref;
 #define NTATAG_PROGRESS_REF(x) ntatag_progress_ref, tag_uint_vr(&(x))
 
+NTA_DLL extern tag_typedef_t ntatag_timer_c;
+/** Value for timer C in milliseconds. @HI
+ *
+ * By default the INVITE transaction will not timeout after a preliminary
+ * response has been received. However, an intermediate proxy can timeout
+ * the transaction using timer C. Timer C is reset every time a response
+ * belonging to the transaction is received.
+ *
+ * The default value for the timer C is 185000 milliseconds (3 minutes and 5
+ * seconds). By default, timer C is not run on user agents (if NTATAG_UA(1)
+ * without NTATAG_TIMER_C() is fgiven).
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    unsigned int
+ *
+ * @par Values
+ *    Value of SIP timer C in milliseconds. The default value is used
+ *    instead if NTATAG_TIMER_C(0) is given.
+ *
+ * @sa @RFC3261 sections 13.3.1.1, 16.7 and 16.8,
+ * NTATAG_UA(1), NTATAG_TIMER_C(),
+ * NTATAG_SIP_T1(), NTATAG_SIP_T1X4(), NTATAG_SIP_T2(), NTATAG_SIP_T4()
+ */
+#define NTATAG_TIMER_C(x)    ntatag_timer_c, tag_uint_v((x))
+
+NTA_DLL extern tag_typedef_t ntatag_timer_c_ref;
+#define NTATAG_TIMER_C_REF(x) ntatag_timer_c_ref, tag_uint_vr(&(x))
+
 NTA_DLL extern tag_typedef_t ntatag_blacklist;
-/** Add Retry-After header to internally-generated error messages. @HI */
+/** Add Retry-After header to internally-generated error messages. @HI 
+ *
+ * The NTATAG_BLACKLIST() provides a default value for @RetryAfter header
+ * added to the internally generated responses such as <i>503 DNS Error</i>
+ * or <i>408 Timeout</i>. The idea is that the application can retain its
+ * current state and retry the operation after a while.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *     unsigned int
+ *
+ * @par Values
+ *    - Value of @RetryAfter header (in seconds)
+ *
+ * @sa NTATAG_TIMEOUT_408()
+ */
 #define NTATAG_BLACKLIST(x)  ntatag_blacklist, tag_uint_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_blacklist_ref;
@@ -250,38 +557,134 @@
 NTA_DLL extern tag_typedef_t ntatag_debug_drop_prob;
 /** Packet drop probability for debugging. 
  *
- * The packet drop probability parameter is useful mainly in proxies for
- * debugging purposes. The stack drops an incoming message with the given
- * probability. The range is in 0 .. 1000, 500 means p=0.5.
- @HI */
+ * The packet drop probability parameter is useful mainly for debugging
+ * purposes. The stack drops an incoming message received over an unreliable
+ * transport (such as UDP) with the given probability. The range is in 0 .. 
+ * 1000, 500 means p=0.5.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    unsigned integer
+ *
+ * @par Values
+ *    - Valid values are in range 0 ... 1000
+ *    - Probablity to drop a given message is value / 1000.
+ *
+ * @HI
+ */
 #define NTATAG_DEBUG_DROP_PROB(x) ntatag_debug_drop_prob, tag_uint_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_debug_drop_prob_ref;
 #define NTATAG_DEBUG_DROP_PROB_REF(x) ntatag_debug_drop_prob_ref, tag_uint_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_sigcomp_options;
-/** Semicolon-separate SigComp options. @HI */
+/** Semicolon-separated SigComp options.
+ *
+ * @note This tag is has no effect without a SigComp plugin.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *    nta_agent_add_tport() \n
+ *
+ * @par Parameter type
+ *    string 
+ *
+ * @par Values
+ *    - semicolon-separated parameter-value pairs, passed to the SigComp plugin
+ *
+ * @sa NTATAG_COMP(), NTATAG_SIGCOMP_ALGORITHM(), NTATAG_SIGCOMP_AWARE(),
+ * NTATAG_SIGCOMP_CLOSE(), @RFC3320
+ * @HI
+ */
 #define NTATAG_SIGCOMP_OPTIONS(x)    ntatag_sigcomp_options, tag_str_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_sigcomp_options_ref;
 #define NTATAG_SIGCOMP_OPTIONS_REF(x) ntatag_sigcomp_options_ref, tag_str_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_sigcomp_close;
-/** Close SigComp compartment after completing transaction. @HI */
+/** Close SigComp compartment after completing transaction.
+ *
+ * @note This tag is has no effect without a SigComp plugin.
+ *
+ * @par Used with
+ *    nta_incoming_set_params(), nta_incoming_treply()
+ *    nta_outgoing_mcreate(), nta_outgoing_tcreate(),
+ *    nta_outgoing_tmcreate(), nta_outgoing_tcancel()
+ *    nta_outgoing_prack(), nta_msg_tsend(), nta_msg_treply()
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - application takes care of compartment management
+ *    - false - stack manages compartments
+ *
+ * @sa NTATAG_COMP(), TPTAG_COMPARTMENT(),
+ * NTATAG_SIGCOMP_ALGORITHM(), NTATAG_SIGCOMP_AWARE(),
+ * NTATAG_SIGCOMP_OPTIONS(), @RFC3320
+ * @HI
+ */
 #define NTATAG_SIGCOMP_CLOSE(x)  ntatag_sigcomp_close, tag_bool_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_sigcomp_close_ref;
 #define NTATAG_SIGCOMP_CLOSE_REF(x) ntatag_sigcomp_close_ref, tag_bool_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_sigcomp_aware;
-/** Indicate that the application is SigComp-aware. */
+/** Indicate that the application is SigComp-aware. 
+ *
+ * @note This tag is has no effect without a SigComp plugin.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - application takes care of compartment management
+ *    - false - stack manages compartments
+ *
+ * @sa NTATAG_COMP(), NTATAG_SIGCOMP_ALGORITHM(), NTATAG_SIGCOMP_CLOSE(),
+ * NTATAG_SIGCOMP_OPTIONS(), @RFC3320
+ * 
+ * @HI
+ */
 #define NTATAG_SIGCOMP_AWARE(x) ntatag_sigcomp_aware, tag_bool_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_sigcomp_aware_ref;
 #define NTATAG_SIGCOMP_AWARE_REF(x) ntatag_sigcomp_aware_ref, tag_bool_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_sigcomp_algorithm;
-/** Specify SigComp algorithm. For example, NULL, LZSS, or LZSS-POC.
+/** Specify SigComp algorithm.  
+ *
+ * @note This tag is has no effect without a SigComp plugin.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *    nta_agent_add_tport() \n
+ *
+ * @par Parameter type
+ *    string 
+ *
+ * @par Values
+ *    - opaque string passed to the SigComp plugin
+ *
+ * @sa NTATAG_COMP(), NTATAG_SIGCOMP_AWARE(), NTATAG_SIGCOMP_CLOSE(),
+ * NTATAG_SIGCOMP_OPTIONS(), @RFC3320
+ * 
+ * @HI
  */
 #define NTATAG_SIGCOMP_ALGORITHM(x) ntatag_sigcomp_algorithm, tag_str_v((x))
 
@@ -290,49 +693,227 @@
 ntatag_sigcomp_algorithm_ref, tag_str_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_ua;
-/** If true, NTA acts as User Agent Server or Client by default. @HI */
+/** If true, NTA acts as User Agent Server or Client by default.
+ *
+ * When acting as an UA, the NTA stack will
+ * - respond with 481 to a PRACK request with no matching "100rel" response
+ * - check for out-of-order CSeq headers for each #nta_leg_t dialog object
+ * - if NTATAG_MERGE_482(1) is also used, return <i>482 Request Merged</i> to
+ *   a duplicate request with same @CallID, @CSeq, @From tag but different
+ *   topmost @Via header (see @RFC3261 section 8.2.2.2 Merged Requests)
+ * - silently discard duplicate final responses to INVITE
+ * - retransmit preliminary responses (101..199) to INVITE request in regular
+ *   intervals ("timer N2")
+ * - retransmit 2XX response to INVITE request with exponential intervals 
+ * - handle ACK sent in 2XX response to an INVITE using the
+ *   #nta_ack_cancel_f callback bound to #nta_incoming_t with
+ *   nta_incoming_bind()
+ * - not use timer C unless its value has been explicitly set
+ *
+ * @note This NUTAG_UA(1) is set internally by nua_create()
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - act as an UA 
+ *    - false - act as an proxy 
+ *
+ * @sa NTATAG_MERGE_482()
+ */
 #define NTATAG_UA(x) ntatag_ua, tag_bool_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_ua_ref;
 #define NTATAG_UA_REF(x) ntatag_ua_ref, tag_bool_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_stateless;
-/** If true, agent processes incoming requests statelessly by default. @HI */
+/** Enable stateless processing. @HI 
+ *
+ * @par Server side
+ * The incoming requests are processed statefully if there is a default leg
+ * (created with nta_leg_default()). This option is provided for proxies or
+ * other server elements that process requests statelessly.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Values
+ *    - true - do not pass incoming requests to default leg
+ *    - false - pass incoming requests to default leg, if it exists
+ *
+ * @par Client side
+ * The outgoing requests can be sent statelessly, too, if the
+ * NTATAG_STATELESS(1) is included in the tag list of nta_outgoing_tcreate().
+ *
+ * @par Used with
+ *    nta_outgoing_mcreate(), nta_outgoing_tcreate(),
+ *    nta_outgoing_tcancel(), nta_outgoing_prack()
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - create only a transient #nta_outgoing_t transaction object
+ *    - false - create an ordinary client transaction object
+ *
+ * @sa NTATAG_IS_UA(), nta_incoming_default(), nta_outgoing_default(),
+ * nta_leg_default()
+ */
 #define NTATAG_STATELESS(x) ntatag_stateless, tag_bool_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_stateless_ref;
 #define NTATAG_STATELESS_REF(x) ntatag_stateless_ref, tag_bool_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_user_via;
-/** Allow application to insert Via headers. @HI */
+/** Allow application to insert Via headers. @HI 
+ *
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - 
+ *    - false - 
+ *
+ * @sa
+ *
+ */
 #define NTATAG_USER_VIA(x) ntatag_user_via, tag_bool_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_user_via_ref;
 #define NTATAG_USER_VIA_REF(x) ntatag_user_via_ref, tag_bool_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_extra_100;
-/** Respond with "100 Trying" if application has not responded. @HI */
+/** Respond with "100 Trying" if application has not responded.
+ *
+ * As per recommended by @RFC4320, the stack can generate a 100 Trying
+ * response to the non-INVITE requests if the application has not responded
+ * to a request within half of the SIP T2 (the default value for T2 is 4000
+ * milliseconds, so the extra <i>100 Trying<i/> would be sent after 2 seconds).
+ *
+ * @par Used with	
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - send extra 100 Trying if application does not respond
+ *    - false - do not send 100 Trying (default)
+ *
+ * @sa @RFC4320, NTATAG_PASS_408(), NTATAG_TIMEOUT_408()
+ */
 #define NTATAG_EXTRA_100(x)    ntatag_extra_100, tag_bool_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_extra_100_ref;
 #define NTATAG_EXTRA_100_REF(x) ntatag_extra_100_ref, tag_bool_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_pass_100;
-/** Pass "100 Trying" provisional answers to the application. @HI */
+/** Pass "100 Trying" provisional answers to the application. @HI 
+ *
+ * By default, the stack silently processes the <i>100 Trying</i> responses
+ * from the server. Usually the <i>100 Trying</i> responses are not
+ * important to the application but rather sent by the outgoing proxy
+ * immediately after it has received the request. However, the application
+ * can ask nta for them by setting NTATAG_PASS_100(1) if, for instance, the
+ * <i>100 Trying</i> responses are needed for user feedback.
+ *
+ * @par Used with
+ *    nua_create(), nta_agent_create(), nta_agent_set_params() \n
+ *    nta_outgoing_mcreate(), nta_outgoing_tcreate(),
+ *    nta_outgoing_tcancel(), nta_outgoing_prack(), nta_msg_tsend()
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - pass <i>100 Trying</i> to application
+ *    - false - silently process <i>100 Trying</i> responses
+ *
+ * @sa NTATAG_EXTRA_100(), NTATAG_DEFAULT_PROXY()
+ */
 #define NTATAG_PASS_100(x) ntatag_pass_100, tag_bool_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_pass_100_ref;
 #define NTATAG_PASS_100_REF(x) ntatag_pass_100_ref, tag_bool_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_timeout_408;
-/** Generate "408 Request Timeout" response when request times out. @HI */
+/** Generate "408 Request Timeout" response when request times out. @HI 
+ *
+ * This tag is used to prevent stack from generating extra 408 response
+ * messages to non-INVITE requests upon timeout. As per recommended by
+ * @RFC4320, the <i>408 Request Timeout</i> responses to non-INVITE
+ * transaction are not sent over the network to the client by default. The
+ * application can ask stack to pass the 408 responses with
+ * NTATAG_PASS_408(1).
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - generate 408 response
+ *    - false - invoke #nta_response_f callback with NULL sip pointer
+ *              when a non-INVITE transaction times out
+ *
+ * @sa @RFC4320, NTATAG_PASS_408(), NTATAG_EXTRA_100(),
+ */
 #define NTATAG_TIMEOUT_408(x)  ntatag_timeout_408, tag_bool_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_timeout_408_ref;
 #define NTATAG_TIMEOUT_408_REF(x) ntatag_timeout_408_ref, tag_bool_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_pass_408;
-/** Pass "408 Request Timeout" responses to client. @HI */
+/** Pass "408 Request Timeout" responses to the client. @HI 
+ *
+ * As per recommended by @RFC4320, the <i>408 Request Timeout</i> responses
+ * to non-INVITE transaction are not sent over the network to the client by
+ * default. The application can ask stack to pass the 408 responses with
+ * NTATAG_PASS_408(1). 
+ *
+ * Note that unlike NTATAG_PASS_100(), this tags changes the way server side
+ * works.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - pass superfluous 408 responses 
+ *    - false - discard superfluous 408 responses
+ *
+ * @sa @RFC4320, NTATAG_EXTRA_100(), NTATAG_TIMEOUT_408()
+ *
+ */
 #define NTATAG_PASS_408(x)  ntatag_pass_408, tag_bool_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_pass_408_ref;
@@ -346,70 +927,306 @@
 #define NTATAG_NO_DIALOG_REF(x)   ntatag_no_dialog_ref, tag_bool_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_merge_482;
-/** Merge requests, send 482 to other requests. @HI */
+/** Merge requests, send 482 to other requests. @HI 
+ *
+ * If an User-Agent receives a duplicate request with same @CallID, @CSeq,
+ * @From tag but different topmost @Via header (see @RFC3261 section 8.2.2.2
+ * Merged Requests), it should return <i>482 Request Merged</i> response to
+ * the duplicate request. Such a duplicate request has been originally
+ * generated by a forking proxy and usually routed via different route to
+ * the User-Agent. The User-Agent should only respond meaningfully to the
+ * first request and return the 482 response to the following forked
+ * requests.
+ *
+ * Note that also NTATAG_UA(1) should be set before nta detects merges and
+ * responds with 482 to them.
+ *
+ * @note If your application is an multi-lined user-agent, you may consider
+ * disabling request merging. However, you have to somehow handle merging
+ * within a single line.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - detect duplicate requests and respond with 482 to them
+ *    - false - process duplicate requests separately
+ *
+ * @sa NTATAG_UA(1)
+ */
 #define NTATAG_MERGE_482(x)       ntatag_merge_482, tag_bool_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_merge_482_ref;
 #define NTATAG_MERGE_482_REF(x)   ntatag_merge_482_ref, tag_bool_vr(&(x))
 
 NTA_DLL extern tag_typedef_t ntatag_cancel_2543;
-/** Send a CANCEL to an INVITE without an provisional response. @HI */
+/**Follow @RFC2543 semantics with CANCEL.
+ *
+ * By default, the nta follows "@RFC3261" semantics when CANCELing a
+ * request. The CANCEL does not terminate transaction, rather, it is just a
+ * hint to the server that it should respond immediately (with <i>487
+ * Request Terminated</i> if it has no better response). Also, if the
+ * original request was sent over unreliable transport such as UDP, the
+ * CANCEL is delayed until the server has sent a preliminary response to the
+ * original request.
+ *
+ * If NTATAG_CANCEL_2543(1) is given, the transaction is canceled
+ * immediately internally (a 487 response is generated locally) and the
+ * CANCEL request is sent without waiting for an provisional response.
+ *
+ * @par Used with
+ *    nua_create() \n
+ *    nta_agent_create() \n
+ *    nta_agent_set_params() \n
+ *    nta_outgoing_tcancel()
+ *
+ * @par Parameter type
+ *    boolean: true (non-zero or non-NULL pointer)
+ *          or false (zero or NULL pointer)
+ *
+ * @par Values
+ *    - true - follow "RFC 2543" semantics with CANCEL
+ *    - false - follow "RFC 3261" semantics with CANCEL
+ *
+ * @sa NTATAG_CANCEL_408()
+ * 
+ * @HI
+ */
 #define NTATAG_CANCEL_2543(x)     ntatag_cancel_2543, tag_bool_v((x))
 
 NTA_DLL extern tag_typedef_t ntatag_cancel_2543_ref;
 #define NTATAG_CANCEL_2543_REF(x) ntatag_cancel_2543_ref, tag_bool_vr(&(x))
 
 NTA_D