test_nua_params.c 19 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
/*
 * This file is part of the Sofia-SIP package
 *
 * Copyright (C) 2005 Nokia Corporation.
 *
 * Contact: Pekka Pessi <pekka.pessi@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

/**@CFILE test_nua_params.c
 * @brief Test NUA parameter handling.
 *
 * @author Pekka Pessi <Pekka.Pessi@nokia.com>
 * @author Martti Mela <Martti Mela@nokia.com>
 *
 * @date Created: Wed Aug 17 12:12:12 EEST 2005 ppessi
 */

#include "config.h"

#include "test_nua.h"
#include <sofia-sip/su_tag_class.h>

#if HAVE_FUNC
#elif HAVE_FUNCTION
#define __func__ __FUNCTION__
#else
#define __func__ "test_nua_params"
#endif

46 47
sip_route_t *GLOBAL_ROUTE;

48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
int test_tag_filter(void)
{
  BEGIN();

#undef TAG_NAMESPACE
#define TAG_NAMESPACE "test"
  tag_typedef_t tag_a = STRTAG_TYPEDEF(a);
#define TAG_A(s)      tag_a, tag_str_v((s))
  tag_typedef_t tag_b = STRTAG_TYPEDEF(b);
#define TAG_B(s)      tag_b, tag_str_v((s))

  tagi_t filter[2] = {{ NUTAG_ANY() }, { TAG_END() }};

  tagi_t *lst, *result;

  lst = tl_list(TAG_A("X"),
		TAG_SKIP(2),
		NUTAG_URL((void *)"urn:foo"),
		TAG_B("Y"),
		NUTAG_URL((void *)"urn:bar"),
		TAG_NULL());

  TEST_1(lst);

  result = tl_afilter(NULL, filter, lst);

  TEST_1(result);
75 76
  TEST_P(result[0].t_tag, nutag_url);
  TEST_P(result[1].t_tag, nutag_url);
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

  tl_vfree(lst);
  free(result);

  END();
}

