2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 2013, Digium, Inc.
6 * Joshua Colp <jcolp@digium.com>
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
23 #include "asterisk/res_pjsip.h"
24 #include "asterisk/logger.h"
25 #include "asterisk/astobj2.h"
26 #include "asterisk/sorcery.h"
27 #include "include/res_pjsip_private.h"
28 #include "asterisk/res_pjsip_cli.h"
30 /*! \brief Destructor for AOR */
31 static void aor_destroy(void *obj)
33 struct ast_sip_aor *aor = obj;
35 ao2_cleanup(aor->permanent_contacts);
36 ast_string_field_free_memory(aor);
39 /*! \brief Allocator for AOR */
40 static void *aor_alloc(const char *name)
42 struct ast_sip_aor *aor = ast_sorcery_generic_alloc(sizeof(struct ast_sip_aor), aor_destroy);
46 ast_string_field_init(aor, 128);
50 /*! \brief Destructor for contact */
51 static void contact_destroy(void *obj)
53 struct ast_sip_contact *contact = obj;
55 ast_string_field_free_memory(contact);
58 /*! \brief Allocator for contact */
59 static void *contact_alloc(const char *name)
61 struct ast_sip_contact *contact = ast_sorcery_generic_alloc(sizeof(*contact), contact_destroy);
67 if (ast_string_field_init(contact, 256)) {
75 struct ast_sip_aor *ast_sip_location_retrieve_aor(const char *aor_name)
77 return ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "aor", aor_name);
80 /*! \brief Internal callback function which deletes and unlinks any expired contacts */
81 static int contact_expire(void *obj, void *arg, int flags)
83 struct ast_sip_contact *contact = obj;
85 /* If the contact has not yet expired it is valid */
86 if (ast_tvdiff_ms(contact->expiration_time, ast_tvnow()) > 0) {
90 ast_sip_location_delete_contact(contact);
95 /*! \brief Internal callback function which links static contacts into another container */
96 static int contact_link_static(void *obj, void *arg, int flags)
98 struct ao2_container *dest = arg;
104 /*! \brief Simple callback function which returns immediately, used to grab the first contact of an AOR */
105 static int contact_find_first(void *obj, void *arg, int flags)
107 return CMP_MATCH | CMP_STOP;
110 struct ast_sip_contact *ast_sip_location_retrieve_first_aor_contact(const struct ast_sip_aor *aor)
112 RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
113 struct ast_sip_contact *contact;
115 contacts = ast_sip_location_retrieve_aor_contacts(aor);
116 if (!contacts || (ao2_container_count(contacts) == 0)) {
120 contact = ao2_callback(contacts, 0, contact_find_first, NULL);
124 struct ao2_container *ast_sip_location_retrieve_aor_contacts(const struct ast_sip_aor *aor)
126 /* Give enough space for ^ at the beginning and ;@ at the end, since that is our object naming scheme */
127 char regex[strlen(ast_sorcery_object_get_id(aor)) + 4];
128 struct ao2_container *contacts;
130 snprintf(regex, sizeof(regex), "^%s;@", ast_sorcery_object_get_id(aor));
132 if (!(contacts = ast_sorcery_retrieve_by_regex(ast_sip_get_sorcery(), "contact", regex))) {
136 /* Prune any expired contacts and delete them, we do this first because static contacts can never expire */
137 ao2_callback(contacts, OBJ_NODATA | OBJ_MULTIPLE | OBJ_UNLINK, contact_expire, NULL);
139 /* Add any permanent contacts from the AOR */
140 if (aor->permanent_contacts) {
141 ao2_callback(aor->permanent_contacts, OBJ_NODATA, contact_link_static, contacts);
147 struct ast_sip_contact *ast_sip_location_retrieve_contact_from_aor_list(const char *aor_list)
151 struct ast_sip_contact *contact = NULL;
153 /* If the location is still empty we have nowhere to go */
154 if (ast_strlen_zero(aor_list) || !(rest = ast_strdupa(aor_list))) {
155 ast_log(LOG_WARNING, "Unable to determine contacts from empty aor list\n");
159 while ((aor_name = strsep(&rest, ","))) {
160 RAII_VAR(struct ast_sip_aor *, aor, ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
161 RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
166 contact = ast_sip_location_retrieve_first_aor_contact(aor);
167 /* If a valid contact is available use its URI for dialing */
176 struct ast_sip_contact *ast_sip_location_retrieve_contact(const char *contact_name)
178 return ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "contact", contact_name);
181 int ast_sip_location_add_contact(struct ast_sip_aor *aor, const char *uri,
182 struct timeval expiration_time, const char *path_info, const char *user_agent)
184 char name[AST_UUID_STR_LEN];
185 RAII_VAR(struct ast_sip_contact *, contact, NULL, ao2_cleanup);
187 snprintf(name, sizeof(name), "%s;@%s", ast_sorcery_object_get_id(aor), uri);
189 if (!(contact = ast_sorcery_alloc(ast_sip_get_sorcery(), "contact", name))) {
193 ast_string_field_set(contact, uri, uri);
194 contact->expiration_time = expiration_time;
195 contact->qualify_frequency = aor->qualify_frequency;
196 contact->authenticate_qualify = aor->authenticate_qualify;
197 if (path_info && aor->support_path) {
198 ast_string_field_set(contact, path, path_info);
201 if (!ast_strlen_zero(aor->outbound_proxy)) {
202 ast_string_field_set(contact, outbound_proxy, aor->outbound_proxy);
205 if (!ast_strlen_zero(user_agent)) {
206 ast_string_field_set(contact, user_agent, user_agent);
209 return ast_sorcery_create(ast_sip_get_sorcery(), contact);
212 int ast_sip_location_update_contact(struct ast_sip_contact *contact)
214 return ast_sorcery_update(ast_sip_get_sorcery(), contact);
217 int ast_sip_location_delete_contact(struct ast_sip_contact *contact)
219 return ast_sorcery_delete(ast_sip_get_sorcery(), contact);
222 /*! \brief Custom handler for translating from a string timeval to actual structure */
223 static int expiration_str2struct(const struct aco_option *opt, struct ast_variable *var, void *obj)
225 struct ast_sip_contact *contact = obj;
226 return ast_get_timeval(var->value, &contact->expiration_time, ast_tv(0, 0), NULL);
229 /*! \brief Custom handler for translating from an actual structure timeval to string */
230 static int expiration_struct2str(const void *obj, const intptr_t *args, char **buf)
232 const struct ast_sip_contact *contact = obj;
233 return (ast_asprintf(buf, "%lu", contact->expiration_time.tv_sec) < 0) ? -1 : 0;
236 /*! \brief Helper function which validates a permanent contact */
237 static int permanent_contact_validate(void *data)
239 const char *value = data;
241 pj_str_t contact_uri;
242 static const pj_str_t HCONTACT = { "Contact", 7 };
244 pool = pjsip_endpt_create_pool(ast_sip_get_pjsip_endpoint(), "Permanent Contact Validation", 256, 256);
249 pj_strdup2_with_null(pool, &contact_uri, value);
250 if (!pjsip_parse_hdr(pool, &HCONTACT, contact_uri.ptr, contact_uri.slen, NULL)) {
251 pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);
255 pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);
259 /*! \brief Custom handler for permanent URIs */
260 static int permanent_uri_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
262 struct ast_sip_aor *aor = obj;
263 RAII_VAR(struct ast_sip_contact *, contact, NULL, ao2_cleanup);
265 if (ast_sip_push_task_synchronous(NULL, permanent_contact_validate, (char*)var->value)) {
266 ast_log(LOG_ERROR, "Permanent URI on aor '%s' with contact '%s' failed to parse\n",
267 ast_sorcery_object_get_id(aor), var->value);
271 if ((!aor->permanent_contacts && !(aor->permanent_contacts = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 1, NULL, NULL))) ||
272 !(contact = ast_sorcery_alloc(ast_sip_get_sorcery(), "contact", NULL))) {
276 ast_string_field_set(contact, uri, var->value);
277 ao2_link(aor->permanent_contacts, contact);
282 int ast_sip_for_each_aor(const char *aors, ao2_callback_fn on_aor, void *arg)
286 if (!on_aor || ast_strlen_zero(aors)) {
290 copy = ast_strdupa(aors);
291 while ((name = strsep(©, ","))) {
292 RAII_VAR(struct ast_sip_aor *, aor,
293 ast_sip_location_retrieve_aor(name), ao2_cleanup);
299 if (on_aor(aor, arg, 0)) {
307 int ast_sip_for_each_contact(const struct ast_sip_aor *aor,
308 ao2_callback_fn on_contact, void *arg)
310 RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
311 struct ast_sip_contact *contact;
312 struct ao2_iterator i;
315 !(contacts = ast_sip_location_retrieve_aor_contacts(aor))) {
319 i = ao2_iterator_init(contacts, 0);
320 while ((contact = ao2_iterator_next(&i))) {
323 ast_sorcery_object_set_extended(contact, "@aor_id", ast_sorcery_object_get_id(aor));
324 if ((res = on_contact(contact, arg, 0))) {
325 ao2_iterator_destroy(&i);
329 ao2_iterator_destroy(&i);
333 int ast_sip_contact_to_str(void *object, void *arg, int flags)
335 struct ast_sip_contact *contact = object;
336 struct ast_str **buf = arg;
338 ast_str_append(buf, 0, "%s/%s,",
339 ast_sorcery_object_get_extended(contact, "aor_id"), contact->uri);
344 static int sip_aor_to_ami(const struct ast_sip_aor *aor, struct ast_str **buf)
346 return ast_sip_sorcery_object_to_ami(aor, buf);
349 static int format_ami_aor_handler(void *obj, void *arg, int flags)
351 struct ast_sip_aor *aor = obj;
352 struct ast_sip_ami *ami = arg;
353 const struct ast_sip_endpoint *endpoint = ami->arg;
354 RAII_VAR(struct ast_str *, buf,
355 ast_sip_create_ami_event("AorDetail", ami), ast_free);
359 RAII_VAR(struct ao2_container *, contacts,
360 ast_sip_location_retrieve_aor_contacts(aor), ao2_cleanup);
366 sip_aor_to_ami(aor, &buf);
367 ast_str_append(&buf, 0, "Contacts: ");
368 ast_sip_for_each_contact(aor, ast_sip_contact_to_str, &buf);
369 ast_str_truncate(buf, -1);
370 ast_str_append(&buf, 0, "\r\n");
372 total_contacts = ao2_container_count(contacts);
373 num_permanent = aor->permanent_contacts ?
374 ao2_container_count(aor->permanent_contacts) : 0;
376 ast_str_append(&buf, 0, "TotalContacts: %d\r\n", total_contacts);
377 ast_str_append(&buf, 0, "ContactsRegistered: %d\r\n",
378 total_contacts - num_permanent);
379 ast_str_append(&buf, 0, "EndpointName: %s\r\n",
380 ast_sorcery_object_get_id(endpoint));
382 astman_append(ami->s, "%s\r\n", ast_str_buffer(buf));
386 static int format_ami_endpoint_aor(const struct ast_sip_endpoint *endpoint,
387 struct ast_sip_ami *ami)
389 ami->arg = (void *)endpoint;
390 return ast_sip_for_each_aor(endpoint->aors,
391 format_ami_aor_handler, ami);
394 struct ast_sip_endpoint_formatter endpoint_aor_formatter = {
395 .format_ami = format_ami_endpoint_aor
398 static struct ao2_container *cli_get_aor_container(void)
400 RAII_VAR(struct ao2_container *, container, NULL, ao2_cleanup);
401 RAII_VAR(struct ao2_container *, s_container, NULL, ao2_cleanup);
403 container = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(), "aor",
404 AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);
409 s_container = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0,
410 ast_sorcery_object_id_compare, NULL);
415 if (ao2_container_dup(s_container, container, 0)) {
418 ao2_ref(s_container, +1);
422 static int populate_contact_container(void *obj, void *arg, int flags)
424 struct ast_sip_contact *contact = obj;
425 struct ao2_container *container = arg;
427 ao2_link(container, contact);
431 static int gather_aor_contacts(void *obj, void *arg, int flags)
433 struct ast_sip_aor *aor = obj;
434 struct ao2_container *container = arg;
435 ast_sip_for_each_contact(aor, populate_contact_container, container);
439 static int cli_contact_compare(const void *left, const void *right, int flags)
441 const struct ast_sip_contact *left_contact = left;
442 const struct ast_sip_contact *right_contact = right;
445 if (!left_contact || !right_contact) {
448 rc = strcmp(ast_sorcery_object_get_extended(left_contact, "aor_id"),
449 ast_sorcery_object_get_extended(right_contact, "aor_id"));
453 return strcmp(left_contact->uri, right_contact->uri);
456 static struct ao2_container *cli_get_contact_container(void)
458 RAII_VAR(struct ao2_container *, parent_container, NULL, ao2_cleanup);
459 struct ao2_container *child_container;
461 parent_container = cli_get_aor_container();
462 if (!parent_container) {
466 child_container = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0,
467 cli_contact_compare, NULL);
468 if (!child_container) {
472 ao2_ref(child_container, +1);
473 ao2_callback(parent_container, OBJ_NODATA, gather_aor_contacts, child_container);
475 return child_container;
478 static int cli_contact_iterator(const void *container, ao2_callback_fn callback, void *args)
480 const struct ast_sip_aor *array = container;
482 return ast_sip_for_each_contact(array, callback, args);
485 static int cli_print_contact_header(void *obj, void *arg, int flags)
487 struct ast_sip_cli_context *context = arg;
488 int indent = CLI_INDENT_TO_SPACES(context->indent_level);
489 int filler = CLI_LAST_TABSTOP - indent - 18;
491 if (!context->output_buffer) {
494 ast_str_append(&context->output_buffer, 0,
495 "%*s: <Aor/ContactUri%*.*s> <Status....> <RTT(ms)..>\n",
496 indent, "Contact", filler, filler, CLI_HEADER_FILLER);
501 static int cli_print_contact_body(void *obj, void *arg, int flags)
503 struct ast_sip_contact *contact = obj;
504 struct ast_sip_cli_context *context = arg;
505 char *print_name = NULL;
509 const char *aor_id = ast_sorcery_object_get_extended(contact, "aor_id");
511 RAII_VAR(struct ast_sip_contact_status *, status,
512 ast_sorcery_retrieve_by_id( ast_sip_get_sorcery(), CONTACT_STATUS, ast_sorcery_object_get_id(contact)),
515 if (!context->output_buffer) {
519 print_name_len = strlen(aor_id) + strlen(contact->uri) + 2;
520 print_name = ast_alloca(print_name_len);
521 snprintf(print_name, print_name_len, "%s/%s", aor_id, contact->uri);
523 indent = CLI_INDENT_TO_SPACES(context->indent_level);
524 flexwidth = CLI_LAST_TABSTOP - indent - 2;
526 ast_str_append(&context->output_buffer, 0, "%*s: %-*.*s %-12.12s %11.3f\n",
529 flexwidth, flexwidth,
531 (status ? (status->status == AVAILABLE ? "Avail" : "Unavail") : "Unknown"),
532 (status ? ((long long) status->rtt) / 1000.0 : NAN));
537 static int cli_aor_iterator(const void *container, ao2_callback_fn callback, void *args)
539 const char *aor_list = container;
541 return ast_sip_for_each_aor(aor_list, callback, args);
544 static int cli_print_aor_header(void *obj, void *arg, int flags)
546 struct ast_sip_cli_context *context = arg;
547 struct ast_sip_cli_formatter_entry *formatter_entry;
549 int indent = CLI_INDENT_TO_SPACES(context->indent_level);
550 int filler = CLI_LAST_TABSTOP - indent - 7;
552 if (!context->output_buffer) {
555 ast_str_append(&context->output_buffer, 0,
556 "%*s: <Aor%*.*s> <MaxContact>\n",
557 indent, "Aor", filler, filler, CLI_HEADER_FILLER);
559 if (context->recurse) {
560 context->indent_level++;
561 formatter_entry = ast_sip_lookup_cli_formatter("contact");
562 if (formatter_entry && formatter_entry->print_header) {
563 formatter_entry->print_header(NULL, context, 0);
565 context->indent_level--;
570 static int cli_print_aor_body(void *obj, void *arg, int flags)
572 struct ast_sip_aor *aor = obj;
573 struct ast_sip_cli_context *context = arg;
574 struct ast_sip_cli_formatter_entry *formatter_entry;
578 if (!context->output_buffer) {
582 context->current_aor = aor;
584 indent = CLI_INDENT_TO_SPACES(context->indent_level);
585 flexwidth = CLI_LAST_TABSTOP - indent - 12;
587 ast_str_append(&context->output_buffer, 0, "%*s: %-*.*s %12d\n",
590 flexwidth, flexwidth,
591 ast_sorcery_object_get_id(aor), aor->max_contacts);
593 if (context->recurse) {
594 context->indent_level++;
596 formatter_entry = ast_sip_lookup_cli_formatter("contact");
597 if (formatter_entry && formatter_entry->print_body && formatter_entry->iterator) {
598 formatter_entry->iterator(aor, formatter_entry->print_body, context);
601 context->indent_level--;
603 if (context->indent_level == 0) {
604 ast_str_append(&context->output_buffer, 0, "\n");
608 if (context->show_details || (context->show_details_only_level_0 && context->indent_level == 0)) {
609 ast_str_append(&context->output_buffer, 0, "\n");
610 ast_sip_cli_print_sorcery_objectset(aor, context, 0);
616 static struct ast_sip_cli_formatter_entry cli_contact_formatter = {
618 .print_header = cli_print_contact_header,
619 .print_body = cli_print_contact_body,
620 .get_container = cli_get_contact_container,
621 .iterator = cli_contact_iterator,
622 .comparator = cli_contact_compare,
625 static struct ast_sip_cli_formatter_entry cli_aor_formatter = {
627 .print_header = cli_print_aor_header,
628 .print_body = cli_print_aor_body,
629 .get_container = cli_get_aor_container,
630 .iterator = cli_aor_iterator,
631 .comparator = ast_sorcery_object_id_compare,
634 static struct ast_cli_entry cli_commands[] = {
635 AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "List PJSIP Aors",
636 .command = "pjsip list aors",
637 .usage = "Usage: pjsip list aors\n"
638 " List the configured PJSIP Aors\n"),
639 AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "Show PJSIP Aors",
640 .command = "pjsip show aors",
641 .usage = "Usage: pjsip show aors\n"
642 " Show the configured PJSIP Aors\n"),
643 AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "Show PJSIP Aor",
644 .command = "pjsip show aor",
645 .usage = "Usage: pjsip show aor <id>\n"
646 " Show the configured PJSIP Aor\n"),
648 AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "List PJSIP Contacts",
649 .command = "pjsip list contacts",
650 .usage = "Usage: pjsip list contacts\n"
651 " List the configured PJSIP contacts\n"),
654 /*! \brief Initialize sorcery with location support */
655 int ast_sip_initialize_sorcery_location(void)
657 struct ast_sorcery *sorcery = ast_sip_get_sorcery();
658 ast_sorcery_apply_default(sorcery, "contact", "astdb", "registrar");
659 ast_sorcery_apply_default(sorcery, "aor", "config", "pjsip.conf,criteria=type=aor");
661 if (ast_sorcery_object_register(sorcery, "contact", contact_alloc, NULL, NULL) ||
662 ast_sorcery_object_register(sorcery, "aor", aor_alloc, NULL, NULL)) {
666 ast_sorcery_object_field_register(sorcery, "contact", "type", "", OPT_NOOP_T, 0, 0);
667 ast_sorcery_object_field_register(sorcery, "contact", "uri", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, uri));
668 ast_sorcery_object_field_register(sorcery, "contact", "path", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, path));
669 ast_sorcery_object_field_register_custom(sorcery, "contact", "expiration_time", "", expiration_str2struct, expiration_struct2str, 0, 0);
670 ast_sorcery_object_field_register(sorcery, "contact", "qualify_frequency", 0, OPT_UINT_T,
671 PARSE_IN_RANGE, FLDSET(struct ast_sip_contact, qualify_frequency), 0, 86400);
672 ast_sorcery_object_field_register(sorcery, "contact", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, outbound_proxy));
673 ast_sorcery_object_field_register(sorcery, "contact", "user_agent", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, user_agent));
675 ast_sorcery_object_field_register(sorcery, "aor", "type", "", OPT_NOOP_T, 0, 0);
676 ast_sorcery_object_field_register(sorcery, "aor", "minimum_expiration", "60", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, minimum_expiration));
677 ast_sorcery_object_field_register(sorcery, "aor", "maximum_expiration", "7200", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, maximum_expiration));
678 ast_sorcery_object_field_register(sorcery, "aor", "default_expiration", "3600", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, default_expiration));
679 ast_sorcery_object_field_register(sorcery, "aor", "qualify_frequency", 0, OPT_UINT_T, PARSE_IN_RANGE, FLDSET(struct ast_sip_aor, qualify_frequency), 0, 86400);
680 ast_sorcery_object_field_register(sorcery, "aor", "authenticate_qualify", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_aor, authenticate_qualify));
681 ast_sorcery_object_field_register(sorcery, "aor", "max_contacts", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, max_contacts));
682 ast_sorcery_object_field_register(sorcery, "aor", "remove_existing", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_aor, remove_existing));
683 ast_sorcery_object_field_register_custom(sorcery, "aor", "contact", "", permanent_uri_handler, NULL, 0, 0);
684 ast_sorcery_object_field_register(sorcery, "aor", "mailboxes", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_aor, mailboxes));
685 ast_sorcery_object_field_register(sorcery, "aor", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_aor, outbound_proxy));
686 ast_sorcery_object_field_register(sorcery, "aor", "support_path", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_aor, support_path));
688 ast_sip_register_endpoint_formatter(&endpoint_aor_formatter);
689 ast_sip_register_cli_formatter(&cli_contact_formatter);
690 ast_sip_register_cli_formatter(&cli_aor_formatter);
691 ast_cli_register_multiple(cli_commands, ARRAY_LEN(cli_commands));
695 int ast_sip_destroy_sorcery_location(void)
697 ast_cli_unregister_multiple(cli_commands, ARRAY_LEN(cli_commands));
698 ast_sip_unregister_cli_formatter(&cli_contact_formatter);
699 ast_sip_unregister_cli_formatter(&cli_aor_formatter);