2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 2013, Digium, Inc.
6 * Matt Jordan <mjordan@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.
25 #include "asterisk/res_pjsip.h"
26 #include "asterisk/channel.h"
27 #include "asterisk/pbx.h"
28 #include "asterisk/astobj2.h"
29 #include "asterisk/cli.h"
30 #include "asterisk/time.h"
31 #include "include/res_pjsip_private.h"
33 #define DEFAULT_LANGUAGE "en"
34 #define DEFAULT_ENCODING "text/plain"
35 #define QUALIFIED_BUCKETS 211
37 static int qualify_contact(struct ast_sip_contact *contact);
41 * \brief Create a ast_sip_contact_status object.
43 static void *contact_status_alloc(const char *name)
45 struct ast_sip_contact_status *status = ast_sorcery_generic_alloc(sizeof(*status), NULL);
48 ast_log(LOG_ERROR, "Unable to allocate ast_sip_contact_status\n");
52 status->status = UNAVAILABLE;
59 * \brief Retrieve a ast_sip_contact_status object from sorcery creating
62 static struct ast_sip_contact_status *find_or_create_contact_status(const struct ast_sip_contact *contact)
64 struct ast_sip_contact_status *status = ast_sorcery_retrieve_by_id(
65 ast_sip_get_sorcery(), CONTACT_STATUS,
66 ast_sorcery_object_get_id(contact));
72 if (!(status = ast_sorcery_alloc(
73 ast_sip_get_sorcery(), CONTACT_STATUS,
74 ast_sorcery_object_get_id(contact)))) {
76 ast_log(LOG_ERROR, "Unable to create ast_sip_contact_status for contact %s\n",
81 if (ast_sorcery_create(ast_sip_get_sorcery(), status)) {
82 ast_log(LOG_ERROR, "Unable to persist ast_sip_contact_status for contact %s\n",
92 * \brief Update an ast_sip_contact_status's elements.
94 static void update_contact_status(const struct ast_sip_contact *contact,
95 enum ast_sip_contact_status_type value)
97 RAII_VAR(struct ast_sip_contact_status *, status,
98 find_or_create_contact_status(contact), ao2_cleanup);
100 RAII_VAR(struct ast_sip_contact_status *, update, ast_sorcery_alloc(
101 ast_sip_get_sorcery(), CONTACT_STATUS,
102 ast_sorcery_object_get_id(status)), ao2_cleanup);
105 ast_log(LOG_ERROR, "Unable to create update ast_sip_contact_status for contact %s\n",
110 update->status = value;
112 /* if the contact is available calculate the rtt as
113 the diff between the last start time and "now" */
114 update->rtt = update->status ?
115 ast_tvdiff_us(ast_tvnow(), status->rtt_start) : 0;
117 update->rtt_start = ast_tv(0, 0);
119 if (ast_sorcery_update(ast_sip_get_sorcery(), update)) {
120 ast_log(LOG_ERROR, "Unable to update ast_sip_contact_status for contact %s\n",
127 * \brief Initialize the start time on a contact status so the round
128 * trip time can be calculated upon a valid response.
130 static void init_start_time(const struct ast_sip_contact *contact)
132 RAII_VAR(struct ast_sip_contact_status *, status,
133 find_or_create_contact_status(contact), ao2_cleanup);
135 RAII_VAR(struct ast_sip_contact_status *, update, ast_sorcery_alloc(
136 ast_sip_get_sorcery(), CONTACT_STATUS,
137 ast_sorcery_object_get_id(status)), ao2_cleanup);
140 ast_log(LOG_ERROR, "Unable to create update ast_sip_contact_status for contact %s\n",
145 update->rtt_start = ast_tvnow();
147 if (ast_sorcery_update(ast_sip_get_sorcery(), update)) {
148 ast_log(LOG_ERROR, "Unable to update ast_sip_contact_status for contact %s\n",
155 * \brief For an endpoint try to match on a given contact.
157 static int on_endpoint(void *obj, void *arg, int flags)
159 struct ast_sip_endpoint *endpoint = obj;
160 char *aor_name, *aors;
162 if (!arg || ast_strlen_zero(endpoint->aors)) {
166 aors = ast_strdupa(endpoint->aors);
168 while ((aor_name = strsep(&aors, ","))) {
169 RAII_VAR(struct ast_sip_aor *, aor,
170 ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
171 RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
173 if (!aor || !(contacts = ast_sip_location_retrieve_aor_contacts(aor))) {
177 if (ao2_find(contacts, arg, OBJ_NODATA | OBJ_POINTER)) {
187 * \brief Find endpoints associated with the given contact.
189 static struct ao2_container *find_endpoints(struct ast_sip_contact *contact)
191 RAII_VAR(struct ao2_container *, endpoints,
192 ast_sip_get_endpoints(), ao2_cleanup);
194 return ao2_callback(endpoints, OBJ_MULTIPLE, on_endpoint, contact);
199 * \brief Receive an response to the qualify contact request.
201 static void qualify_contact_cb(void *token, pjsip_event *e)
203 RAII_VAR(struct ast_sip_contact *, contact, token, ao2_cleanup);
204 RAII_VAR(struct ao2_container *, endpoints, NULL, ao2_cleanup);
205 RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
207 pjsip_transaction *tsx = e->body.tsx_state.tsx;
208 pjsip_rx_data *challenge = e->body.tsx_state.src.rdata;
209 pjsip_tx_data *tdata;
211 switch(e->body.tsx_state.type) {
212 case PJSIP_EVENT_TRANSPORT_ERROR:
213 case PJSIP_EVENT_TIMER:
214 update_contact_status(contact, UNAVAILABLE);
220 if (!contact->authenticate_qualify || (tsx->status_code != 401 &&
221 tsx->status_code != 407)) {
222 update_contact_status(contact, AVAILABLE);
226 /* try to find endpoints that are associated with the contact */
227 if (!(endpoints = find_endpoints(contact))) {
228 ast_log(LOG_ERROR, "No endpoints found for contact %s, cannot authenticate",
233 /* find "first" endpoint in order to authenticate - actually any
234 endpoint should do that matched on the contact */
235 endpoint = ao2_callback(endpoints, 0, NULL, NULL);
237 if (!ast_sip_create_request_with_auth(&endpoint->outbound_auths,
238 challenge, tsx, &tdata)) {
239 pjsip_endpt_send_request(ast_sip_get_pjsip_endpoint(), tdata,
246 * \brief Attempt to qualify the contact
248 * \detail Sends a SIP OPTIONS request to the given contact in order to make
249 * sure that contact is available.
251 static int qualify_contact(struct ast_sip_contact *contact)
253 pjsip_tx_data *tdata;
255 if (ast_sip_create_request("OPTIONS", NULL, NULL, contact->uri, &tdata)) {
256 ast_log(LOG_ERROR, "Unable to create request to qualify contact %s\n",
261 init_start_time(contact);
263 ao2_ref(contact, +1);
264 if (pjsip_endpt_send_request(ast_sip_get_pjsip_endpoint(),
265 tdata, -1, contact, qualify_contact_cb) != PJ_SUCCESS) {
266 /* The callback will be called so we don't need to drop the contact ref*/
267 ast_log(LOG_ERROR, "Unable to send request to qualify contact %s\n",
277 * \brief Scheduling context for sending QUALIFY request at specified intervals.
279 static struct ast_sched_context *sched;
283 * \brief Container to hold all actively scheduled qualifies.
285 static struct ao2_container *sched_qualifies;
289 * \brief Structure to hold qualify contact scheduling information.
292 /*! The scheduling id */
294 /*! The the contact being checked */
295 struct ast_sip_contact *contact;
300 * \brief Destroy the scheduled data and remove from scheduler.
302 static void sched_data_destructor(void *obj)
304 struct sched_data *data = obj;
305 ao2_cleanup(data->contact);
309 * \brief Create the scheduling data object.
311 static struct sched_data *sched_data_create(struct ast_sip_contact *contact)
313 struct sched_data *data = ao2_alloc(sizeof(*data), sched_data_destructor);
316 ast_log(LOG_ERROR, "Unable to create schedule qualify data\n");
320 data->contact = contact;
321 ao2_ref(data->contact, +1);
328 * \brief Send a qualify contact request within a threaded task.
330 static int qualify_contact_task(void *obj)
332 RAII_VAR(struct ast_sip_contact *, contact, obj, ao2_cleanup);
333 return qualify_contact(contact);
338 * \brief Send a scheduled qualify contact request.
340 static int qualify_contact_sched(const void *obj)
342 struct sched_data *data = (struct sched_data *)obj;
344 ao2_ref(data->contact, +1);
345 if (ast_sip_push_task(NULL, qualify_contact_task, data->contact)) {
346 ao2_ref(data->contact, -1);
351 return data->contact->qualify_frequency * 1000;
356 * \brief Set up a scheduled qualify contact check.
358 static void schedule_qualify(struct ast_sip_contact *contact)
360 RAII_VAR(struct sched_data *, data, sched_data_create(contact), ao2_cleanup);
367 if ((data->id = ast_sched_add_variable(
368 sched, contact->qualify_frequency * 1000,
369 qualify_contact_sched, data, 1)) < 0) {
372 ast_log(LOG_ERROR, "Unable to schedule qualify for contact %s\n",
377 ao2_link(sched_qualifies, data);
382 * \brief Remove the contact from the scheduler.
384 static void unschedule_qualify(struct ast_sip_contact *contact)
386 RAII_VAR(struct sched_data *, data, ao2_find(
387 sched_qualifies, contact, OBJ_UNLINK), ao2_cleanup);
393 AST_SCHED_DEL_UNREF(sched, data->id, ao2_cleanup(data));
398 * \brief Qualify the given contact and set up scheduling if configured.
400 static void qualify_and_schedule(struct ast_sip_contact *contact)
402 unschedule_qualify(contact);
404 if (contact->qualify_frequency) {
405 ao2_ref(contact, +1);
406 ast_sip_push_task(NULL, qualify_contact_task, contact);
408 schedule_qualify(contact);
414 * \brief A new contact has been created make sure it is available.
416 static void contact_created(const void *obj)
418 qualify_and_schedule((struct ast_sip_contact *)obj);
423 * \brief A contact has been deleted remove status tracking.
425 static void contact_deleted(const void *obj)
427 struct ast_sip_contact *contact = (struct ast_sip_contact *)obj;
428 RAII_VAR(struct ast_sip_contact_status *, status, NULL, ao2_cleanup);
430 unschedule_qualify(contact);
432 if (!(status = ast_sorcery_retrieve_by_id(
433 ast_sip_get_sorcery(), CONTACT_STATUS,
434 ast_sorcery_object_get_id(contact)))) {
438 if (ast_sorcery_delete(ast_sip_get_sorcery(), status)) {
439 ast_log(LOG_ERROR, "Unable to delete ast_sip_contact_status for contact %s\n",
444 struct ast_sorcery_observer contact_observer = {
445 .created = contact_created,
446 .deleted = contact_deleted
449 static pj_bool_t options_start(void)
451 if (!(sched = ast_sched_context_create()) ||
452 ast_sched_start_thread(sched)) {
459 static pj_bool_t options_stop(void)
461 ast_sorcery_observer_remove(ast_sip_get_sorcery(), "contact", &contact_observer);
463 ao2_t_ref(sched_qualifies, -1, "Remove scheduled qualifies on module stop");
466 ast_sched_context_destroy(sched);
472 static pj_status_t send_options_response(pjsip_rx_data *rdata, int code)
474 pjsip_endpoint *endpt = ast_sip_get_pjsip_endpoint();
475 pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata);
476 pjsip_transaction *trans = pjsip_rdata_get_tsx(rdata);
477 pjsip_tx_data *tdata;
478 const pjsip_hdr *hdr;
479 pjsip_response_addr res_addr;
482 /* Make the response object */
483 if ((status = pjsip_endpt_create_response(
484 endpt, rdata, code, NULL, &tdata) != PJ_SUCCESS)) {
485 ast_log(LOG_ERROR, "Unable to create response (%d)\n", status);
489 /* Add appropriate headers */
490 if ((hdr = pjsip_endpt_get_capability(endpt, PJSIP_H_ACCEPT, NULL))) {
491 pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, hdr));
493 if ((hdr = pjsip_endpt_get_capability(endpt, PJSIP_H_ALLOW, NULL))) {
494 pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, hdr));
496 if ((hdr = pjsip_endpt_get_capability(endpt, PJSIP_H_SUPPORTED, NULL))) {
497 pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, hdr));
501 * XXX TODO: pjsip doesn't care a lot about either of these headers -
502 * while it provides specific methods to create them, they are defined
503 * to be the standard string header creation. We never did add them
504 * in chan_sip, although RFC 3261 says they SHOULD. Hard coded here.
506 ast_sip_add_header(tdata, "Accept-Encoding", DEFAULT_ENCODING);
507 ast_sip_add_header(tdata, "Accept-Language", DEFAULT_LANGUAGE);
510 status = pjsip_dlg_send_response(dlg, trans, tdata);
512 /* Get where to send request. */
513 if ((status = pjsip_get_response_addr(
514 tdata->pool, rdata, &res_addr)) != PJ_SUCCESS) {
515 ast_log(LOG_ERROR, "Unable to get response address (%d)\n",
518 pjsip_tx_data_dec_ref(tdata);
521 status = pjsip_endpt_send_response(endpt, &res_addr, tdata,
525 if (status != PJ_SUCCESS) {
526 ast_log(LOG_ERROR, "Unable to send response (%d)\n", status);
532 static pj_bool_t options_on_rx_request(pjsip_rx_data *rdata)
534 RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
536 pjsip_sip_uri *sip_ruri;
537 char exten[AST_MAX_EXTENSION];
539 if (pjsip_method_cmp(&rdata->msg_info.msg->line.req.method,
540 &pjsip_options_method)) {
544 if (!(endpoint = ast_pjsip_rdata_get_endpoint(rdata))) {
548 ruri = rdata->msg_info.msg->line.req.uri;
549 if (!PJSIP_URI_SCHEME_IS_SIP(ruri) && !PJSIP_URI_SCHEME_IS_SIPS(ruri)) {
550 send_options_response(rdata, 416);
554 sip_ruri = pjsip_uri_get_uri(ruri);
555 ast_copy_pj_str(exten, &sip_ruri->user, sizeof(exten));
557 if (ast_shutting_down()) {
558 send_options_response(rdata, 503);
559 } else if (!ast_exists_extension(NULL, endpoint->context, exten, 1, NULL)) {
560 send_options_response(rdata, 404);
562 send_options_response(rdata, 200);
567 static pjsip_module options_module = {
568 .name = {"Options Module", 14},
570 .priority = PJSIP_MOD_PRIORITY_APPLICATION,
571 .start = options_start,
572 .stop = options_stop,
573 .on_rx_request = options_on_rx_request,
578 * \brief Send qualify request to the given contact.
580 static int cli_on_contact(void *obj, void *arg, int flags)
582 struct ast_sip_contact *contact = obj;
584 ast_cli(*cli_fd, " contact %s\n", contact->uri);
585 qualify_contact(contact);
590 * \brief Data pushed to threadpool to qualify endpoints from the CLI
592 struct qualify_data {
593 /*! Endpoint that is being qualified */
594 struct ast_sip_endpoint *endpoint;
595 /*! CLI File descriptor for printing messages */
599 static struct qualify_data *qualify_data_alloc(struct ast_sip_endpoint *endpoint, int cli_fd)
601 struct qualify_data *qual_data;
603 qual_data = ast_malloc(sizeof(*qual_data));
608 qual_data->endpoint = ao2_bump(endpoint);
609 qual_data->cli_fd = cli_fd;
613 static void qualify_data_destroy(struct qualify_data *qual_data)
615 ao2_cleanup(qual_data->endpoint);
621 * \brief For an endpoint iterate over and qualify all aors/contacts
623 static int cli_qualify_contacts(void *data)
625 char *aor_name, *aors;
626 RAII_VAR(struct qualify_data *, qual_data, data, qualify_data_destroy);
627 struct ast_sip_endpoint *endpoint = qual_data->endpoint;
628 int cli_fd = qual_data->cli_fd;
629 const char *endpoint_name = ast_sorcery_object_get_id(endpoint);
631 if (ast_strlen_zero(endpoint->aors)) {
632 ast_cli(cli_fd, "Endpoint %s has no AoR's configured\n",
637 aors = ast_strdupa(endpoint->aors);
639 while ((aor_name = strsep(&aors, ","))) {
640 RAII_VAR(struct ast_sip_aor *, aor,
641 ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
642 RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
644 if (!aor || !(contacts = ast_sip_location_retrieve_aor_contacts(aor))) {
648 ast_cli(cli_fd, "Sending qualify to endpoint %s\n", endpoint_name);
649 ao2_callback(contacts, OBJ_NODATA, cli_on_contact, &cli_fd);
654 static char *cli_qualify(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
656 RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
657 const char *endpoint_name;
658 struct qualify_data *qual_data;
662 e->command = "pjsip qualify";
664 "Usage: pjsip qualify <endpoint>\n"
665 " Send a SIP OPTIONS request to all contacts on the endpoint.\n";
672 return CLI_SHOWUSAGE;
675 endpoint_name = a->argv[2];
677 if (!(endpoint = ast_sorcery_retrieve_by_id(
678 ast_sip_get_sorcery(), "endpoint", endpoint_name))) {
679 ast_cli(a->fd, "Unable to retrieve endpoint %s\n", endpoint_name);
683 qual_data = qualify_data_alloc(endpoint, a->fd);
688 if (ast_sip_push_task(NULL, cli_qualify_contacts, qual_data)) {
689 qualify_data_destroy(qual_data);
698 * \brief Send qualify request to the given contact.
700 static int ami_contact_cb(void *obj, void *arg, int flags)
702 struct ast_sip_contact *contact = obj;
703 ao2_ref(contact, +1);
704 if (ast_sip_push_task(NULL, qualify_contact_task, contact)) {
705 ao2_cleanup(contact);
710 static int ami_sip_qualify(struct mansession *s, const struct message *m)
712 const char *endpoint_name = astman_get_header(m, "Endpoint");
713 RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
714 char *aor_name, *aors;
716 if (ast_strlen_zero(endpoint_name)) {
717 astman_send_error(s, m, "Endpoint parameter missing.");
721 endpoint = ast_sorcery_retrieve_by_id(
722 ast_sip_get_sorcery(),
726 astman_send_error(s, m, "Unable to retrieve endpoint\n");
730 /* send a qualify for all contacts registered with the endpoint */
731 if (ast_strlen_zero(endpoint->aors)) {
732 astman_send_error(s, m, "No AoRs configured for endpoint\n");
736 aors = ast_strdupa(endpoint->aors);
738 while ((aor_name = strsep(&aors, ","))) {
739 RAII_VAR(struct ast_sip_aor *, aor,
740 ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
741 RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
743 if (!aor || !(contacts = ast_sip_location_retrieve_aor_contacts(aor))) {
747 ao2_callback(contacts, OBJ_NODATA, ami_contact_cb, NULL);
750 astman_send_ack(s, m, "Endpoint found, will qualify");
754 static struct ast_cli_entry cli_options[] = {
755 AST_CLI_DEFINE(cli_qualify, "Send an OPTIONS request to a PJSIP endpoint")
758 static int sched_qualifies_hash_fn(const void *obj, int flags)
760 const struct sched_data *data = obj;
762 return ast_str_hash(ast_sorcery_object_get_id(data->contact));
765 static int sched_qualifies_cmp_fn(void *obj, void *arg, int flags)
767 struct sched_data *data = obj;
769 return !strcmp(ast_sorcery_object_get_id(data->contact),
770 ast_sorcery_object_get_id(arg));
773 int ast_sip_initialize_sorcery_qualify(struct ast_sorcery *sorcery)
775 /* initialize sorcery ast_sip_contact_status resource */
776 ast_sorcery_apply_default(sorcery, CONTACT_STATUS, "memory", NULL);
778 if (ast_sorcery_internal_object_register(sorcery, CONTACT_STATUS,
779 contact_status_alloc, NULL, NULL)) {
780 ast_log(LOG_ERROR, "Unable to register ast_sip_contact_status in sorcery\n");
784 ast_sorcery_object_field_register_nodoc(sorcery, CONTACT_STATUS, "rtt", "0", OPT_UINT_T,
785 1, FLDSET(struct ast_sip_contact_status, status));
786 ast_sorcery_object_field_register_nodoc(sorcery, CONTACT_STATUS, "rtt", "0", OPT_UINT_T,
787 1, FLDSET(struct ast_sip_contact_status, rtt));
792 static int qualify_and_schedule_cb(void *obj, void *arg, int flags)
794 struct ast_sip_contact *contact = obj;
795 struct ast_sip_aor *aor = arg;
797 contact->qualify_frequency = aor->qualify_frequency;
798 qualify_and_schedule(contact);
805 * \brief Qualify and schedule an endpoint's permanent contacts
807 * \detail For the given endpoint retrieve its list of aors, qualify all
808 * permanent contacts, and schedule for checks if configured.
810 static int qualify_and_schedule_permanent_cb(void *obj, void *arg, int flags)
812 struct ast_sip_endpoint *endpoint = obj;
813 char *aor_name, *aors;
815 if (ast_strlen_zero(endpoint->aors)) {
819 aors = ast_strdupa(endpoint->aors);
821 while ((aor_name = strsep(&aors, ","))) {
822 RAII_VAR(struct ast_sip_aor *, aor,
823 ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
825 if (!aor || !aor->permanent_contacts) {
828 ao2_callback(aor->permanent_contacts, OBJ_NODATA, qualify_and_schedule_cb, aor);
834 static void qualify_and_schedule_permanent(void)
836 RAII_VAR(struct ao2_container *, endpoints,
837 ast_sip_get_endpoints(), ao2_cleanup);
839 ao2_callback(endpoints, OBJ_NODATA,
840 qualify_and_schedule_permanent_cb, NULL);
843 int ast_res_pjsip_init_options_handling(int reload)
845 const pj_str_t STR_OPTIONS = { "OPTIONS", 7 };
847 if (sched_qualifies) {
848 ao2_t_ref(sched_qualifies, -1, "Remove old scheduled qualifies");
851 if (!(sched_qualifies = ao2_t_container_alloc(
852 QUALIFIED_BUCKETS, sched_qualifies_hash_fn, sched_qualifies_cmp_fn,
853 "Create container for scheduled qualifies"))) {
859 qualify_and_schedule_permanent();
863 if (pjsip_endpt_register_module(ast_sip_get_pjsip_endpoint(), &options_module) != PJ_SUCCESS) {
868 if (pjsip_endpt_add_capability(ast_sip_get_pjsip_endpoint(), NULL, PJSIP_H_ALLOW, NULL, 1, &STR_OPTIONS) != PJ_SUCCESS) {
869 pjsip_endpt_unregister_module(ast_sip_get_pjsip_endpoint(), &options_module);
873 if (ast_sorcery_observer_add(ast_sip_get_sorcery(), "contact", &contact_observer)) {
874 ast_log(LOG_WARNING, "Unable to add contact observer\n");
878 qualify_and_schedule_permanent();
879 ast_cli_register_multiple(cli_options, ARRAY_LEN(cli_options));
880 ast_manager_register2("PJSIPQualify", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, ami_sip_qualify, NULL, NULL, NULL);
885 void ast_res_pjsip_cleanup_options_handling(void)
887 ast_cli_unregister_multiple(cli_options, ARRAY_LEN(cli_options));
888 ast_manager_unregister("PJSIPQualify");