Revision
14181
Author
mikej
Date
2009-07-09 19:43:25 -0500 (Thu, 09 Jul 2009)

Log Message

Tue Jul  7 13:46:51 CDT 2009  Pekka Pessi <first.last@nokia.com>
  * nta: added test for sf.net bug #1292657

Modified Paths

Diff

Modified: freeswitch/trunk/libs/sofia-sip/.update (14180 => 14181)


--- freeswitch/trunk/libs/sofia-sip/.update	2009-07-10 00:42:37 UTC (rev 14180)
+++ freeswitch/trunk/libs/sofia-sip/.update	2009-07-10 00:43:25 UTC (rev 14181)
@@ -1 +1 @@
-Thu Jul  9 19:40:57 CDT 2009
+Thu Jul  9 19:41:40 CDT 2009

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta (14180 => 14181)


--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta	2009-07-10 00:42:37 UTC (rev 14180)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta	2009-07-10 00:43:25 UTC (rev 14181)
@@ -69,6 +69,7 @@
 port=$(./portbind $v6flag $((port + 1))) down=$port
 port=$(./portbind $v6flag $((port + 1))) bind=$port
 port=$(./portbind $v6flag $((port + 1))) contact=$port
+port=$(./portbind $v6flag $((port + 1))) sips=$port
 
 # Disable IPv6 resolver for now
 if false && eval $ipv6 ; then
@@ -125,11 +126,11 @@
 	A	127.0.0.1
 
 _sip._udp	SRV 1 100 $contact me
-_sips._tcp	SRV 3 100 $contact me
+_sips._tcp	SRV 3 100 $sips me
 _sip._tcp	SRV 2 100 $contact me
 
 _sip._udp.srv	SRV 1 100 $contact a
-_sips._tcp.srv	SRV 3 100 $contact a
+_sips._tcp.srv	SRV 3 100 $sips a
 _sip._tcp.srv	SRV 2 100 $contact $aaaa
 
 _sip._udp.srv2	SRV 1 200 $contact c
@@ -155,10 +156,15 @@
 nona   NAPTR 20 15 "S" "ZIP+D2U" "" a2
 _sip._udp.nona   SRV 1 10 $contact ip4
 
-; No SIP SRV match
+; First SIP SRV is not found
 nosrv	NAPTR 20 1 "s" "SIP+D2U" "" _sip._udp.nosrv
-        NAPTR 20 2 "s" "SIP+D2U" "" _sip._udp.srv
+	NAPTR 20 2 "s" "SIP+D2T" "" _sip._tcp.nosrv
+        NAPTR 20 3 "s" "SIP+D2U" "" _sip._udp.srv
+	NAPTR 20 4 "s" "SIP+D2T" "" _sip._tcp.srv
 
+; Redirect with TLS
+
+
 ; This fails (and we get 503)
 a2	A	127.0.0.2
 
@@ -198,6 +204,8 @@
     sink=$sink down=$down \
     ipv6=$ipv6 \
     SIPCONTACT="sip:*:$contact;comp=sigcomp" \
+    SIPSCONTACT="sips:*:$sips;comp=sigcomp" \
+    TEST_NTA_CERTDIR=$srcdir/../tport/ \
     $VALGRIND ./test_nta "$@" - $resolvfile
     exit=$?
     kill $(cat $pidfile)

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c (14180 => 14181)


--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	2009-07-10 00:42:37 UTC (rev 14180)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c	2009-07-10 00:43:25 UTC (rev 14181)
@@ -95,7 +95,7 @@
 
 #define NONE ((void *)-1)
 
-int expensive_checks;
+int expensive_checks, test_nta_sips;
 
 #define EXPENSIVE_CHECKS (expensive_checks)
 
@@ -635,6 +635,15 @@
 				  TAG_END());
   TEST_1(ag->ag_agent);
 
+  contact = getenv("SIPSCONTACT");
+  if (contact) {
+    if (nta_agent_add_tport(ag->ag_agent, URL_STRING_MAKE(contact),
+			    TPTAG_CERTIFICATE(getenv("TEST_NTA_CERTDIR")),
+			    TPTAG_TLS_VERIFY_POLICY(TPTLS_VERIFY_NONE),
+			    TAG_END()) == 0)
+      test_nta_sips = 1;
+  }
+
   {
     /* Initialize our headers */
     sip_from_t from[1];
@@ -2123,6 +2132,27 @@
     url->url_params = NULL;
   }
 
+  if (test_nta_sips) {
+    /* Test 1.8 - Send a message to sips:example.org
+     *
+     * Tests sf.net bug #1292657 (SIPS resolving with NAPTR).
+     */
+    client_t ctx[1] = {{ ag, "Test 1.8" }};
+    ag->ag_expect_leg = ag->ag_default_leg;
+    ctx->c_orq =
+      nta_outgoing_tcreate(ag->ag_default_leg, outgoing_callback, ctx,
+			   ag->ag_obp,
+			   SIP_METHOD_MESSAGE,
+			   (url_string_t *)"sips:example.org",
+			   SIPTAG_SUBJECT_STR(ctx->c_name),
+			   SIPTAG_FROM(ag->ag_alice),
+			   SIPTAG_TO(ag->ag_bob),
+			   SIPTAG_CONTACT(ag->ag_m_alice),
+			   TAG_END());
+    TEST_1(!client_run(ctx, 200));
+    TEST_P(ag->ag_latest_leg, ag->ag_default_leg);
+  }
+
   nta_agent_set_params(ag->ag_agent,
 		       NTATAG_SIP_T1(500),
 		       NTATAG_SIP_T1X64(64 * 500),