Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
#include "asterisk.h"
#include <pjsip.h>
#include <pjlib.h>
#include "asterisk/res_pjsip.h"
#include "asterisk/logger.h"
#include "asterisk/astobj2.h"
#include "asterisk/paths.h"
#include "asterisk/sorcery.h"
#include "asterisk/taskprocessor.h"
#include "include/res_pjsip_private.h"
#include "asterisk/res_pjsip_cli.h"
#include "asterisk/statsd.h"
#include "asterisk/named_locks.h"
#include "asterisk/res_pjproject.h"
Go to the source code of this file.
Functions | |
static int | ami_show_aors (struct mansession *s, const struct message *m) |
static void * | aor_alloc (const char *name) |
Allocator for AOR. More... | |
static int | aor_apply_handler (const struct ast_sorcery *sorcery, void *object) |
static int | aor_apply_outbound_proxy (void *obj, void *arg, int flags) |
static void | aor_deleted_observer (const void *object) |
static void | aor_destroy (void *obj) |
Destructor for AOR. More... | |
int | ast_sip_contact_to_str (void *object, void *arg, int flags) |
Handler used to convert a contact to a string. More... | |
int | ast_sip_destroy_sorcery_location (void) |
int | ast_sip_for_each_aor (const char *aors, ao2_callback_fn on_aor, void *arg) |
For every aor in the comma separated aors string call the given 'on_aor' handler. More... | |
int | ast_sip_for_each_contact (const struct ast_sip_aor *aor, ao2_callback_fn on_contact, void *arg) |
For every contact on an AOR call the given 'on_contact' handler. More... | |
int | ast_sip_initialize_sorcery_location (void) |
Initialize sorcery with location support. More... | |
int | ast_sip_location_add_contact (struct ast_sip_aor *aor, const char *uri, struct timeval expiration_time, const char *path_info, const char *user_agent, const char *via_addr, int via_port, const char *call_id, struct ast_sip_endpoint *endpoint) |
Add a new contact to an AOR. More... | |
int | ast_sip_location_add_contact_nolock (struct ast_sip_aor *aor, const char *uri, struct timeval expiration_time, const char *path_info, const char *user_agent, const char *via_addr, int via_port, const char *call_id, struct ast_sip_endpoint *endpoint) |
Add a new contact to an AOR without locking the AOR. More... | |
struct ast_sip_contact * | ast_sip_location_create_contact (struct ast_sip_aor *aor, const char *uri, struct timeval expiration_time, const char *path_info, const char *user_agent, const char *via_addr, int via_port, const char *call_id, int prune_on_boot, struct ast_sip_endpoint *endpoint) |
Create a new contact for an AOR without locking the AOR. More... | |
int | ast_sip_location_delete_contact (struct ast_sip_contact *contact) |
Delete a contact. More... | |
void | ast_sip_location_prune_boot_contacts (void) |
Prune the prune_on_boot contacts. More... | |
struct ast_sip_aor * | ast_sip_location_retrieve_aor (const char *aor_name) |
Retrieve a named AOR. More... | |
struct ao2_container * | ast_sip_location_retrieve_aor_contacts (const struct ast_sip_aor *aor) |
Retrieve all contacts currently available for an AOR. More... | |
struct ao2_container * | ast_sip_location_retrieve_aor_contacts_filtered (const struct ast_sip_aor *aor, unsigned int flags) |
Retrieve all contacts currently available for an AOR and filter based on flags. More... | |
struct ao2_container * | ast_sip_location_retrieve_aor_contacts_nolock (const struct ast_sip_aor *aor) |
Retrieve all contacts currently available for an AOR without locking the AOR. More... | |
struct ao2_container * | ast_sip_location_retrieve_aor_contacts_nolock_filtered (const struct ast_sip_aor *aor, unsigned int flags) |
Retrieve all contacts currently available for an AOR without locking the AOR and filter based on flags. More... | |
struct ast_sip_contact * | ast_sip_location_retrieve_contact (const char *contact_name) |
Retrieve a named contact. More... | |
void | ast_sip_location_retrieve_contact_and_aor_from_list (const char *aor_list, struct ast_sip_aor **aor, struct ast_sip_contact **contact) |
Retrieve the first bound contact AND the AOR chosen from a list of AORs. More... | |
void | ast_sip_location_retrieve_contact_and_aor_from_list_filtered (const char *aor_list, unsigned int flags, struct ast_sip_aor **aor, struct ast_sip_contact **contact) |
Retrieve the first bound contact AND the AOR chosen from a list of AORs and filter based on flags. More... | |
struct ast_sip_contact * | ast_sip_location_retrieve_contact_from_aor_list (const char *aor_list) |
Retrieve the first bound contact from a list of AORs. More... | |
struct ao2_container * | ast_sip_location_retrieve_contacts_from_aor_list (const char *aor_list) |
Retrieve all contacts from a list of AORs. More... | |
struct ast_sip_contact * | ast_sip_location_retrieve_first_aor_contact (const struct ast_sip_aor *aor) |
Retrieve the first bound contact for an AOR. More... | |
struct ast_sip_contact * | ast_sip_location_retrieve_first_aor_contact_filtered (const struct ast_sip_aor *aor, unsigned int flags) |
Retrieve the first bound contact for an AOR and filter based on flags. More... | |
int | ast_sip_location_update_contact (struct ast_sip_contact *contact) |
Update a contact. More... | |
int | ast_sip_validate_uri_length (const char *contact_uri) |
static int | cli_aor_gather_contacts (void *obj, void *arg, int flags) |
static struct ao2_container * | cli_aor_get_container (const char *regex) |
static const char * | cli_aor_get_id (const void *obj) |
static int | cli_aor_iterate (void *container, ao2_callback_fn callback, void *args) |
static int | cli_aor_print_body (void *obj, void *arg, int flags) |
static int | cli_aor_print_header (void *obj, void *arg, int flags) |
static void * | cli_aor_retrieve_by_id (const char *id) |
static int | cli_contact_compare (void *obj, void *arg, int flags) |
static struct ao2_container * | cli_contact_get_container (const char *regex) |
static const char * | cli_contact_get_id (const void *obj) |
static int | cli_contact_iterate (void *container, ao2_callback_fn callback, void *args) |
static int | cli_contact_populate_container (void *obj, void *arg, int flags) |
static int | cli_contact_print_body (void *obj, void *arg, int flags) |
static int | cli_contact_print_header (void *obj, void *arg, int flags) |
static void * | cli_contact_retrieve_by_id (const char *id) |
static int | cli_contact_sort (const void *obj, const void *arg, int flags) |
static int | cli_filter_contacts (void *obj, void *arg, int flags) |
static int | cli_gather_contact (void *obj, void *arg, int flags) |
static struct ao2_container * | cli_get_aors (void) |
static void * | contact_alloc (const char *name) |
Allocator for contact. More... | |
static int | contact_apply_handler (const struct ast_sorcery *sorcery, void *object) |
Always create a contact_status for each contact. More... | |
static void | contact_destroy (void *obj) |
Destructor for contact. More... | |
static int | contact_expire (void *obj, void *arg, int flags) |
Internal callback function which deletes and unlinks any expired contacts. More... | |
static int | contact_link_static (void *obj, void *arg, int flags) |
Internal callback function which links static contacts into another container. More... | |
static int | contact_remove_unreachable (void *obj, void *arg, int flags) |
Internal callback function which removes any contact which is unreachable. More... | |
static int | contact_to_var_list (void *object, void *arg, int flags) |
static void | contact_wrapper_destroy (void *obj) |
static int | contacts_to_str (const void *obj, const intptr_t *args, char **buf) |
static int | contacts_to_var_list (const void *obj, struct ast_variable **fields) |
static int | destroy_contact (void *obj, void *arg, int flags) |
Internal callback function which destroys the specified contact. More... | |
static int | expiration_str2struct (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Custom handler for translating from a string timeval to actual structure. More... | |
static int | expiration_struct2str (const void *obj, const intptr_t *args, char **buf) |
Custom handler for translating from an actual structure timeval to string. More... | |
static int | format_ami_aor_handler (void *obj, void *arg, int flags) |
static int | format_ami_aorlist_handler (void *obj, void *arg, int flags) |
static int | format_ami_endpoint_aor (const struct ast_sip_endpoint *endpoint, struct ast_sip_ami *ami) |
static int | gather_contacts_for_aor (void *obj, void *arg, int flags) |
static int | permanent_uri_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Custom handler for permanent URIs. More... | |
static int | permanent_uri_sort_fn (const void *obj_left, const void *obj_right, int flags) |
static int | prune_boot_contacts_cb (void *obj, void *arg, int flags) |
static int | sip_aor_to_ami (const struct ast_sip_aor *aor, struct ast_str **buf) |
static int | voicemail_extension_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | voicemail_extension_to_str (const void *obj, const intptr_t *args, char **buf) |
Variables | |
struct ast_sip_cli_formatter_entry * | aor_formatter |
static const struct ast_sorcery_observer | aor_observer |
Observer for contacts so state can be updated on respective endpoints. More... | |
static struct ast_cli_entry | cli_commands [] |
struct ast_sip_cli_formatter_entry * | contact_formatter |
struct ast_sip_endpoint_formatter | endpoint_aor_formatter |
static int | pj_max_hostname = PJ_MAX_HOSTNAME |
static int | pjsip_max_url_size = PJSIP_MAX_URL_SIZE |
|
static |
Definition at line 1263 of file location.c.
References ao2_callback, ao2_container_count(), ao2_ref, astman_get_header(), astman_send_error(), astman_send_list_complete_end(), astman_send_list_complete_start(), astman_send_listack(), cli_get_aors(), ast_sip_ami::count, format_ami_aorlist_handler(), ast_sip_ami::m, OBJ_NODATA, and ast_sip_ami::s.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Allocator for AOR.
Definition at line 50 of file location.c.
References ao2_ref, aor_destroy(), ast_named_lock_get, AST_NAMED_LOCK_TYPE_MUTEX, ast_sorcery_lockable_alloc(), ast_string_field_init, lock, name, and NULL.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 1355 of file location.c.
References ao2_callback, aor_apply_outbound_proxy(), ast_strlen_zero(), OBJ_MULTIPLE, OBJ_NODATA, ast_sip_aor::outbound_proxy, and ast_sip_aor::permanent_contacts.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 1345 of file location.c.
References ast_string_field_set, and ast_sip_aor::outbound_proxy.
Referenced by aor_apply_handler().
|
static |
Definition at line 81 of file location.c.
References ao2_callback, ao2_ref, ast_sip_get_sorcery(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_prefix(), destroy_contact(), NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, ast_sip_aor::permanent_contacts, and prefix.
|
static |
Destructor for AOR.
Definition at line 40 of file location.c.
References ao2_cleanup, ast_free, ast_string_field_free_memory, ast_sip_aor::permanent_contacts, and ast_sip_aor::voicemail_extension.
Referenced by aor_alloc().
int ast_sip_contact_to_str | ( | void * | object, |
void * | arg, | ||
int | flags | ||
) |
Handler used to convert a contact to a string.
object | the ast_sip_aor_contact_pair containing a list of contacts to iterate and the contact |
arg | user data passed to handler |
flags |
0 | Success, non-zero on failure |
Definition at line 770 of file location.c.
References ast_str_append(), buf, and ast_sip_contact_wrapper::contact_id.
Referenced by contacts_to_str(), sip_contact_to_str(), and sip_endpoints_aors_ami().
int ast_sip_destroy_sorcery_location | ( | void | ) |
Definition at line 1471 of file location.c.
References aor_formatter, aor_observer, ARRAY_LEN, ast_cli_unregister_multiple(), ast_manager_unregister(), ast_sip_get_sorcery(), ast_sip_unregister_cli_formatter(), ast_sip_unregister_endpoint_formatter(), ast_sorcery_observer_remove(), cli_commands, contact_formatter, and endpoint_aor_formatter.
Referenced by ast_res_pjsip_destroy_configuration().
int ast_sip_for_each_aor | ( | const char * | aors, |
ao2_callback_fn | on_aor, | ||
void * | arg | ||
) |
For every aor in the comma separated aors string call the given 'on_aor' handler.
aors | a comma separated list of aors |
on_aor | callback for each aor |
arg | user data passed to handler |
0 | Success, non-zero on failure |
Definition at line 687 of file location.c.
References ao2_ref, ast_sip_location_retrieve_aor(), ast_strdupa, ast_strip(), ast_strlen_zero(), copy(), name, and strsep().
Referenced by ami_registrations_endpoint(), ast_sip_location_retrieve_contacts_from_aor_list(), cli_aor_iterate(), format_ami_contact_status(), format_ami_endpoint_aor(), format_ami_endpoints(), mwi_new_subscribe(), and mwi_subscribe_all().
int ast_sip_for_each_contact | ( | const struct ast_sip_aor * | aor, |
ao2_callback_fn | on_contact, | ||
void * | arg | ||
) |
For every contact on an AOR call the given 'on_contact' handler.
aor | the aor containing a list of contacts to iterate |
on_contact | callback on each contact on an AOR. The object received by the callback will be a ast_sip_contact_wrapper structure. |
arg | user data passed to handler |
0 | Success, non-zero on failure |
Definition at line 722 of file location.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_bump, ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_malloc, ast_sip_location_retrieve_aor_contacts(), ast_sorcery_object_get_id(), ast_strdup, contact_wrapper_destroy(), NULL, and RAII_VAR.
Referenced by ami_registrations_aor(), cli_aor_gather_contacts(), cli_contact_iterate(), contacts_to_str(), contacts_to_var_list(), format_contact_status_for_aor(), and sip_endpoints_aors_ami().
int ast_sip_initialize_sorcery_location | ( | void | ) |
Initialize sorcery with location support.
Definition at line 1369 of file location.c.
References ami_show_aors(), ao2_alloc, aor_alloc(), aor_apply_handler(), aor_formatter, aor_observer, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_manager_register_xml, ast_pjproject_get_buildopt(), ast_sip_get_contact_status_label(), ast_sip_get_sorcery(), ast_sip_register_cli_formatter(), ast_sip_register_endpoint_formatter(), ast_sorcery_apply_default, ast_sorcery_object_field_register, ast_sorcery_object_field_register_custom, ast_sorcery_object_register, ast_sorcery_object_set_congestion_levels(), ast_sorcery_observer_add(), AST_STATSD_GAUGE, ast_statsd_log_full_va(), AST_TASKPROCESSOR_HIGH_WATER_LEVEL, cli_aor_get_container(), cli_aor_get_id(), cli_aor_iterate(), cli_aor_print_body(), cli_aor_print_header(), cli_aor_retrieve_by_id(), cli_commands, cli_contact_get_container(), cli_contact_get_id(), cli_contact_iterate(), cli_contact_print_body(), cli_contact_print_header(), cli_contact_retrieve_by_id(), contact_alloc(), contact_apply_handler(), contact_formatter, contacts_to_str(), contacts_to_var_list(), default_expiration, endpoint_aor_formatter, EVENT_FLAG_SYSTEM, expiration_str2struct(), expiration_struct2str(), FLDSET, ast_sip_cli_formatter_entry::get_container, ast_sip_cli_formatter_entry::get_id, ast_sip_cli_formatter_entry::iterate, LOG_ERROR, mailboxes, ast_sip_cli_formatter_entry::name, NULL, OPT_BOOL_T, OPT_DOUBLE_T, OPT_NOOP_T, OPT_STRINGFIELD_T, OPT_UINT_T, OPT_YESNO_T, PARSE_IN_RANGE, permanent_uri_handler(), pj_max_hostname, pjsip_max_url_size, ast_sip_cli_formatter_entry::print_body, ast_sip_cli_formatter_entry::print_header, REMOVED, ast_sip_cli_formatter_entry::retrieve_by_id, sorcery, STRFLDSET, voicemail_extension_handler(), and voicemail_extension_to_str().
Referenced by ast_res_pjsip_initialize_configuration().
int ast_sip_location_add_contact | ( | struct ast_sip_aor * | aor, |
const char * | uri, | ||
struct timeval | expiration_time, | ||
const char * | path_info, | ||
const char * | user_agent, | ||
const char * | via_addr, | ||
int | via_port, | ||
const char * | call_id, | ||
struct ast_sip_endpoint * | endpoint | ||
) |
Add a new contact to an AOR.
aor | Pointer to the AOR |
uri | Full contact URI |
expiration_time | Optional expiration time of the contact |
path_info | Path information |
user_agent | User-Agent header from REGISTER request |
via_addr | |
via_port | |
call_id | |
endpoint | The endpoint that resulted in the contact being added |
-1 | failure |
0 | success |
Definition at line 429 of file location.c.
References ao2_lock, ao2_unlock, ast_sip_contact::aor, ast_sip_location_add_contact_nolock(), ast_sip_contact::call_id, ast_sip_contact::endpoint, ast_sip_contact::expiration_time, ast_sip_contact::uri, ast_sip_contact::user_agent, ast_sip_contact::via_addr, and ast_sip_contact::via_port.
int ast_sip_location_add_contact_nolock | ( | struct ast_sip_aor * | aor, |
const char * | uri, | ||
struct timeval | expiration_time, | ||
const char * | path_info, | ||
const char * | user_agent, | ||
const char * | via_addr, | ||
int | via_port, | ||
const char * | call_id, | ||
struct ast_sip_endpoint * | endpoint | ||
) |
Add a new contact to an AOR without locking the AOR.
aor | Pointer to the AOR |
uri | Full contact URI |
expiration_time | Optional expiration time of the contact |
path_info | Path information |
user_agent | User-Agent header from REGISTER request |
via_addr | |
via_port | |
call_id | |
endpoint | The endpoint that resulted in the contact being added |
-1 | failure |
0 | success |
Definition at line 416 of file location.c.
References ao2_cleanup, ast_sip_contact::aor, ast_sip_location_create_contact(), ast_sip_contact::call_id, ast_sip_contact::endpoint, ast_sip_contact::expiration_time, ast_sip_contact::uri, ast_sip_contact::user_agent, ast_sip_contact::via_addr, and ast_sip_contact::via_port.
Referenced by ast_sip_location_add_contact().
struct ast_sip_contact * ast_sip_location_create_contact | ( | struct ast_sip_aor * | aor, |
const char * | uri, | ||
struct timeval | expiration_time, | ||
const char * | path_info, | ||
const char * | user_agent, | ||
const char * | via_addr, | ||
int | via_port, | ||
const char * | call_id, | ||
int | prune_on_boot, | ||
struct ast_sip_endpoint * | endpoint | ||
) |
Create a new contact for an AOR without locking the AOR.
aor | Pointer to the AOR |
uri | Full contact URI |
expiration_time | Optional expiration time of the contact |
path_info | Path information |
user_agent | User-Agent header from REGISTER request |
via_addr | |
via_port | |
call_id | |
prune_on_boot | Non-zero if the contact cannot survive a restart/boot. |
endpoint | The endpoint that resulted in the contact being added |
Definition at line 355 of file location.c.
References ao2_bump, ao2_ref, ast_sip_contact::aor, ast_config_AST_SYSTEM_NAME, ast_md5_hash(), ast_sip_get_sorcery(), ast_sorcery_alloc(), ast_sorcery_create(), ast_sorcery_object_get_id(), ast_string_field_set, ast_strlen_zero(), ast_sip_contact::authenticate_qualify, ast_sip_contact::call_id, ast_sip_contact::endpoint, ast_sip_contact::endpoint_name, ast_sip_contact::expiration_time, MAX_OBJECT_FIELD, name, NULL, ast_sip_contact::outbound_proxy, ast_sip_contact::path, ast_sip_contact::prune_on_boot, ast_sip_contact::qualify_frequency, ast_sip_contact::qualify_timeout, ast_sip_contact::reg_server, ast_sip_contact::uri, ast_sip_contact::user_agent, ast_sip_contact::via_addr, and ast_sip_contact::via_port.
Referenced by ast_sip_location_add_contact_nolock().
int ast_sip_location_delete_contact | ( | struct ast_sip_contact * | contact | ) |
Delete a contact.
contact | Contact object to delete |
-1 | failure |
0 | success |
Definition at line 450 of file location.c.
References ast_sip_get_sorcery(), and ast_sorcery_delete().
Referenced by contact_expire(), destroy_contact(), prune_boot_contacts_cb(), and registrar_contact_delete().
void ast_sip_location_prune_boot_contacts | ( | void | ) |
Prune the prune_on_boot contacts.
Definition at line 469 of file location.c.
References ao2_callback, ao2_ref, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_fields(), NULL, and prune_boot_contacts_cb().
Referenced by load_module().
struct ast_sip_aor * ast_sip_location_retrieve_aor | ( | const char * | aor_name | ) |
Retrieve a named AOR.
aor_name | Name of the AOR |
NULL | if not found |
non-NULL | if found |
Definition at line 147 of file location.c.
References ast_sip_get_sorcery(), and ast_sorcery_retrieve_by_id().
Referenced by ast_sip_for_each_aor(), ast_sip_location_retrieve_contact_and_aor_from_list_filtered(), find_aor(), find_aor2(), find_aor_for_resource(), find_registrar_aor(), handle_slash(), notify_endpoint(), pjsip_acf_dial_contacts_read(), register_contact_transport_remove_cb(), send_unsolicited_mwi_notify(), and vec_contact_cmp().
struct ao2_container * ast_sip_location_retrieve_aor_contacts | ( | const struct ast_sip_aor * | aor | ) |
Retrieve all contacts currently available for an AOR.
aor | Pointer to the AOR |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 247 of file location.c.
References AST_SIP_CONTACT_FILTER_DEFAULT, and ast_sip_location_retrieve_aor_contacts_filtered().
Referenced by ast_sip_for_each_contact(), find_contact(), format_ami_aor_handler(), gather_contacts_for_aor(), notify_endpoint(), pjsip_aor_function_read(), and send_unsolicited_mwi_notify().
struct ao2_container * ast_sip_location_retrieve_aor_contacts_filtered | ( | const struct ast_sip_aor * | aor, |
unsigned int | flags | ||
) |
Retrieve all contacts currently available for an AOR and filter based on flags.
aor | Pointer to the AOR |
flags | Filtering flags |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 252 of file location.c.
References ao2_lock, ao2_unlock, and ast_sip_location_retrieve_aor_contacts_nolock_filtered().
Referenced by ast_sip_location_retrieve_aor_contacts(), ast_sip_location_retrieve_first_aor_contact_filtered(), and pjsip_acf_dial_contacts_read().
struct ao2_container * ast_sip_location_retrieve_aor_contacts_nolock | ( | const struct ast_sip_aor * | aor | ) |
Retrieve all contacts currently available for an AOR without locking the AOR.
aor | Pointer to the AOR |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 214 of file location.c.
References AST_SIP_CONTACT_FILTER_DEFAULT, and ast_sip_location_retrieve_aor_contacts_nolock_filtered().
Referenced by register_aor().
struct ao2_container * ast_sip_location_retrieve_aor_contacts_nolock_filtered | ( | const struct ast_sip_aor * | aor, |
unsigned int | flags | ||
) |
Retrieve all contacts currently available for an AOR without locking the AOR and filter based on flags.
aor | Pointer to the AOR |
flags | Filtering flags |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 219 of file location.c.
References ao2_callback, AST_SIP_CONTACT_FILTER_REACHABLE, ast_sip_get_sorcery(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_prefix(), contact_expire(), contact_link_static(), contact_remove_unreachable(), NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, ast_sip_aor::permanent_contacts, and prefix.
Referenced by ast_sip_location_retrieve_aor_contacts_filtered(), and ast_sip_location_retrieve_aor_contacts_nolock().
struct ast_sip_contact * ast_sip_location_retrieve_contact | ( | const char * | contact_name | ) |
Retrieve a named contact.
contact_name | Name of the contact |
NULL | if not found |
non-NULL | if found |
Definition at line 350 of file location.c.
References ast_sip_get_sorcery(), and ast_sorcery_retrieve_by_id().
Referenced by register_contact_transport_remove_cb().
void ast_sip_location_retrieve_contact_and_aor_from_list | ( | const char * | aor_list, |
struct ast_sip_aor ** | aor, | ||
struct ast_sip_contact ** | contact | ||
) |
Retrieve the first bound contact AND the AOR chosen from a list of AORs.
aor_list | A comma-separated list of AOR names |
aor | The chosen AOR |
contact | The chosen contact |
Definition at line 266 of file location.c.
References AST_SIP_CONTACT_FILTER_DEFAULT, and ast_sip_location_retrieve_contact_and_aor_from_list_filtered().
Referenced by ast_sip_location_retrieve_contact_from_aor_list().
void ast_sip_location_retrieve_contact_and_aor_from_list_filtered | ( | const char * | aor_list, |
unsigned int | flags, | ||
struct ast_sip_aor ** | aor, | ||
struct ast_sip_contact ** | contact | ||
) |
Retrieve the first bound contact AND the AOR chosen from a list of AORs and filter based on flags.
aor_list | A comma-separated list of AOR names |
flags | Filtering flags |
aor | The chosen AOR |
contact | The chosen contact |
Definition at line 272 of file location.c.
References ao2_ref, ast_log, ast_sip_location_retrieve_aor(), ast_sip_location_retrieve_first_aor_contact_filtered(), ast_strdupa, ast_strip(), ast_strlen_zero(), LOG_WARNING, NULL, and strsep().
Referenced by ast_sip_location_retrieve_contact_and_aor_from_list(), and ast_sip_session_create_outgoing().
struct ast_sip_contact * ast_sip_location_retrieve_contact_from_aor_list | ( | const char * | aor_list | ) |
Retrieve the first bound contact from a list of AORs.
aor_list | A comma-separated list of AOR names |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 304 of file location.c.
References ao2_cleanup, ast_sip_contact::aor, and ast_sip_location_retrieve_contact_and_aor_from_list().
Referenced by ast_sip_create_subscription(), create_out_of_dialog_request(), handle_atsign(), handle_single_token(), insert_user_in_contact_uri(), mwi_contact_deleted(), and transfer().
struct ao2_container * ast_sip_location_retrieve_contacts_from_aor_list | ( | const char * | aor_list | ) |
Retrieve all contacts from a list of AORs.
aor_list | A comma-separated list of AOR names |
NULL | if no contacts available |
non-NULL | container (which must be freed) if contacts available |
Definition at line 335 of file location.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_list, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, ast_sip_for_each_aor(), gather_contacts_for_aor(), NULL, and permanent_uri_sort_fn().
Referenced by add_security_headers(), and handle_registration_response().
struct ast_sip_contact * ast_sip_location_retrieve_first_aor_contact | ( | const struct ast_sip_aor * | aor | ) |
Retrieve the first bound contact for an AOR.
aor | Pointer to the AOR |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 194 of file location.c.
References ast_sip_contact::aor, AST_SIP_CONTACT_FILTER_DEFAULT, and ast_sip_location_retrieve_first_aor_contact_filtered().
Referenced by handle_slash().
struct ast_sip_contact * ast_sip_location_retrieve_first_aor_contact_filtered | ( | const struct ast_sip_aor * | aor, |
unsigned int | flags | ||
) |
Retrieve the first bound contact for an AOR and filter based on flags.
aor | Pointer to the AOR |
flags | Filtering flags |
NULL | if no contacts available |
non-NULL | if contacts available |
Definition at line 199 of file location.c.
References ao2_callback, ao2_cleanup, ao2_container_count(), ast_sip_contact::aor, ast_sip_location_retrieve_aor_contacts_filtered(), and NULL.
Referenced by ast_sip_location_retrieve_contact_and_aor_from_list_filtered(), and ast_sip_location_retrieve_first_aor_contact().
int ast_sip_location_update_contact | ( | struct ast_sip_contact * | contact | ) |
Update a contact.
contact | New contact object with details |
-1 | failure |
0 | success |
Definition at line 445 of file location.c.
References ast_sip_get_sorcery(), and ast_sorcery_update().
int ast_sip_validate_uri_length | ( | const char * | contact_uri | ) |
Definition at line 528 of file location.c.
References ast_strdupa, ast_strip_quoted(), pj_max_hostname, pjsip_max_url_size, and strsep().
Referenced by permanent_uri_handler(), sip_outbound_registration_apply(), and validate_publish_config().
|
static |
Definition at line 912 of file location.c.
References ast_sip_for_each_contact(), and cli_contact_populate_container().
Referenced by cli_contact_get_container().
|
static |
Definition at line 882 of file location.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_list, ao2_container_dup(), ao2_ref, ast_sip_get_sorcery(), ast_sorcery_object_id_compare(), ast_sorcery_object_id_sort(), ast_sorcery_retrieve_by_regex(), container, NULL, and regex().
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 1154 of file location.c.
References ast_sorcery_object_get_id().
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 1142 of file location.c.
References args, ast_sip_for_each_aor(), and container.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 1186 of file location.c.
References ao2_ref, ast_assert, ast_sip_cli_print_sorcery_objectset(), ast_sip_lookup_cli_formatter(), ast_sorcery_object_get_id(), ast_str_append(), CLI_INDENT_TO_SPACES, CLI_LAST_TABSTOP, voicemailpwcheck::context, ast_sip_cli_formatter_entry::iterate, ast_sip_aor::max_contacts, NULL, and ast_sip_cli_formatter_entry::print_body.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 1159 of file location.c.
References ao2_ref, ast_assert, ast_sip_lookup_cli_formatter(), ast_str_append(), CLI_HEADER_FILLER, CLI_INDENT_TO_SPACES, CLI_LAST_TABSTOP, voicemailpwcheck::context, NULL, and ast_sip_cli_formatter_entry::print_header.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 1149 of file location.c.
References ast_sip_get_sorcery(), and ast_sorcery_retrieve_by_id().
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 950 of file location.c.
References CMP_MATCH, CMP_STOP, ast_sip_contact_wrapper::contact_id, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.
Referenced by cli_contact_get_container().
|
static |
Definition at line 1029 of file location.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_callback, ao2_cleanup, ao2_container_alloc_list, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, ao2_ref, AST_RETRIEVE_FLAG_MULTIPLE, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_fields(), ast_sorcery_retrieve_by_regex(), ast_strlen_zero(), ast_variable_new, ast_variables_destroy(), cli_aor_gather_contacts(), cli_contact_compare(), cli_contact_sort(), cli_filter_contacts(), cli_gather_contact(), NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, RAII_VAR, and regex().
Referenced by ast_sip_initialize_sorcery_location(), and cli_contact_retrieve_by_id().
|
static |
Definition at line 919 of file location.c.
References ast_sip_contact_wrapper::contact_id.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 979 of file location.c.
References args, ast_sip_for_each_contact(), and container.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 905 of file location.c.
References ao2_link.
Referenced by cli_aor_gather_contacts(), and gather_contacts_for_aor().
|
static |
Definition at line 1109 of file location.c.
References ao2_cleanup, ast_sip_contact::aor, ast_assert, ast_sip_get_contact_short_status_label(), ast_sip_get_contact_status(), ast_sorcery_object_get_id(), ast_str_append(), AVAILABLE, CLI_INDENT_TO_SPACES, CLI_LAST_TABSTOP, ast_sip_contact_wrapper::contact, voicemailpwcheck::context, NAN, NULL, status, UNKNOWN, and ast_sip_contact::uri.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 1094 of file location.c.
References ast_assert, ast_str_append(), CLI_HEADER_FILLER, CLI_INDENT_TO_SPACES, CLI_LAST_TABSTOP, voicemailpwcheck::context, and NULL.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 1079 of file location.c.
References ao2_find, ao2_ref, cli_contact_get_container(), container, NULL, and OBJ_SEARCH_KEY.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 925 of file location.c.
References ast_sip_contact_wrapper::contact_id, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.
Referenced by cli_contact_get_container().
|
static |
Definition at line 984 of file location.c.
References CMP_MATCH, ast_sip_contact_wrapper::contact_id, and NULL.
Referenced by cli_contact_get_container().
|
static |
Definition at line 996 of file location.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_bump, ao2_cleanup, ao2_link, ast_sip_contact::aor, ast_config_AST_SYSTEM_NAME, ast_malloc, ast_strdup, contact_wrapper_destroy(), NULL, RAII_VAR, ast_sip_contact::reg_server, and ast_sip_contact::uri.
Referenced by cli_contact_get_container().
|
static |
Definition at line 1232 of file location.c.
References AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_fields(), and NULL.
Referenced by ami_show_aors().
|
static |
Allocator for contact.
Definition at line 120 of file location.c.
References ao2_cleanup, ast_sip_contact::aor, ast_assert, ast_sorcery_generic_alloc(), ast_strdupa, ast_string_field_init, ast_string_field_set, contact_destroy(), id, name, and NULL.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Always create a contact_status for each contact.
Definition at line 1329 of file location.c.
References ao2_cleanup, ast_log, ast_res_pjsip_find_or_create_contact_status(), ast_sorcery_object_get_id(), ast_strlen_zero(), LOG_ERROR, status, and ast_sip_contact::uri.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Destructor for contact.
Definition at line 111 of file location.c.
References ao2_cleanup, ast_string_field_free_memory, and ast_sip_contact::endpoint.
Referenced by contact_alloc().
|
static |
Internal callback function which deletes and unlinks any expired contacts.
Definition at line 153 of file location.c.
References ast_sip_location_delete_contact(), ast_tvdiff_ms(), ast_tvnow(), CMP_MATCH, and ast_sip_contact::expiration_time.
Referenced by ast_sip_location_retrieve_aor_contacts_nolock_filtered().
|
static |
Internal callback function which links static contacts into another container.
Definition at line 168 of file location.c.
References ao2_link.
Referenced by ast_sip_location_retrieve_aor_contacts_nolock_filtered().
|
static |
Internal callback function which removes any contact which is unreachable.
Definition at line 177 of file location.c.
References ao2_ref, ast_sip_get_contact_status(), CMP_MATCH, status, and UNAVAILABLE.
Referenced by ast_sip_location_retrieve_aor_contacts_nolock_filtered().
|
static |
Definition at line 650 of file location.c.
References ast_variable_list_append, ast_variable_new, ast_sip_contact_wrapper::contact, ast_sip_contact::uri, and var.
Referenced by contacts_to_var_list().
|
static |
Definition at line 713 of file location.c.
References ao2_cleanup, ast_sip_contact_wrapper::aor_id, ast_free, ast_sip_contact_wrapper::contact, and ast_sip_contact_wrapper::contact_id.
Referenced by ast_sip_for_each_contact(), and cli_gather_contact().
|
static |
Definition at line 811 of file location.c.
References ast_free, ast_sip_contact_to_str(), ast_sip_for_each_contact(), ast_str_buffer(), ast_str_create, ast_str_truncate(), ast_strdup, buf, MAX_OBJECT_FIELD, NULL, and str.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 660 of file location.c.
References ast_sip_for_each_contact(), and contact_to_var_list().
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Internal callback function which destroys the specified contact.
Definition at line 72 of file location.c.
References ast_sip_location_delete_contact(), and CMP_MATCH.
Referenced by aor_deleted_observer().
|
static |
Custom handler for translating from a string timeval to actual structure.
Definition at line 482 of file location.c.
References ast_get_timeval(), ast_tv(), ast_sip_contact::expiration_time, NULL, and var.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Custom handler for translating from an actual structure timeval to string.
Definition at line 489 of file location.c.
References ast_asprintf, AST_TIME_T_LEN, ast_time_t_to_string(), buf, and ast_sip_contact::expiration_time.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 831 of file location.c.
References ao2_container_count(), ao2_ref, ast_sip_ami::arg, ast_free, ast_sip_create_ami_event(), ast_sip_location_retrieve_aor_contacts(), ast_sorcery_object_get_id(), ast_str_append(), ast_str_buffer(), astman_append(), buf, ast_sip_ami::count, ast_sip_aor::permanent_contacts, ast_sip_ami::s, and sip_aor_to_ami().
Referenced by format_ami_endpoint_aor().
|
static |
Definition at line 1242 of file location.c.
References ast_sip_ami::arg, ast_free, ast_sip_create_ami_event(), ast_str_buffer(), astman_append(), buf, ast_sip_ami::count, ast_sip_ami::s, and sip_aor_to_ami().
Referenced by ami_show_aors().
|
static |
Definition at line 870 of file location.c.
References ast_sip_endpoint::aors, ast_sip_ami::arg, ast_sip_for_each_aor(), and format_ami_aor_handler().
|
static |
Definition at line 319 of file location.c.
References ao2_callback, ao2_ref, ast_sip_location_retrieve_aor_contacts(), cli_contact_populate_container(), CMP_MATCH, container, OBJ_MULTIPLE, and OBJ_NODATA.
Referenced by ast_sip_location_retrieve_contacts_from_aor_list().
|
static |
Custom handler for permanent URIs.
Definition at line 592 of file location.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_container_alloc_list, AO2_CONTAINER_ALLOC_OPT_DUPS_REJECT, ao2_link, ao2_ref, ast_sip_contact_status::aor, ast_log, ast_md5_hash(), ast_res_pjsip_find_or_create_contact_status(), ast_sip_get_sorcery(), ast_sip_validate_uri_length(), ast_sorcery_alloc(), ast_sorcery_object_get_id(), ast_strdupa, ast_string_field_set, ast_strip(), ast_strlen_zero(), LOG_ERROR, NULL, permanent_uri_sort_fn(), status, strsep(), ast_sip_contact_status::uri, and var.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 498 of file location.c.
References ast_assert, ast_sorcery_object_get_id(), OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and OBJ_SEARCH_PARTIAL_KEY.
Referenced by ast_sip_location_retrieve_contacts_from_aor_list(), and permanent_uri_handler().
|
static |
Definition at line 455 of file location.c.
References ast_sip_contact::aor, ast_config_AST_SYSTEM_NAME, ast_sip_location_delete_contact(), ast_verb, ast_sip_contact::prune_on_boot, ast_sip_contact::reg_server, and ast_sip_contact::uri.
Referenced by ast_sip_location_prune_boot_contacts().
|
static |
Definition at line 780 of file location.c.
References ast_free, AST_HANDLER_ONLY_STRING, ast_sip_get_sorcery(), ast_sorcery_object_get_id(), ast_sorcery_object_get_type(), ast_sorcery_objectset_create2(), ast_str_append(), ast_to_camel_case, ast_variables_destroy(), buf, ast_variable::name, ast_variable::next, NULL, S_OR, and ast_variable::value.
Referenced by format_ami_aor_handler(), and format_ami_aorlist_handler().
|
static |
Definition at line 669 of file location.c.
References ast_strdup, var, and ast_sip_aor::voicemail_extension.
Referenced by ast_sip_initialize_sorcery_location().
|
static |
Definition at line 678 of file location.c.
References ast_strdup, buf, and ast_sip_aor::voicemail_extension.
Referenced by ast_sip_initialize_sorcery_location().
struct ast_sip_cli_formatter_entry* aor_formatter |
Definition at line 1326 of file location.c.
Referenced by ast_sip_destroy_sorcery_location(), and ast_sip_initialize_sorcery_location().
|
static |
Observer for contacts so state can be updated on respective endpoints.
Definition at line 105 of file location.c.
Referenced by ast_sip_destroy_sorcery_location(), and ast_sip_initialize_sorcery_location().
|
static |
Definition at line 1293 of file location.c.
Referenced by ast_sip_destroy_sorcery_location(), and ast_sip_initialize_sorcery_location().
struct ast_sip_cli_formatter_entry* contact_formatter |
Definition at line 1325 of file location.c.
Referenced by ast_sip_destroy_sorcery_location(), and ast_sip_initialize_sorcery_location().
struct ast_sip_endpoint_formatter endpoint_aor_formatter |
Definition at line 878 of file location.c.
Referenced by ast_sip_destroy_sorcery_location(), and ast_sip_initialize_sorcery_location().
|
static |
Definition at line 36 of file location.c.
Referenced by ast_sip_initialize_sorcery_location(), and ast_sip_validate_uri_length().
|
static |
Definition at line 37 of file location.c.
Referenced by ast_sip_initialize_sorcery_location(), and ast_sip_validate_uri_length().