1 /*
2  * This file is part of the Sofia-SIP package
3  *
4  * Copyright (C) 2005 Nokia Corporation.
5  *
6  * Contact: Pekka Pessi <pekka.pessi@nokia.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation; either version 2.1 of
11  * the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  *
23  */
24 
25 /**@CFILE test_nua_params.c
26  * @brief Test NUA parameter handling.
27  *
28  * @author Pekka Pessi <Pekka.Pessi@nokia.com>
29  * @author Martti Mela <Martti Mela@nokia.com>
30  *
31  * @date Created: Wed Aug 17 12:12:12 EEST 2005 ppessi
32  */
33 
34 #include "config.h"
35 
36 #include "test_nua.h"
37 #include <sofia-sip/su_tag_class.h>
38 
39 #if HAVE_FUNC
40 #elif HAVE_FUNCTION
41 #define __func__ __FUNCTION__
42 #else
43 #define __func__ "test_nua_params"
44 #endif
45 
46 sip_route_t *GLOBAL_ROUTE;
47 
test_tag_filter(void)48 int test_tag_filter(void)
49 {
50   BEGIN();
51 
52 #undef TAG_NAMESPACE
53 #define TAG_NAMESPACE "test"
54   tag_typedef_t tag_a = STRTAG_TYPEDEF(a);
55 #define TAG_A(s)      tag_a, tag_str_v((s))
56   tag_typedef_t tag_b = STRTAG_TYPEDEF(b);
57 #define TAG_B(s)      tag_b, tag_str_v((s))
58 
59   tagi_t filter[2] = {{ NUTAG_ANY() }, { TAG_END() }};
60 
61   tagi_t *lst, *result;
62 
63   lst = tl_list(TAG_A("X"),
64 		TAG_SKIP(2),
65 		NUTAG_URL((void *)"urn:foo"),
66 		TAG_B("Y"),
67 		NUTAG_URL((void *)"urn:bar"),
68 		TAG_NULL());
69 
70   TEST_1(lst);
71 
72   result = tl_afilter(NULL, filter, lst);
73 
74   TEST_1(result);
75   TEST_P(result[0].t_tag, nutag_url);
76   TEST_P(result[1].t_tag, nutag_url);
77 
78   tl_vfree(lst);
79   free(result);
80 
81   END();
82 }
83 
test_nua_params(struct context * ctx)84 int test_nua_params(struct context *ctx)
85 {
86   BEGIN();
87 
88   char const Alice[] = "Alice <sip:a@wonderland.org>";
89   sip_from_t const *from;
90   su_home_t tmphome[SU_HOME_AUTO_SIZE(16384)];
91   nua_handle_t *nh;
92   struct event *e;
93   tagi_t const *t;
94   int n;
95 
96   su_home_auto(tmphome, sizeof(tmphome));
97 
98   if (print_headings)
99     printf("TEST NUA-1.1: PARAMETERS\n");
100 
101 #if SU_HAVE_OSX_CF_API
102   if (ctx->osx_runloop)
103     ctx->root = su_root_osx_runloop_create(NULL);
104   else
105 #endif
106   ctx->root = su_root_create(NULL);
107   TEST_1(ctx->root);
108 
109   su_root_threading(ctx->root, ctx->threading);
110 
111   ctx->a.nua = nua_create(ctx->root, a_callback, ctx,
112 			  SIPTAG_FROM_STR("sip:alice@example.com"),
113 			  NUTAG_URL("sip:0.0.0.0:*;transport=udp"),
114 			  TAG_END());
115 
116   TEST_1(ctx->a.nua);
117 
118   nua_get_params(ctx->a.nua, TAG_ANY(), TAG_END());
119   run_a_until(ctx, nua_r_get_params, save_until_final_response);
120 
121   TEST_1(e = ctx->a.specials->head);
122   TEST_E(e->data->e_event, nua_r_get_params);
123   for (n = 0, t = e->data->e_tags; t; n++, t = tl_next(t))
124     ;
125   TEST_1(n > 32);
126   free_events_in_list(ctx, ctx->a.specials);
127 
128   nh = nua_handle(ctx->a.nua, NULL, TAG_END()); TEST_1(nh);
129   nua_handle_unref(nh);
130 
131   nh = nua_handle(ctx->a.nua, NULL, TAG_END()); TEST_1(nh);
132   nua_handle_destroy(nh);
133 
134   from = sip_from_make(tmphome, Alice);
135 
136   nh = nua_handle(ctx->a.nua, NULL, TAG_END());
137 
138   nua_set_hparams(nh, NUTAG_INVITE_TIMER(90), TAG_END());
139   run_a_until(ctx, nua_r_set_params, until_final_response);
140 
141   /* Modify all pointer values */
142   nua_set_params(ctx->a.nua,
143 		 SIPTAG_FROM_STR(Alice),
144 
145 		 NUTAG_MEDIA_ENABLE(0),
146 		 NUTAG_SOA_NAME("test"),
147 
148 		 NUTAG_REGISTRAR("sip:openlaboratory.net"),
149 
150 		 SIPTAG_SUPPORTED_STR("test"),
151 		 SIPTAG_ALLOW_STR("DWIM, OPTIONS, INFO"),
152 		 NUTAG_APPL_METHOD(NULL),
153 		 NUTAG_APPL_METHOD("INVITE, REGISTER, PUBLISH, SUBSCRIBE"),
154 		 SIPTAG_ALLOW_EVENTS_STR("reg"),
155 		 SIPTAG_USER_AGENT_STR("test_nua/1.0"),
156 
157 		 SIPTAG_ORGANIZATION_STR("Open Laboratory"),
158 
159 		 NUTAG_M_DISPLAY("XXX"),
160 		 NUTAG_M_USERNAME("xxx"),
161 		 NUTAG_M_PARAMS("user=ip"),
162 		 NUTAG_M_FEATURES("language=\"fi\""),
163 		 NUTAG_INSTANCE("urn:uuid:3eb007b1-6d7f-472e-8b64-29e482795da8"),
164 		 NUTAG_OUTBOUND("bar"),
165 
166 		 NUTAG_INITIAL_ROUTE(NULL),
167 		 NUTAG_INITIAL_ROUTE(sip_route_make(tmphome, "<sip:tst@example.net;lr>")),
168 		 NUTAG_INITIAL_ROUTE_STR("<sip:str1@example.net;lr>"),
169 		 NUTAG_INITIAL_ROUTE_STR("sip:str2@example.net;lr=foo"),
170 		 NUTAG_INITIAL_ROUTE_STR(NULL),
171 
172 		 TAG_END());
173 
174   run_a_until(ctx, nua_r_set_params, until_final_response);
175 
176   /* Modify everything from their default value */
177   nua_set_params(ctx->a.nua,
178 		 SIPTAG_FROM(from),
179 		 NUTAG_RETRY_COUNT(9),
180 		 NUTAG_MAX_SUBSCRIPTIONS(6),
181 
182 		 NUTAG_ENABLEINVITE(0),
183 		 NUTAG_AUTOALERT(1),
184 		 NUTAG_EARLY_MEDIA(1),
185 		 NUTAG_AUTOANSWER(1),
186 		 NUTAG_AUTOACK(0),
187 		 NUTAG_INVITE_TIMER(60),
188 
189 		 NUTAG_SESSION_TIMER(600),
190 		 NUTAG_MIN_SE(35),
191 		 NUTAG_SESSION_REFRESHER(nua_remote_refresher),
192 		 NUTAG_UPDATE_REFRESH(1),
193 
194 		 NUTAG_ENABLEMESSAGE(0),
195 		 NUTAG_ENABLEMESSENGER(1),
196 		 /* NUTAG_MESSAGE_AUTOANSWER(0), */
197 
198 		 NUTAG_CALLEE_CAPS(1),
199 		 NUTAG_MEDIA_FEATURES(1),
200 		 NUTAG_SERVICE_ROUTE_ENABLE(0),
201 		 NUTAG_PATH_ENABLE(0),
202 		 NUTAG_AUTH_CACHE(nua_auth_cache_challenged),
203 		 NUTAG_REFER_EXPIRES(333),
204 		 NUTAG_REFER_WITH_ID(0),
205 		 NUTAG_SUBSTATE(nua_substate_pending),
206 		 NUTAG_SUB_EXPIRES(3700),
207 
208 		 NUTAG_KEEPALIVE(66),
209 		 NUTAG_KEEPALIVE_STREAM(33),
210 
211 		 NUTAG_INSTANCE("urn:uuid:97701ad9-39df-1229-1083-dbc0a85f029c"),
212 		 NUTAG_M_DISPLAY("Joe"),
213 		 NUTAG_M_USERNAME("joe"),
214 		 NUTAG_M_PARAMS("user=phone"),
215 		 NUTAG_M_FEATURES("language=\"en\""),
216 		 NUTAG_OUTBOUND("foo"),
217 		 SIPTAG_SUPPORTED(sip_supported_make(tmphome, "foo")),
218 		 NUTAG_SUPPORTED("foo, bar"),
219 		 SIPTAG_SUPPORTED_STR(",baz,"),
220 
221 		 SIPTAG_ALLOW_STR("OPTIONS"),
222 		 SIPTAG_ALLOW(sip_allow_make(tmphome, "INFO")),
223 		 NUTAG_ALLOW("ACK, INFO"),
224 
225 		 NUTAG_APPL_METHOD("NOTIFY"),
226 
227 		 SIPTAG_ALLOW_EVENTS_STR("reg"),
228 		 SIPTAG_ALLOW_EVENTS(sip_allow_events_make(tmphome, "presence")),
229 		 NUTAG_ALLOW_EVENTS("presence.winfo"),
230 
231 		 NUTAG_INITIAL_ROUTE(NULL),
232 		 NUTAG_INITIAL_ROUTE(sip_route_make(nua_handle_home(nh), "<sip:1@example.com;lr>")),
233 		 NUTAG_INITIAL_ROUTE_STR("<sip:2@example.com;lr>"),
234 		 /* Check for sip_route_fix() */
235 		 NUTAG_INITIAL_ROUTE_STR("sip:3@example.com;lr=foo"),
236 		 NUTAG_INITIAL_ROUTE_STR(NULL),
237 
238 		 SIPTAG_USER_AGENT(sip_user_agent_make(tmphome, "test_nua")),
239 
240 		 SIPTAG_ORGANIZATION(sip_organization_make(tmphome, "Pussy Galore's Flying Circus")),
241 
242 		 NUTAG_MEDIA_ENABLE(0),
243 		 NUTAG_REGISTRAR(url_hdup(tmphome, (url_t *)"sip:sip.wonderland.org")),
244 
245 		 TAG_END());
246 
247   run_a_until(ctx, nua_r_set_params, until_final_response);
248 
249   /* Modify something... */
250   nua_set_params(ctx->a.nua,
251 		 NUTAG_RETRY_COUNT(5),
252 		 TAG_END());
253   run_a_until(ctx, nua_r_set_params, until_final_response);
254 
255   {
256     sip_from_t const *from = NONE;
257     char const *from_str = "NONE";
258 
259     unsigned retry_count = (unsigned)-1;
260     unsigned max_subscriptions = (unsigned)-1;
261 
262     char const *soa_name = "NONE";
263     int media_enable = -1;
264     int invite_enable = -1;
265     int auto_alert = -1;
266     int early_media = -1;
267     int only183_100rel = -1;
268     int auto_answer = -1;
269     int auto_ack = -1;
270     unsigned invite_timeout = (unsigned)-1;
271 
272     unsigned session_timer = (unsigned)-1;
273     unsigned min_se = (unsigned)-1;
274     int refresher = -1;
275     int update_refresh = -1;
276 
277     int message_enable = -1;
278     int win_messenger_enable = -1;
279     int message_auto_respond = -1;
280 
281     int callee_caps = -1;
282     int media_features = -1;
283     int service_route_enable = -1;
284     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     int substate = -1;
290 
291     sip_allow_t const *allow = NONE;
292     char const *allow_str = "NONE";
293     char const *appl_method = "NONE";
294     sip_allow_events_t const *allow_events = NONE;
295     char const *allow_events_str = "NONE";
296     sip_supported_t const *supported = NONE;
297     char const *supported_str = "NONE";
298     sip_user_agent_t const *user_agent = NONE;
299     char const *user_agent_str = "NONE";
300     char const *ua_name = "NONE";
301     sip_organization_t const *organization = NONE;
302     char const *organization_str = "NONE";
303 
304     sip_route_t const *initial_route = NONE;
305     char const *initial_route_str = NONE;
306 
307     char const *outbound = "NONE";
308     char const *m_display = "NONE";
309     char const *m_username = "NONE";
310     char const *m_params = "NONE";
311     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     nua_get_params(ctx->a.nua, TAG_ANY(), TAG_END());
318     run_a_until(ctx, nua_r_get_params, save_until_final_response);
319 
320     TEST_1(e = ctx->a.specials->head);
321     TEST_E(e->data->e_event, nua_r_get_params);
322 
323     n = tl_gets(e->data->e_tags,
324 	       	SIPTAG_FROM_REF(from),
325 	       	SIPTAG_FROM_STR_REF(from_str),
326 
327 	       	NUTAG_RETRY_COUNT_REF(retry_count),
328 	       	NUTAG_MAX_SUBSCRIPTIONS_REF(max_subscriptions),
329 
330 		NUTAG_SOA_NAME_REF(soa_name),
331 		NUTAG_MEDIA_ENABLE_REF(media_enable),
332 	       	NUTAG_ENABLEINVITE_REF(invite_enable),
333 	       	NUTAG_AUTOALERT_REF(auto_alert),
334 	       	NUTAG_EARLY_MEDIA_REF(early_media),
335 		NUTAG_ONLY183_100REL_REF(only183_100rel),
336 	       	NUTAG_AUTOANSWER_REF(auto_answer),
337 	       	NUTAG_AUTOACK_REF(auto_ack),
338 	       	NUTAG_INVITE_TIMER_REF(invite_timeout),
339 
340 	       	NUTAG_SESSION_TIMER_REF(session_timer),
341 	       	NUTAG_MIN_SE_REF(min_se),
342 	       	NUTAG_SESSION_REFRESHER_REF(refresher),
343 	       	NUTAG_UPDATE_REFRESH_REF(update_refresh),
344 
345 	       	NUTAG_ENABLEMESSAGE_REF(message_enable),
346 	       	NUTAG_ENABLEMESSENGER_REF(win_messenger_enable),
347 	       	/* NUTAG_MESSAGE_AUTOANSWER(message_auto_respond), */
348 
349 	       	NUTAG_CALLEE_CAPS_REF(callee_caps),
350 	       	NUTAG_MEDIA_FEATURES_REF(media_features),
351 	       	NUTAG_SERVICE_ROUTE_ENABLE_REF(service_route_enable),
352 	       	NUTAG_PATH_ENABLE_REF(path_enable),
353 	       	NUTAG_AUTH_CACHE_REF(auth_cache),
354 	       	NUTAG_REFER_EXPIRES_REF(refer_expires),
355 	       	NUTAG_REFER_WITH_ID_REF(refer_with_id),
356 	       	NUTAG_SUBSTATE_REF(substate),
357 		NUTAG_SUB_EXPIRES_REF(sub_expires),
358 
359 	       	SIPTAG_SUPPORTED_REF(supported),
360 	       	SIPTAG_SUPPORTED_STR_REF(supported_str),
361 	       	SIPTAG_ALLOW_REF(allow),
362 	       	SIPTAG_ALLOW_STR_REF(allow_str),
363 		NUTAG_APPL_METHOD_REF(appl_method),
364 		SIPTAG_ALLOW_EVENTS_REF(allow_events),
365 		SIPTAG_ALLOW_EVENTS_STR_REF(allow_events_str),
366 	       	SIPTAG_USER_AGENT_REF(user_agent),
367 	       	SIPTAG_USER_AGENT_STR_REF(user_agent_str),
368 		NUTAG_USER_AGENT_REF(ua_name),
369 
370 	       	SIPTAG_ORGANIZATION_REF(organization),
371 	       	SIPTAG_ORGANIZATION_STR_REF(organization_str),
372 
373 		NUTAG_INITIAL_ROUTE_REF(initial_route),
374 		NUTAG_INITIAL_ROUTE_STR_REF(initial_route_str),
375 
376 	       	NUTAG_REGISTRAR_REF(registrar),
377 		NUTAG_KEEPALIVE_REF(keepalive),
378 		NUTAG_KEEPALIVE_STREAM_REF(keepalive_stream),
379 
380 		NUTAG_OUTBOUND_REF(outbound),
381 		NUTAG_M_DISPLAY_REF(m_display),
382 		NUTAG_M_USERNAME_REF(m_username),
383 		NUTAG_M_PARAMS_REF(m_params),
384 		NUTAG_M_FEATURES_REF(m_features),
385 		NUTAG_INSTANCE_REF(instance),
386 
387 		TAG_END());
388     TEST(n, 51);
389 
390     TEST_S(sip_header_as_string(tmphome, (void *)from), Alice);
391     TEST_S(from_str, Alice);
392 
393     TEST(retry_count, 5);
394     TEST(max_subscriptions, 6);
395 
396     TEST_S(soa_name, "test");
397     TEST(media_enable, 0);
398     TEST(invite_enable, 0);
399     TEST(auto_alert, 1);
400     TEST(early_media, 1);
401     TEST(auto_answer, 1);
402     TEST(auto_ack, 0);
403     TEST(invite_timeout, 60);
404 
405     TEST(session_timer, 600);
406     TEST(min_se, 35);
407     TEST(refresher, nua_remote_refresher);
408     TEST(update_refresh, 1);
409 
410     TEST(message_enable, 0);
411     TEST(win_messenger_enable, 1);
412     TEST(message_auto_respond, -1); /* XXX */
413 
414     TEST(callee_caps, 1);
415     TEST(media_features, 1);
416     TEST(service_route_enable, 0);
417     TEST(path_enable, 0);
418     TEST(auth_cache, nua_auth_cache_challenged);
419     TEST(refer_expires, 333);
420     TEST(refer_with_id, 0);
421     TEST(substate, nua_substate_pending);
422     TEST(sub_expires, 3700);
423 
424     TEST_S(sip_header_as_string(tmphome, (void *)allow), "OPTIONS, INFO, ACK");
425     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 	   "reg, presence, presence.winfo");
429     TEST_S(allow_events_str, "reg, presence, presence.winfo");
430     TEST_S(sip_header_as_string(tmphome, (void *)supported),
431 	   "foo, bar, baz");
432     TEST_S(supported_str, "foo, bar, baz");
433     TEST_S(sip_header_as_string(tmphome, (void *)user_agent), "test_nua");
434     TEST_S(user_agent_str, "test_nua");
435     TEST_S(sip_header_as_string(tmphome, (void *)organization),
436 	   "Pussy Galore's Flying Circus");
437     TEST_S(organization_str, "Pussy Galore's Flying Circus");
438 
439     TEST_1(initial_route); TEST_1(initial_route != (void *)-1);
440     TEST_S(initial_route->r_url->url_user, "1");
441     TEST_1(url_has_param(initial_route->r_url, "lr"));
442     TEST_1(initial_route->r_next);
443     TEST_S(initial_route->r_next->r_url->url_user, "2");
444     TEST_1(url_has_param(initial_route->r_next->r_url, "lr"));
445     TEST_1(initial_route->r_next->r_next);
446     TEST_S(initial_route->r_next->r_next->r_url->url_user, "3");
447     TEST_1(url_has_param(initial_route->r_next->r_next->r_url, "lr"));
448     TEST_1(!initial_route->r_next->r_next->r_next);
449 
450     TEST_S(url_as_string(tmphome, registrar->us_url),
451 	   "sip:sip.wonderland.org");
452     TEST(keepalive, 66);
453     TEST(keepalive_stream, 33);
454 
455     TEST_S(instance, "urn:uuid:97701ad9-39df-1229-1083-dbc0a85f029c");
456     TEST_S(m_display, "Joe");
457     TEST_S(m_username, "joe");
458     TEST_S(m_params, "user=phone");
459     { char const *expect_m_features = "language=\"en\"";
460     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   /* Test that only those tags that have been set per handle are returned by nua_get_hparams() */
467 
468   {
469     sip_from_t const *from = NONE;
470     char const *from_str = "NONE";
471 
472     unsigned retry_count = (unsigned)-1;
473     unsigned max_subscriptions = (unsigned)-1;
474 
475     int invite_enable = -1;
476     int auto_alert = -1;
477     int early_media = -1;
478     int auto_answer = -1;
479     int auto_ack = -1;
480     unsigned invite_timeout = (unsigned)-1;
481 
482     unsigned session_timer = (unsigned)-1;
483     unsigned min_se = (unsigned)-1;
484     int refresher = -1;
485     int update_refresh = -1;
486 
487     int message_enable = -1;
488     int win_messenger_enable = -1;
489     int message_auto_respond = -1;
490 
491     int callee_caps = -1;
492     int media_features = -1;
493     int service_route_enable = -1;
494     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     sip_allow_t const *allow = NONE;
502     char const   *allow_str = "NONE";
503     sip_supported_t const *supported = NONE;
504     char const *supported_str = "NONE";
505     sip_user_agent_t const *user_agent = NONE;
506     char const *user_agent_str = "NONE";
507     sip_organization_t const *organization = NONE;
508     char const *organization_str = "NONE";
509 
510     sip_route_t *initial_route = NONE;
511     char const *initial_route_str = "NONE";
512 
513     url_string_t const *registrar = NONE;
514 
515     char const *outbound = "NONE";
516     char const *m_display = "NONE";
517     char const *m_username = "NONE";
518     char const *m_params = "NONE";
519     char const *m_features = "NONE";
520     char const *instance = "NONE";
521 
522     int n;
523     struct event *e;
524 
525     nua_get_hparams(nh, TAG_ANY(), TAG_END());
526     run_a_until(ctx, nua_r_get_params, save_until_final_response);
527 
528     TEST_1(e = ctx->a.events->head);
529     TEST_E(e->data->e_event, nua_r_get_params);
530 
531     n = tl_gets(e->data->e_tags,
532 	       	SIPTAG_FROM_REF(from),
533 	       	SIPTAG_FROM_STR_REF(from_str),
534 
535 	       	NUTAG_RETRY_COUNT_REF(retry_count),
536 	       	NUTAG_MAX_SUBSCRIPTIONS_REF(max_subscriptions),
537 
538 	       	NUTAG_ENABLEINVITE_REF(invite_enable),
539 	       	NUTAG_AUTOALERT_REF(auto_alert),
540 	       	NUTAG_EARLY_MEDIA_REF(early_media),
541 	       	NUTAG_AUTOANSWER_REF(auto_answer),
542 	       	NUTAG_AUTOACK_REF(auto_ack),
543 	       	NUTAG_INVITE_TIMER_REF(invite_timeout),
544 
545 	       	NUTAG_SESSION_TIMER_REF(session_timer),
546 	       	NUTAG_MIN_SE_REF(min_se),
547 	       	NUTAG_SESSION_REFRESHER_REF(refresher),
548 	       	NUTAG_UPDATE_REFRESH_REF(update_refresh),
549 
550 	       	NUTAG_ENABLEMESSAGE_REF(message_enable),
551 	       	NUTAG_ENABLEMESSENGER_REF(win_messenger_enable),
552 	       	/* NUTAG_MESSAGE_AUTOANSWER(message_auto_respond), */
553 
554 	       	NUTAG_CALLEE_CAPS_REF(callee_caps),
555 	       	NUTAG_MEDIA_FEATURES_REF(media_features),
556 	       	NUTAG_SERVICE_ROUTE_ENABLE_REF(service_route_enable),
557 	       	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 	       	SIPTAG_SUPPORTED_REF(supported),
563 	       	SIPTAG_SUPPORTED_STR_REF(supported_str),
564 	       	SIPTAG_ALLOW_REF(allow),
565 	       	SIPTAG_ALLOW_STR_REF(allow_str),
566 	       	SIPTAG_USER_AGENT_REF(user_agent),
567 	       	SIPTAG_USER_AGENT_STR_REF(user_agent_str),
568 
569 	       	SIPTAG_ORGANIZATION_REF(organization),
570 	       	SIPTAG_ORGANIZATION_STR_REF(organization_str),
571 
572 		NUTAG_OUTBOUND_REF(outbound),
573 		NUTAG_M_DISPLAY_REF(m_display),
574 		NUTAG_M_USERNAME_REF(m_username),
575 		NUTAG_M_PARAMS_REF(m_params),
576 		NUTAG_M_FEATURES_REF(m_features),
577 		NUTAG_INSTANCE_REF(instance),
578 
579 	       	NUTAG_REGISTRAR_REF(registrar),
580 
581 		TAG_END());
582     TEST(n, 3);
583 
584     TEST(invite_timeout, 90);
585 
586     TEST_1(from != NULL && from != NONE);
587     TEST_1(strcmp(from_str, "NONE"));
588 
589     /* Nothing else should be set */
590     TEST(retry_count, (unsigned)-1);
591     TEST(max_subscriptions, (unsigned)-1);
592 
593     TEST(invite_enable, -1);
594     TEST(auto_alert, -1);
595     TEST(early_media, -1);
596     TEST(auto_answer, -1);
597     TEST(auto_ack, -1);
598 
599     TEST(session_timer, (unsigned)-1);
600     TEST(min_se, (unsigned)-1);
601     TEST(refresher, -1);
602     TEST(update_refresh, -1);
603 
604     TEST(message_enable, -1);
605     TEST(win_messenger_enable, -1);
606     TEST(message_auto_respond, -1); /* XXX */
607 
608     TEST(callee_caps, -1);
609     TEST(media_features, -1);
610     TEST(service_route_enable, -1);
611     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     TEST_S(organization_str, "NONE");
626 
627     TEST_1(initial_route == (void *)-1);
628     TEST_S(initial_route_str, "NONE");
629 
630     TEST_S(outbound, "NONE");
631     TEST_S(m_display, "NONE");
632     TEST_S(m_username, "NONE");
633     TEST_S(m_params, "NONE");
634     TEST_S(m_features, "NONE");
635     TEST_S(instance, "NONE");
636 
637     TEST_P(registrar->us_url, NONE);
638 
639     free_events_in_list(ctx, ctx->a.events);
640   }
641 
642   nua_handle_destroy(nh);
643 
644   nua_shutdown(ctx->a.nua);
645   run_a_until(ctx, nua_r_shutdown, until_final_response);
646   nua_destroy(ctx->a.nua), ctx->a.nua = NULL;
647 
648   su_root_destroy(ctx->root), ctx->root = NULL;
649 
650   su_home_deinit(tmphome);
651 
652   if (print_headings)
653     printf("TEST NUA-1.1: PASSED\n");
654 
655   END();
656 }
657