int test_nua_params(struct context *ctx)
{
  BEGIN();

  char const Alice[] = "Alice <sip:a@wonderland.org>";
  sip_from_t const *from;
  su_home_t tmphome[SU_HOME_AUTO_SIZE(16384)];
  nua_handle_t *nh;
92 93
  struct event *e;
  tagi_t const *t;
94
  int n;
95 96 97 98 99 100

  su_home_auto(tmphome, sizeof(tmphome));

  if (print_headings)
    printf("TEST NUA-1.1: PARAMETERS\n");

101 102 103 104 105 106 107
#if SU_HAVE_OSX_CF_API
  if (ctx->osx_runloop)
    ctx->root = su_root_osx_runloop_create(NULL);
  else
#endif
  ctx->root = su_root_create(NULL);
  TEST_1(ctx->root);
108 109 110 111 112 113 114 115 116 117

  su_root_threading(ctx->root, ctx->threading);

  ctx->a.nua = nua_create(ctx->root, a_callback, ctx,
			  SIPTAG_FROM_STR("sip:alice@example.com"),
			  NUTAG_URL("sip:0.0.0.0:*;transport=udp"),
			  TAG_END());

  TEST_1(ctx->a.nua);

118 119 120
  nua_get_params(ctx->a.nua, TAG_ANY(), TAG_END());
  run_a_until(ctx, nua_r_get_params, save_until_final_response);

121
  TEST_1(e = ctx->a.specials->head);
122 123 124 125
  TEST_E(e->data->e_event, nua_r_get_params);
  for (n = 0, t = e->data->e_tags; t; n++, t = tl_next(t))
    ;
  TEST_1(n > 32);
126
  free_events_in_list(ctx, ctx->a.specials);
127

128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
  nh = nua_handle(ctx->a.nua, NULL, TAG_END()); TEST_1(nh);
  nua_handle_unref(nh);

  nh = nua_handle(ctx->a.nua, NULL, TAG_END()); TEST_1(nh);
  nua_handle_destroy(nh);

  from = sip_from_make(tmphome, Alice);

  nh = nua_handle(ctx->a.nua, NULL, TAG_END());

  nua_set_hparams(nh, NUTAG_INVITE_TIMER(90), TAG_END());
  run_a_until(ctx, nua_r_set_params, until_final_response);

  /* Modify all pointer values */
  nua_set_params(ctx->a.nua,
		 SIPTAG_FROM_STR(Alice),

145 146 147 148 149
		 NUTAG_MEDIA_ENABLE(0),
		 NUTAG_SOA_NAME("test"),

		 NUTAG_REGISTRAR("sip:openlaboratory.net"),

150 151
		 SIPTAG_SUPPORTED_STR("test"),
		 SIPTAG_ALLOW_STR("DWIM, OPTIONS, INFO"),
152 153
		 NUTAG_APPL_METHOD(NULL),
		 NUTAG_APPL_METHOD("INVITE, REGISTER, PUBLISH, SUBSCRIBE"),
154
		 SIPTAG_ALLOW_EVENTS_STR("reg"),
155 156
		 SIPTAG_USER_AGENT_STR("test_nua/1.0"),

157
		 SIPTAG_ORGANIZATION_STR("Open Laboratory"),
158

159 160 161 162 163 164
		 NUTAG_M_DISPLAY("XXX"),
		 NUTAG_M_USERNAME("xxx"),
		 NUTAG_M_PARAMS("user=ip"),
		 NUTAG_M_FEATURES("language=\"fi\""),
		 NUTAG_INSTANCE("urn:uuid:3eb007b1-6d7f-472e-8b64-29e482795da8"),
		 NUTAG_OUTBOUND("bar"),
165

166 167 168 169 170 171
		 NUTAG_INITIAL_ROUTE(NULL),
		 NUTAG_INITIAL_ROUTE(sip_route_make(tmphome, "<sip:tst@example.net;lr>")),
		 NUTAG_INITIAL_ROUTE_STR("<sip:str1@example.net;lr>"),
		 NUTAG_INITIAL_ROUTE_STR("sip:str2@example.net;lr=foo"),
		 NUTAG_INITIAL_ROUTE_STR(NULL),

172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
		 TAG_END());

  run_a_until(ctx, nua_r_set_params, until_final_response);

  /* Modify everything from their default value */
  nua_set_params(ctx->a.nua,
		 SIPTAG_FROM(from),
		 NUTAG_RETRY_COUNT(9),
		 NUTAG_MAX_SUBSCRIPTIONS(6),

		 NUTAG_ENABLEINVITE(0),
		 NUTAG_AUTOALERT(1),
		 NUTAG_EARLY_MEDIA(1),
		 NUTAG_AUTOANSWER(1),
		 NUTAG_AUTOACK(0),
		 NUTAG_INVITE_TIMER(60),

		 NUTAG_SESSION_TIMER(600),
		 NUTAG_MIN_SE(35),
		 NUTAG_SESSION_REFRESHER(nua_remote_refresher),
		 NUTAG_UPDATE_REFRESH(1),

		 NUTAG_ENABLEMESSAGE(0),
		 NUTAG_ENABLEMESSENGER(1),
		 /* NUTAG_MESSAGE_AUTOANSWER(0), */

		 NUTAG_CALLEE_CAPS(1),
		 NUTAG_MEDIA_FEATURES(1),
		 NUTAG_SERVICE_ROUTE_ENABLE(0),
		 NUTAG_PATH_ENABLE(0),
202
		 NUTAG_AUTH_CACHE(nua_auth_cache_challenged),
203 204
		 NUTAG_REFER_EXPIRES(333),
		 NUTAG_REFER_WITH_ID(0),
205
		 NUTAG_SUBSTATE(nua_substate_pending),
206
		 NUTAG_SUB_EXPIRES(3700),
207 208 209 210 211

		 NUTAG_KEEPALIVE(66),
		 NUTAG_KEEPALIVE_STREAM(33),

		 NUTAG_INSTANCE("urn:uuid:97701ad9-39df-1229-1083-dbc0a85f029c"),
212 213 214 215 216
		 NUTAG_M_DISPLAY("Joe"),
		 NUTAG_M_USERNAME("joe"),
		 NUTAG_M_PARAMS("user=phone"),
		 NUTAG_M_FEATURES("language=\"en\""),
		 NUTAG_OUTBOUND("foo"),
217 218 219
		 SIPTAG_SUPPORTED(sip_supported_make(tmphome, "foo")),
		 NUTAG_SUPPORTED("foo, bar"),
		 SIPTAG_SUPPORTED_STR(",baz,"),
220

221 222 223
		 SIPTAG_ALLOW_STR("OPTIONS"),
		 SIPTAG_ALLOW(sip_allow_make(tmphome, "INFO")),
		 NUTAG_ALLOW("ACK, INFO"),
224

225 226
		 NUTAG_APPL_METHOD("NOTIFY"),

227
		 SIPTAG_ALLOW_EVENTS_STR("reg"),
228
		 SIPTAG_ALLOW_EVENTS(sip_allow_events_make(tmphome, "presence")),
229 230
		 NUTAG_ALLOW_EVENTS("presence.winfo"),

231 232 233 234 235 236
		 NUTAG_INITIAL_ROUTE(NULL),
		 NUTAG_INITIAL_ROUTE(sip_route_make(nua_handle_home(nh), "<sip:1@example.com;lr>")),
		 NUTAG_INITIAL_ROUTE_STR("<sip:2@example.com;lr>"),
		 /* Check for sip_route_fix() */
		 NUTAG_INITIAL_ROUTE_STR("sip:3@example.com;lr=foo"),
		 NUTAG_INITIAL_ROUTE_STR(NULL),
237

238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
		 SIPTAG_USER_AGENT(sip_user_agent_make(tmphome, "test_nua")),

		 SIPTAG_ORGANIZATION(sip_organization_make(tmphome, "Pussy Galore's Flying Circus")),

		 NUTAG_MEDIA_ENABLE(0),
		 NUTAG_REGISTRAR(url_hdup(tmphome, (url_t *)"sip:sip.wonderland.org")),

		 TAG_END());

  run_a_until(ctx, nua_r_set_params, until_final_response);

  /* Modify something... */
  nua_set_params(ctx->a.nua,
		 NUTAG_RETRY_COUNT(5),
		 TAG_END());
  run_a_until(ctx, nua_r_set_params, until_final_response);

  {
    sip_from_t const *from = NONE;
    char const *from_str = "NONE";

259 260
    unsigned retry_count = (unsigned)-1;
    unsigned max_subscriptions = (unsigned)-1;
261

262 263
    char const *soa_name = "NONE";
    int media_enable = -1;
264 265 266
    int invite_enable = -1;
    int auto_alert = -1;
    int early_media = -1;
267
    int only183_100rel = -1;
268 269
    int auto_answer = -1;
    int auto_ack = -1;
270
    unsigned invite_timeout = (unsigned)-1;
271

272 273
    unsigned session_timer = (unsigned)-1;
    unsigned min_se = (unsigned)-1;
274 275 276 277 278 279 280 281 282 283 284
    int refresher = -1;
    int update_refresh = -1;

    int message_enable = -1;
    int win_messenger_enable = -1;
    int message_auto_respond = -1;

    int callee_caps = -1;
    int media_features = -1;
    int service_route_enable = -1;
    int path_enable = -1;
285
    int auth_cache = -1;
286
    unsigned refer_expires = (unsigned)-1;
287
    int refer_with_id = -1;
288
    unsigned sub_expires = (unsigned)-1;
289 290 291 292
    int substate = -1;

    sip_allow_t const *allow = NONE;
    char const *allow_str = "NONE";
293
    char const *appl_method = "NONE";
294 295
    sip_allow_events_t const *allow_events = NONE;
    char const *allow_events_str = "NONE";
296 297 298 299
    sip_supported_t const *supported = NONE;
    char const *supported_str = "NONE";
    sip_user_agent_t const *user_agent = NONE;
    char const *user_agent_str = "NONE";
300
    char const *ua_name = "NONE";
301 302 303
    sip_organization_t const *organization = NONE;
    char const *organization_str = "NONE";

304
    sip_route_t const *initial_route = NONE;
305 306
    char const *initial_route_str = NONE;

307
    char const *outbound = "NONE";
308 309 310 311
    char const *m_display = "NONE";
    char const *m_username = "NONE";
    char const *m_params = "NONE";
    char const *m_features = "NONE";
312
    char const *instance = "NONE";
313

314
    url_string_t const *registrar = NONE;
315
    unsigned keepalive = (unsigned)-1, keepalive_stream = (unsigned)-1;
316 317 318 319

    nua_get_params(ctx->a.nua, TAG_ANY(), TAG_END());
    run_a_until(ctx, nua_r_get_params, save_until_final_response);

320
    TEST_1(e = ctx->a.specials->head);
321 322 323 324 325 326 327 328 329
    TEST_E(e->data->e_event, nua_r_get_params);

    n = tl_gets(e->data->e_tags,
	       	SIPTAG_FROM_REF(from),
	       	SIPTAG_FROM_STR_REF(from_str),

	       	NUTAG_RETRY_COUNT_REF(retry_count),
	       	NUTAG_MAX_SUBSCRIPTIONS_REF(max_subscriptions),

330 331
		NUTAG_SOA_NAME_REF(soa_name),
		NUTAG_MEDIA_ENABLE_REF(media_enable),
332 333 334
	       	NUTAG_ENABLEINVITE_REF(invite_enable),
	       	NUTAG_AUTOALERT_REF(auto_alert),
	       	NUTAG_EARLY_MEDIA_REF(early_media),
335
		NUTAG_ONLY183_100REL_REF(only183_100rel),
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
	       	NUTAG_AUTOANSWER_REF(auto_answer),
	       	NUTAG_AUTOACK_REF(auto_ack),
	       	NUTAG_INVITE_TIMER_REF(invite_timeout),

	       	NUTAG_SESSION_TIMER_REF(session_timer),
	       	NUTAG_MIN_SE_REF(min_se),
	       	NUTAG_SESSION_REFRESHER_REF(refresher),
	       	NUTAG_UPDATE_REFRESH_REF(update_refresh),

	       	NUTAG_ENABLEMESSAGE_REF(message_enable),
	       	NUTAG_ENABLEMESSENGER_REF(win_messenger_enable),
	       	/* NUTAG_MESSAGE_AUTOANSWER(message_auto_respond), */

	       	NUTAG_CALLEE_CAPS_REF(callee_caps),
	       	NUTAG_MEDIA_FEATURES_REF(media_features),
	       	NUTAG_SERVICE_ROUTE_ENABLE_REF(service_route_enable),
	       	NUTAG_PATH_ENABLE_REF(path_enable),
353
	       	NUTAG_AUTH_CACHE_REF(auth_cache),
354 355
	       	NUTAG_REFER_EXPIRES_REF(refer_expires),
	       	NUTAG_REFER_WITH_ID_REF(refer_with_id),
356
	       	NUTAG_SUBSTATE_REF(substate),
357
		NUTAG_SUB_EXPIRES_REF(sub_expires),
358 359 360 361 362

	       	SIPTAG_SUPPORTED_REF(supported),
	       	SIPTAG_SUPPORTED_STR_REF(supported_str),
	       	SIPTAG_ALLOW_REF(allow),
	       	SIPTAG_ALLOW_STR_REF(allow_str),
363
		NUTAG_APPL_METHOD_REF(appl_method),
364 365
		SIPTAG_ALLOW_EVENTS_REF(allow_events),
		SIPTAG_ALLOW_EVENTS_STR_REF(allow_events_str),
366 367
	       	SIPTAG_USER_AGENT_REF(user_agent),
	       	SIPTAG_USER_AGENT_STR_REF(user_agent_str),
368
		NUTAG_USER_AGENT_REF(ua_name),
369 370 371 372

	       	SIPTAG_ORGANIZATION_REF(organization),
	       	SIPTAG_ORGANIZATION_STR_REF(organization_str),

373 374 375
		NUTAG_INITIAL_ROUTE_REF(initial_route),
		NUTAG_INITIAL_ROUTE_STR_REF(initial_route_str),

376 377 378 379
	       	NUTAG_REGISTRAR_REF(registrar),
		NUTAG_KEEPALIVE_REF(keepalive),
		NUTAG_KEEPALIVE_STREAM_REF(keepalive_stream),

380
		NUTAG_OUTBOUND_REF(outbound),
381 382 383 384
		NUTAG_M_DISPLAY_REF(m_display),
		NUTAG_M_USERNAME_REF(m_username),
		NUTAG_M_PARAMS_REF(m_params),
		NUTAG_M_FEATURES_REF(m_features),
385 386 387
		NUTAG_INSTANCE_REF(instance),

		TAG_END());
388
    TEST(n, 51);
389 390 391 392 393 394 395

    TEST_S(sip_header_as_string(tmphome, (void *)from), Alice);
    TEST_S(from_str, Alice);

    TEST(retry_count, 5);
    TEST(max_subscriptions, 6);

396 397
    TEST_S(soa_name, "test");
    TEST(media_enable, 0);
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
    TEST(invite_enable, 0);
    TEST(auto_alert, 1);
    TEST(early_media, 1);
    TEST(auto_answer, 1);
    TEST(auto_ack, 0);
    TEST(invite_timeout, 60);

    TEST(session_timer, 600);
    TEST(min_se, 35);
    TEST(refresher, nua_remote_refresher);
    TEST(update_refresh, 1);

    TEST(message_enable, 0);
    TEST(win_messenger_enable, 1);
    TEST(message_auto_respond, -1); /* XXX */

    TEST(callee_caps, 1);
    TEST(media_features, 1);
    TEST(service_route_enable, 0);
    TEST(path_enable, 0);
418
    TEST(auth_cache, nua_auth_cache_challenged);
419 420
    TEST(refer_expires, 333);
    TEST(refer_with_id, 0);
421
    TEST(substate, nua_substate_pending);
422
    TEST(sub_expires, 3700);
423

424 425
    TEST_S(sip_header_as_string(tmphome, (void *)allow), "OPTIONS, INFO, ACK");
    TEST_S(allow_str, "OPTIONS, INFO, ACK");
426
    TEST_S(appl_method, "INVITE, REGISTER, PUBLISH, SUBSCRIBE, NOTIFY");
427
    TEST_S(sip_header_as_string(tmphome, (void *)allow_events),
428 429
	   "reg, presence, presence.winfo");
    TEST_S(allow_events_str, "reg, presence, presence.winfo");
430
    TEST_S(sip_header_as_string(tmphome, (void *)supported),
431 432
	   "foo, bar, baz");
    TEST_S(supported_str, "foo, bar, baz");
433 434 435 436 437 438
    TEST_S(sip_header_as_string(tmphome, (void *)user_agent), "test_nua");
    TEST_S(user_agent_str, "test_nua");
    TEST_S(sip_header_as_string(tmphome, (void *)organization),
	   "Pussy Galore's Flying Circus");
    TEST_S(organization_str, "Pussy Galore's Flying Circus");

439 440 441 442 443 444 445 446 447 448 449
    TEST_1(initial_route); TEST_1(initial_route != (void *)-1);
    TEST_S(initial_route->r_url->url_user, "1");
    TEST_1(url_has_param(initial_route->r_url, "lr"));
    TEST_1(initial_route->r_next);
    TEST_S(initial_route->r_next->r_url->url_user, "2");
    TEST_1(url_has_param(initial_route->r_next->r_url, "lr"));
    TEST_1(initial_route->r_next->r_next);
    TEST_S(initial_route->r_next->r_next->r_url->url_user, "3");
    TEST_1(url_has_param(initial_route->r_next->r_next->r_url, "lr"));
    TEST_1(!initial_route->r_next->r_next->r_next);

450 451
    TEST_S(url_as_string(tmphome, registrar->us_url),
	   "sip:sip.wonderland.org");
452 453 454 455
    TEST(keepalive, 66);
    TEST(keepalive_stream, 33);

    TEST_S(instance, "urn:uuid:97701ad9-39df-1229-1083-dbc0a85f029c");
456 457 458
    TEST_S(m_display, "Joe");
    TEST_S(m_username, "joe");
    TEST_S(m_params, "user=phone");
Pekka Pessi's avatar
Pekka Pessi committed
459 460
    { char const *expect_m_features = "language=\"en\"";
    TEST_S(m_features, expect_m_features); }
461
    TEST_S(outbound, "foo");
462

463
    free_events_in_list(ctx, ctx->a.specials);
464 465 466 467 468 469 470 471
  }

  /* Test that only those tags that have been set per handle are returned by nua_get_hparams() */

  {
    sip_from_t const *from = NONE;
    char const *from_str = "NONE";

472 473
    unsigned retry_count = (unsigned)-1;
    unsigned max_subscriptions = (unsigned)-1;
474 475 476 477 478 479

    int invite_enable = -1;
    int auto_alert = -1;
    int early_media = -1;
    int auto_answer = -1;
    int auto_ack = -1;
480
    unsigned invite_timeout = (unsigned)-1;
481

482 483
    unsigned session_timer = (unsigned)-1;
    unsigned min_se = (unsigned)-1;
484 485 486 487 488 489 490 491 492 493 494
    int refresher = -1;
    int update_refresh = -1;

    int message_enable = -1;
    int win_messenger_enable = -1;
    int message_auto_respond = -1;

    int callee_caps = -1;
    int media_features = -1;
    int service_route_enable = -1;
    int path_enable = -1;
495
    int auth_cache = -1;
496
    unsigned refer_expires = (unsigned)-1;
497
    int refer_with_id = -1;
498
    int substate = -1;
499
    unsigned sub_expires = (unsigned)-1;
500 501 502 503 504 505 506 507 508 509

    sip_allow_t const *allow = NONE;
    char const   *allow_str = "NONE";
    sip_supported_t const *supported = NONE;
    char const *supported_str = "NONE";
    sip_user_agent_t const *user_agent = NONE;
    char const *user_agent_str = "NONE";
    sip_organization_t const *organization = NONE;
    char const *organization_str = "NONE";

510 511 512
    sip_route_t *initial_route = NONE;
    char const *initial_route_str = "NONE";

513 514
    url_string_t const *registrar = NONE;

515 516 517 518 519 520 521
    char const *outbound = "NONE";
    char const *m_display = "NONE";
    char const *m_username = "NONE";
    char const *m_params = "NONE";
    char const *m_features = "NONE";
    char const *instance = "NONE";

522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557
    int n;
    struct event *e;

    nua_get_hparams(nh, TAG_ANY(), TAG_END());
    run_a_until(ctx, nua_r_get_params, save_until_final_response);

    TEST_1(e = ctx->a.events->head);
    TEST_E(e->data->e_event, nua_r_get_params);

    n = tl_gets(e->data->e_tags,
	       	SIPTAG_FROM_REF(from),
	       	SIPTAG_FROM_STR_REF(from_str),

	       	NUTAG_RETRY_COUNT_REF(retry_count),
	       	NUTAG_MAX_SUBSCRIPTIONS_REF(max_subscriptions),

	       	NUTAG_ENABLEINVITE_REF(invite_enable),
	       	NUTAG_AUTOALERT_REF(auto_alert),
	       	NUTAG_EARLY_MEDIA_REF(early_media),
	       	NUTAG_AUTOANSWER_REF(auto_answer),
	       	NUTAG_AUTOACK_REF(auto_ack),
	       	NUTAG_INVITE_TIMER_REF(invite_timeout),

	       	NUTAG_SESSION_TIMER_REF(session_timer),
	       	NUTAG_MIN_SE_REF(min_se),
	       	NUTAG_SESSION_REFRESHER_REF(refresher),
	       	NUTAG_UPDATE_REFRESH_REF(update_refresh),

	       	NUTAG_ENABLEMESSAGE_REF(message_enable),
	       	NUTAG_ENABLEMESSENGER_REF(win_messenger_enable),
	       	/* NUTAG_MESSAGE_AUTOANSWER(message_auto_respond), */

	       	NUTAG_CALLEE_CAPS_REF(callee_caps),
	       	NUTAG_MEDIA_FEATURES_REF(media_features),
	       	NUTAG_SERVICE_ROUTE_ENABLE_REF(service_route_enable),
	       	NUTAG_PATH_ENABLE_REF(path_enable),
558
		NUTAG_AUTH_CACHE_REF(auth_cache),
559
	       	NUTAG_SUBSTATE_REF(substate),
560
	       	NUTAG_SUB_EXPIRES_REF(sub_expires),
561 562 563 564 565 566 567 568 569 570 571

	       	SIPTAG_SUPPORTED_REF(supported),
	       	SIPTAG_SUPPORTED_STR_REF(supported_str),
	       	SIPTAG_ALLOW_REF(allow),
	       	SIPTAG_ALLOW_STR_REF(allow_str),
	       	SIPTAG_USER_AGENT_REF(user_agent),
	       	SIPTAG_USER_AGENT_STR_REF(user_agent_str),

	       	SIPTAG_ORGANIZATION_REF(organization),
	       	SIPTAG_ORGANIZATION_STR_REF(organization_str),

572 573 574 575 576 577 578
		NUTAG_OUTBOUND_REF(outbound),
		NUTAG_M_DISPLAY_REF(m_display),
		NUTAG_M_USERNAME_REF(m_username),
		NUTAG_M_PARAMS_REF(m_params),
		NUTAG_M_FEATURES_REF(m_features),
		NUTAG_INSTANCE_REF(instance),

579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611
	       	NUTAG_REGISTRAR_REF(registrar),

		TAG_END());
    TEST(n, 3);

    TEST(invite_timeout, 90);

    TEST_1(from != NULL && from != NONE);
    TEST_1(strcmp(from_str, "NONE"));

    /* Nothing else should be set */
    TEST(retry_count, (unsigned)-1);
    TEST(max_subscriptions, (unsigned)-1);

    TEST(invite_enable, -1);
    TEST(auto_alert, -1);
    TEST(early_media, -1);
    TEST(auto_answer, -1);
    TEST(auto_ack, -1);

    TEST(session_timer, (unsigned)-1);
    TEST(min_se, (unsigned)-1);
    TEST(refresher, -1);
    TEST(update_refresh, -1);

    TEST(message_enable, -1);
    TEST(win_messenger_enable, -1);
    TEST(message_auto_respond, -1); /* XXX */

    TEST(callee_caps, -1);
    TEST(media_features, -1);
    TEST(service_route_enable, -1);
    TEST(path_enable, -1);
612
    TEST(auth_cache, -1);
613
    TEST(refer_expires, (unsigned)-1);
614
    TEST(refer_with_id, -1);
615
    TEST(substate, -1);
616
    TEST(sub_expires, (unsigned)-1);
617

618
    TEST_P(allow, NONE);
619
    TEST_S(allow_str, "NONE");
620
    TEST_P(supported, NONE);
621
    TEST_S(supported_str, "NONE");
622
    TEST_P(user_agent, NONE);
623
    TEST_S(user_agent_str, "NONE");
624
    TEST_P(organization, NONE);
625 626
    TEST_S(organization_str, "NONE");

627 628 629
    TEST_1(initial_route == (void *)-1);
    TEST_S(initial_route_str, "NONE");

630 631 632 633 634 635 636
    TEST_S(outbound, "NONE");
    TEST_S(m_display, "NONE");
    TEST_S(m_username, "NONE");
    TEST_S(m_params, "NONE");
    TEST_S(m_features, "NONE");
    TEST_S(instance, "NONE");

637
    TEST_P(registrar->us_url, NONE);
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656

    free_events_in_list(ctx, ctx->a.events);
  }

  nua_handle_destroy(nh);

  nua_shutdown(ctx->a.nua);
  run_a_until(ctx, nua_r_shutdown, until_final_response);
  nua_destroy(ctx->a.nua), ctx->a.nua = NULL;

  su_root_destroy(ctx->root), ctx->root = NULL;

  su_home_deinit(tmphome);

  if (print_headings)
    printf("TEST NUA-1.1: PASSED\n");

  END();
}