From aae0726b642414baef2b43313f97e9d7c3d0eb19 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 10 Jul 2009 00:43:25 +0000 Subject: [PATCH] Tue Jul 7 13:46:51 CDT 2009 Pekka Pessi * nta: added test for sf.net bug #1292657 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14181 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/sofia-sip/.update | 2 +- .../libsofia-sip-ua/nta/run_test_nta | 16 +++++++--- libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c | 32 ++++++++++++++++++- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 511c707016..07322f9698 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Thu Jul 9 19:40:57 CDT 2009 +Thu Jul 9 19:41:40 CDT 2009 diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta b/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta index b706953bf4..06329e91ee 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta +++ b/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta @@ -69,6 +69,7 @@ port=$(./portbind $v6flag) sink=$port 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 @@ ns AAAA $me6 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,9 +156,14 @@ na503 NAPTR 20 15 "S" "SIP+D2F" "" a2 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 @@ if test -r $pidfile ; then 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) diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c index d27709a5a7..1d92314645 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/test_nta.c @@ -95,7 +95,7 @@ int tstflags = 0; #define NONE ((void *)-1) -int expensive_checks; +int expensive_checks, test_nta_sips; #define EXPENSIVE_CHECKS (expensive_checks) @@ -635,6 +635,15 @@ int test_init(agent_t *ag, char const *resolv_conf) 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 @@ int test_resolv(agent_t *ag, char const *resolv_conf) 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),