43#define PERSISTENT_BUCKETS 53
97 if (!strncmp(
var->name,
"contact_", 8)) {
116 *
buf =
"deny/permit";
137 *
buf =
"deny/permit";
182 endpoint->
extensions.
flags &= ~(PJSIP_INV_SUPPORT_100REL | PJSIP_INV_REQUIRE_100REL);
187 }
else if (!strcasecmp(
var->value,
"peer_supported")) {
190 }
else if (!strcasecmp(
var->value,
"required")) {
209 *
buf =
"peer_supported";
225 endpoint->
extensions.
flags &= ~(PJSIP_INV_SUPPORT_TIMER | PJSIP_INV_REQUIRE_TIMER
226 | PJSIP_INV_ALWAYS_USE_TIMER);
231 }
else if (!strcasecmp(
var->value,
"required")) {
233 }
else if (!strcasecmp(
var->value,
"always") || !strcasecmp(
var->value,
"forced")) {
234 endpoint->
extensions.
flags |= (PJSIP_INV_SUPPORT_TIMER | PJSIP_INV_ALWAYS_USE_TIMER);
289 if (!strcasecmp(
"no",
val)) {
291 }
else if (!strcasecmp(
"mediasec",
val)) {
317 for (i = 0; i < size; ++i) {
411 const char *
str =
"<unknown>";
418 str =
"auth_username";
446 if (!strcasecmp(
str,
"username")) {
448 }
else if (!strcasecmp(
str,
"auth_username")) {
450 }
else if (!strcasecmp(
str,
"ip")) {
452 }
else if (!strcasecmp(
str,
"header")) {
454 }
else if (!strcasecmp(
str,
"request_uri")) {
485 ast_log(
LOG_ERROR,
"Unrecognized identification method %s specified for endpoint %s\n",
521 for (idx = 0; idx <
methods; ++idx) {
523 const char *method_str;
530 if (!strcmp(method_str,
"<unknown>")) {
534 buf_used += snprintf(*
buf + buf_used, buf_size - buf_used,
"%s%s",
535 method_str, idx <
methods - 1 ?
"," :
"");
536 if (buf_size <= buf_used) {
538 *(*
buf + (buf_size - 1)) =
'\0';
574 if (!strcasecmp(
var->value,
"user")) {
576 }
else if (!strcasecmp(
var->value,
"uri_core")) {
578 }
else if (!strcasecmp(
var->value,
"uri_pjsip")) {
581 ast_log(
LOG_ERROR,
"Unrecognized redirect method %s specified for endpoint %s\n",
593 if (!strcasecmp(
var->value,
"invite") || !strcasecmp(
var->value,
"reinvite")) {
595 }
else if (!strcasecmp(
var->value,
"update")) {
623 if (!strcasecmp(
var->value,
"invite") || !strcasecmp(
var->value,
"reinvite")) {
625 }
else if (!strcasecmp(
var->value,
"update")) {
646 if (!strcasecmp(
var->value,
"none")) {
648 }
else if (!strcasecmp(
var->value,
"outgoing")) {
650 }
else if (!strcasecmp(
var->value,
"incoming")) {
680 char cid_name[80] = {
'\0' };
681 char cid_num[80] = {
'\0' };
735 if (callingpres == -1 && sscanf(
var->value,
"%d", &callingpres) != 1) {
774 if (!strcasecmp(
"no",
var->value)) {
776 }
else if (!strcasecmp(
"sdes",
var->value)) {
778 }
else if (!strcasecmp(
"dtls",
var->value)) {
809 ast_log(
LOG_WARNING,
"Endpoint %s: Option 'stir_shaken' is no longer supported. Use 'stir_shaken_profile' instead.\n",
828 if (!strncmp(
var->name,
"call_group", 10)) {
830 }
else if (!strncmp(
var->name,
"pickup_group", 12)) {
868 if (!strncmp(
var->name,
"named_call_group", 16)) {
876 }
else if (!strncmp(
var->name,
"named_pickup_group", 18)) {
921 front = strtok_r(
buf,
"_", &back);
923 int size = strlen(front);
926 front = strtok_r(
NULL,
"_", &back);
1024 if (!strcmp(
var->value,
"none")) {
1026 }
else if (!strcmp(
var->value,
"fec")) {
1028 }
else if (!strcmp(
var->value,
"redundancy")) {
1061 "interpret '%s' value '%s'\n",
1066 if (!strcmp(
var->name,
"tos_audio")) {
1068 }
else if (!strcmp(
var->name,
"tos_video")) {
1103 char *valid_uri_marks =
"-._~%!$&'()*+,;=:";
1107 if (!isalpha(*
val) && !isdigit(*
val) && !strchr(valid_uri_marks, *
val)) {
1109 "contains invalid character '%c'\n",
1232 int outgoing = strcmp(
var->name,
"outgoing_call_offer_pref") == 0;
1292 if (strcmp(
var->name,
"codec_prefs_incoming_offer") == 0) {
1294 ast_log(
LOG_ERROR,
"Endpoint '%s': Codec preference '%s' has invalid value '%s' for option: '%s'",
1304 }
else if (strcmp(
var->name,
"codec_prefs_outgoing_offer") == 0) {
1308 }
else if (strcmp(
var->name,
"codec_prefs_incoming_answer") == 0) {
1312 }
else if (strcmp(
var->name,
"codec_prefs_outgoing_answer") == 0) {
1324 prefs.
prefer = default_prefer;
1342 *option_prefs = prefs;
1348 const void *obj,
const intptr_t *
args,
char **
buf)
1465 blob =
ast_json_pack(
"{s: s}",
"peer_status",
"Unreachable");
1500 snprintf(rtt,
sizeof(rtt),
"%" PRId64, contact_status->
rtt);
1503 "aor", contact_status->
aor,
1504 "uri", contact_status->
uri,
1505 "roundtrip_usec", rtt,
1532 if (!persistent->endpoint) {
1541 ao2_ref(persistent->endpoint, +1);
1542 return persistent->endpoint;
1555 ast_log(
LOG_ERROR,
"Session timer minimum expires time must be 90 or greater on endpoint '%s'\n",
1559 ast_log(
LOG_ERROR,
"Session timer expires must be greater than minimum session expires time on endpoint '%s'\n",
1570 ast_log(
LOG_ERROR,
"Setting both preferred_codec_only and incoming_call_offer_pref is not supported on endpoint '%s'\n",
1604 ast_log(
LOG_WARNING,
"DTLS renegotiation is not supported with WebRTC. Disabling dtls_rekey.\n");
1618 ast_log(
LOG_ERROR,
"A geoloc incoming and/or outgoing call_profile was specified on endpoint '%s'"
1626 ast_log(
LOG_ERROR,
"geoloc_incoming_call_profile '%s' on endpoint '%s' doesn't exist\n",
1636 ast_log(
LOG_ERROR,
"geoloc_outgoing_call_profile '%s' on endpoint '%s' doesn't exist\n",
1682 res = on_channel_snapshot(snapshot, arg, 0);
1713 if (endpoint_snapshot) {
1722#define AMI_DEFAULT_STR_SIZE 512
1761 for (i = objset; i; i = i->
next) {
1813#define AMI_SHOW_ENDPOINTS "PJSIPShowEndpoints"
1814#define AMI_SHOW_ENDPOINT "PJSIPShowEndpoint"
1830 if (!strncasecmp(endpoint_name,
"pjsip/", 6)) {
1977 if (formatter_entry) {
1989 " Endpoint: <Endpoint/CID.....................................> <State.....> <Channels.>\n");
2009 if (formatter_entry) {
2010 formatter_entry->iterate((
void *)obj, formatter_entry->print_body,
context);
2020 char *print_name =
NULL;
2030 print_name_len = strlen(
id) + strlen(
number) + 2;
2032 snprintf(print_name, print_name_len,
"%s/%s",
id,
number);
2040 flexwidth, flexwidth, print_name ? print_name :
id,
2042 endpoint_snapshot->num_channels,
2050 context->auth_direction =
"Out";
2052 context->auth_direction =
"In";
2062 if (
context->indent_level == 0) {
2077 .
command =
"pjsip list endpoints",
2078 .
usage =
"Usage: pjsip list endpoints [ like <pattern> ]\n"
2079 " List the configured PJSIP endpoints\n"
2080 " Optional regular expression pattern is used to filter the list.\n"),
2082 .
command =
"pjsip show endpoints",
2083 .
usage =
"Usage: pjsip show endpoints [ like <pattern> ]\n"
2084 " List(detailed) the configured PJSIP endpoints\n"
2085 " Optional regular expression pattern is used to filter the list.\n"),
2087 .
command =
"pjsip show endpoint",
2088 .
usage =
"Usage: pjsip show endpoint <id>\n"
2089 " Show the configured PJSIP endpoint\n"),
2144 ast_log(
LOG_ERROR,
"Failed to register SIP endpoint object with sorcery\n");
2286 "prefer: pending, operation: intersect, keep: all, transcode: allow",
2289 "prefer: pending, operation: union, keep: all, transcode: allow",
2292 "prefer: pending, operation: intersect, keep: all",
2295 "prefer: pending, operation: intersect, keep: all",
2309 ast_log(
LOG_ERROR,
"Failed to register SIP transport support with sorcery\n");
2316 ast_log(
LOG_ERROR,
"Failed to register SIP location support with sorcery\n");
2325 ast_log(
LOG_ERROR,
"Failed to register SIP domain aliases support with sorcery\n");
2539 for (i = 0; i < num_auths; ++i) {
Access Control of various sorts.
int ast_str2tos(const char *value, unsigned int *tos)
Convert a string to the appropriate TOS value.
struct stasis_message_type * ast_named_acl_change_type(void)
a stasis_message_type for changes against a named ACL or the set of all named ACLs
void ast_append_acl(const char *sense, const char *stuff, struct ast_acl_list **path, int *error, int *named_acl_flag)
Add a rule to an ACL struct.
int ast_acl_list_is_empty(struct ast_acl_list *acl_list)
Determines if an ACL is empty or if it contains entries.
struct ast_acl_list * ast_free_acl_list(struct ast_acl_list *acl)
Free a list of ACLs.
Asterisk main include file. File version handling, generic pbx functions.
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
void ast_free_ptr(void *ptr)
free() wrapper
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
int ao2_container_dup(struct ao2_container *dest, struct ao2_container *src, enum search_flags flags)
Copy all object references in the src container into the dest container.
@ AO2_ALLOC_OPT_LOCK_NOLOCK
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
int() ao2_callback_fn(void *obj, void *arg, int flags)
Type of a generic callback function.
#define ao2_link_flags(container, obj, flags)
Add an object to a container.
#define ao2_find(container, arg, flags)
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_alloc_options(data_size, destructor_fn, options)
@ OBJ_NOLOCK
Assume that the ao2_container is already locked.
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a list container.
#define ao2_alloc(data_size, destructor_fn)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
char * ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *num, const char *unknown)
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
const char * ast_named_caller_presentation(int data)
Convert caller ID pres value to text code.
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
static char regcontext[AST_MAX_CONTEXT]
static char language[MAX_LANGUAGE]
static char accountcode[AST_MAX_ACCOUNT_CODE]
static char mohsuggest[MAX_MUSICCLASS]
char * ast_print_namedgroups(struct ast_str **buf, struct ast_namedgroups *groups)
Print named call groups and named pickup groups.
void ast_party_id_init(struct ast_party_id *init)
Initialize the given party id structure.
void ast_party_id_free(struct ast_party_id *doomed)
Destroy the party id contents.
char * ast_print_group(char *buf, int buflen, ast_group_t group)
Print call and pickup groups into buffer.
struct ast_namedgroups * ast_get_namedgroups(const char *s)
Create an ast_namedgroups set with group names from comma separated string.
struct ast_namedgroups * ast_unref_namedgroups(struct ast_namedgroups *groups)
ast_group_t ast_get_group(const char *s)
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static struct ao2_container * codecs
Registered codecs.
int ast_sip_destroy_sorcery_auth(void)
int ast_sip_initialize_sorcery_auth(void)
Initialize sorcery with auth support.
int ast_sip_initialize_sorcery_domain_alias(void)
Initialize sorcery with domain alias support.
int ast_sip_destroy_sorcery_global(void)
int ast_sip_initialize_sorcery_global(void)
char * ast_sip_global_default_outbound_endpoint(void)
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define CHARFLDSET(type, field)
A helper macro to pass the appropriate arguments to aco_option_register for OPT_CHAR_ARRAY_T.
@ OPT_UINT_T
Type for default option handler for unsigned integers.
@ OPT_NOOP_T
Type for a default handler that should do nothing.
@ OPT_CODEC_T
Type for default option handler for format capabilities.
@ OPT_BOOL_T
Type for default option handler for bools (ast_true/ast_false)
@ OPT_CHAR_ARRAY_T
Type for default option handler for character array strings.
@ OPT_YESNO_T
Type for default option handler for bools (ast_true/ast_false)
@ OPT_STRINGFIELD_T
Type for default option handler for stringfields.
int ast_sip_initialize_sorcery_transport(void)
Initialize sorcery with transport support.
int ast_sip_destroy_sorcery_transport(void)
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
const char * ast_devstate2str(enum ast_device_state devstate) attribute_pure
Convert device state to text string for output.
ast_device_state
Device States.
ast_endpoint_state
Valid states for an endpoint.
void ast_endpoint_set_state(struct ast_endpoint *endpoint, enum ast_endpoint_state state)
Updates the state of the given endpoint.
const char * ast_endpoint_get_tech(const struct ast_endpoint *endpoint)
Gets the technology of the given endpoint.
void ast_endpoint_shutdown(struct ast_endpoint *endpoint)
Shutsdown an ast_endpoint.
enum ast_endpoint_state ast_endpoint_get_state(const struct ast_endpoint *endpoint)
Gets the state of the given endpoint.
const char * ast_endpoint_get_resource(const struct ast_endpoint *endpoint)
Gets the resource name of the given endpoint.
struct ast_endpoint * ast_endpoint_create(const char *tech, const char *resource)
Create an endpoint struct.
static int regex(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
void astman_send_error_va(struct mansession *s, const struct message *m, const char *fmt,...)
Send error in manager transaction (with va_args support)
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
void astman_append(struct mansession *s, const char *fmt,...)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
void ast_endpoint_blob_publish(struct ast_endpoint *endpoint, struct stasis_message_type *type, struct ast_json *blob)
Creates and publishes a ast_endpoint_blob message.
struct stasis_message_type * ast_endpoint_contact_state_type(void)
Message type for endpoint contact state changes.
struct ast_channel_snapshot * ast_channel_snapshot_get_latest(const char *uniqueid)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object,...
struct ast_endpoint_snapshot * ast_endpoint_latest_snapshot(const char *tech, const char *resource)
Retrieve the most recent snapshot for the endpoint with the given name.
struct stasis_message_type * ast_endpoint_state_type(void)
Message type for endpoint state changes.
char * strsep(char **str, const char *delims)
#define ast_variable_new(name, value, filename)
#define ast_variable_list_append(head, new_var)
struct ast_variable * ast_variables_dup(struct ast_variable *var)
Duplicate variable list.
int ast_variable_list_replace(struct ast_variable **head, struct ast_variable *replacement)
Replace a variable in the given list with a new value.
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
#define ast_verb(level,...)
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
static struct ao2_container * endpoints
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
#define EVENT_FLAG_SYSTEM
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
def ignore(key=None, val=None, section=None, pjsip=None, nmapped=None, type='endpoint')
int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
Parse an IPv4 or IPv6 address string.
static char * ast_sockaddr_stringify_addr_remote(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() to return an address only.
Core PBX routines and definitions.
int ast_add_extension(const char *context, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
Add and extension to an extension context.
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
int ast_context_remove_extension(const char *context, const char *extension, int priority, const char *registrar)
Simply remove extension from context.
struct ast_exten * pbx_find_extension(struct ast_channel *chan, struct ast_context *bypass, struct pbx_find_info *q, const char *context, const char *exten, int priority, const char *label, const char *callerid, enum ext_match_t action)
static int tos_video_to_str(const void *obj, const intptr_t *args, char **buf)
static void cli_endpoint_print_child_body(char *type, const void *obj, struct ast_sip_cli_context *context)
static void persistent_endpoint_destroy(void *obj)
Destructor function for persistent endpoint information.
static int t38udptl_ec_to_str(const void *obj, const intptr_t *args, char **buf)
static void cli_endpoint_print_child_header(char *type, struct ast_sip_cli_context *context)
static int connected_line_method_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int outgoing_answer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
static void media_configuration_destroy(struct ast_sip_endpoint_media_configuration *media)
static int codec_prefs_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static void load_all_endpoints(void)
static int format_ami_endpoint(const struct ast_sip_endpoint *endpoint, struct ast_sip_ami *ami)
static int from_user_to_str(const void *obj, const intptr_t *args, char **buf)
static void * sip_nat_hook_alloc(const char *name)
void ast_sip_persistent_endpoint_publish_contact_state(const char *endpoint_name, const struct ast_sip_contact_status *contact_status)
Publish the change of state for a contact.
static int prack_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
int ast_sip_set_security_negotiation(enum ast_sip_security_negotiation *security_negotiation, const char *val)
Set the security negotiation based on a given string.
static int init_info_configuration(struct ast_sip_endpoint_info_configuration *info)
static int set_var_to_vl(const void *obj, struct ast_variable **fields)
static struct ast_cli_entry cli_commands[]
static int redirect_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
struct ast_sip_cli_formatter_entry * endpoint_formatter
static int media_address_to_str(const void *obj, const intptr_t *args, char **buf)
static int stir_shaken_to_str(const void *obj, const intptr_t *args, char **buf)
#define PERSISTENT_BUCKETS
Number of buckets for persistent endpoint information.
static int stir_shaken_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static void endpoint_deleted_observer(const void *object)
static int incoming_offer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
struct ao2_container * ast_sip_get_endpoints(void)
Retrieve any endpoints available to sorcery.
static int caller_id_privacy_to_str(const void *obj, const intptr_t *args, char **buf)
static int pickupgroup_to_str(const void *obj, const intptr_t *args, char **buf)
static int cli_endpoint_print_body(void *obj, void *arg, int flags)
void * ast_sip_endpoint_alloc(const char *name)
Allocate a new SIP endpoint.
static int contact_user_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int ident_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static struct stasis_subscription * acl_change_sub
static int tos_audio_to_str(const void *obj, const intptr_t *args, char **buf)
static int direct_media_method_to_str(const void *obj, const intptr_t *args, char **buf)
static struct ast_endpoint * persistent_endpoint_find_or_create(const struct ast_sip_endpoint *endpoint)
Internal function which finds (or creates) persistent endpoint information.
static void info_configuration_destroy(struct ast_sip_endpoint_info_configuration *info)
int ast_sip_for_each_channel_snapshot(const struct ast_endpoint_snapshot *endpoint_snapshot, ao2_callback_fn on_channel_snapshot, void *arg)
For every channel snapshot on an endpoint snapshot call the given 'on_channel_snapshot' handler.
void ast_sip_cleanup_auths(struct ast_sip_auth *auths[], size_t num_auths)
Clean up retrieved auth structures from memory.
static int call_offer_pref_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int dtlsverify_to_str(const void *obj, const intptr_t *args, char **buf)
static int codec_prefs_to_str(const struct ast_stream_codec_negotiation_prefs *prefs, const void *obj, const intptr_t *args, char **buf)
static const char * direct_media_glare_mitigation_map[]
static int dtls_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int media_encryption_to_str(const void *obj, const intptr_t *args, char **buf)
static int ami_show_endpoints(struct mansession *s, const struct message *m)
static int dtmf_to_str(const void *obj, const intptr_t *args, char **buf)
static int outbound_auth_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static const struct ast_sorcery_observer endpoint_observers
static int group_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int ami_show_endpoint(struct mansession *s, const struct message *m)
static const char * ast_rtp_dtls_setup_map[]
static int outgoing_offer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
static int contact_user_to_str(const void *obj, const intptr_t *args, char **buf)
static int voicemail_extension_to_str(const void *obj, const intptr_t *args, char **buf)
int ast_sip_auths_to_str(const struct ast_sip_auth_vector *auths, char **buf)
Converts an auths array to a string of comma separated values.
static int dtlscapath_to_str(const void *obj, const intptr_t *args, char **buf)
static int contact_acl_to_str(const void *obj, const intptr_t *args, char **buf)
static int set_var_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define AMI_SHOW_ENDPOINT
static int named_callgroups_to_str(const void *obj, const intptr_t *args, char **buf)
struct ast_endpoint_snapshot * ast_sip_get_endpoint_snapshot(const struct ast_sip_endpoint *endpoint)
Retrieve the endpoint snapshot for an endpoint.
static int security_negotiation_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
void ast_sip_auth_vector_destroy(struct ast_sip_auth_vector *auths)
Free contents of an auth vector.
static int active_channels_to_str_cb(void *object, void *arg, int flags)
static int dtlscipher_to_str(const void *obj, const intptr_t *args, char **buf)
static int t38udptl_ec_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
int ast_sip_retrieve_auths(const struct ast_sip_auth_vector *auths, struct ast_sip_auth **out)
Retrieve relevant SIP auth structures from sorcery.
static int named_pickupgroups_to_str(const void *obj, const intptr_t *args, char **buf)
static int caller_id_tag_to_str(const void *obj, const intptr_t *args, char **buf)
static void sip_sorcery_object_ami_set_type_name(const void *obj, struct ast_str **buf)
static int caller_id_to_str(const void *obj, const intptr_t *args, char **buf)
static int incoming_answer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
int ast_res_pjsip_reload_configuration(void)
static int cli_endpoint_iterate(void *obj, ao2_callback_fn callback, void *args)
static int security_mechanism_to_str(const void *obj, const intptr_t *args, char **buf)
static int prack_to_str(const void *obj, const intptr_t *args, char **buf)
static int caller_id_tag_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int init_media_configuration(struct ast_sip_endpoint_media_configuration *media)
static int cli_endpoint_print_header(void *obj, void *arg, int flags)
static int format_str_append_auth(const struct ast_sip_auth_vector *auths, struct ast_str **buf)
static int dtlsfingerprint_to_str(const void *obj, const intptr_t *args, char **buf)
static int dtlsautogeneratecert_to_str(const void *obj, const intptr_t *args, char **buf)
static int voicemail_extension_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int callgroup_to_str(const void *obj, const intptr_t *args, char **buf)
int ast_sip_persistent_endpoint_update_state(const char *endpoint_name, enum ast_endpoint_state state)
Change state of a persistent endpoint.
const char * ast_sip_get_device_state(const struct ast_sip_endpoint *endpoint)
Retrieve the device state for an endpoint.
static int outbound_auths_to_str(const void *obj, const intptr_t *args, char **buf)
struct ast_sip_endpoint * ast_sip_default_outbound_endpoint(void)
Retrieve the default outbound endpoint.
struct ast_sip_cli_formatter_entry * channel_formatter
static int sip_endpoint_apply_handler(const struct ast_sorcery *sorcery, void *obj)
Callback function for when an object is finalized.
static const char * id_configuration_refresh_methods[]
static int sip_endpoints_aors_ami(void *obj, void *arg, int flags)
static const char * ast_rtp_dtls_fingerprint_map[]
static const char * sip_endpoint_identifier_type2str(enum ast_sip_endpoint_identifier_type method)
int ast_sip_retrieve_auths_vector(const struct ast_sip_auth_vector *auth_ids, struct ast_sip_auth_objects_vector *auth_objects)
Retrieve relevant SIP auth structures from sorcery as a vector.
static int connected_line_method_to_str(const void *obj, const intptr_t *args, char **buf)
static int init_subscription_configuration(struct ast_sip_endpoint_subscription_configuration *subscription)
static int media_encryption_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int persistent_endpoint_cmp(void *obj, void *arg, int flags)
Comparison function for persistent endpoint information.
static void * cli_endpoint_retrieve_by_id(const char *id)
static int inbound_auth_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
int ast_sip_sorcery_object_to_ami(const void *obj, struct ast_str **buf)
Converts a sorcery object to a string of object properties.
static int incoming_call_offer_pref_to_str(const void *obj, const intptr_t *args, char **buf)
static int inbound_auths_to_str(const void *obj, const intptr_t *args, char **buf)
int ast_res_pjsip_initialize_configuration(void)
static const char * security_negotiation_map[]
static int dtlsrekey_to_str(const void *obj, const intptr_t *args, char **buf)
static int outgoing_call_offer_pref_to_str(const void *obj, const intptr_t *args, char **buf)
static struct ast_sorcery * sip_sorcery
static int dtmf_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int endpoint_acl_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int from_user_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int set_var_to_str(const void *obj, const intptr_t *args, char **buf)
struct ast_str * ast_sip_create_ami_event(const char *event, struct ast_sip_ami *ami)
Creates a string to store AMI event data in.
static int security_negotiation_to_str(const void *obj, const intptr_t *args, char **buf)
static void subscription_configuration_destroy(struct ast_sip_endpoint_subscription_configuration *subscription)
void ast_res_pjsip_destroy_configuration(void)
static int sip_endpoint_to_ami(const struct ast_sip_endpoint *endpoint, struct ast_str **buf)
static void endpoint_destructor(void *obj)
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
static int direct_media_glare_mitigation_to_str(const void *obj, const intptr_t *args, char **buf)
static const char * media_encryption_map[]
static int dtlssetup_to_str(const void *obj, const intptr_t *args, char **buf)
static int tos_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int caller_id_privacy_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
int ast_sip_auth_vector_init(struct ast_sip_auth_vector *auths, const char *value)
Initialize an auth vector with the configured values.
#define AMI_SHOW_ENDPOINTS
static int acl_to_str(const void *obj, const intptr_t *args, char **buf)
static int security_mechanism_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int media_address_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static void active_channels_to_str(const struct ast_sip_endpoint *endpoint, struct ast_str **str)
int ast_sip_for_each_channel(const struct ast_sip_endpoint *endpoint, ao2_callback_fn on_channel_snapshot, void *arg)
For every channel snapshot on an endpoint all the given 'on_channel_snapshot' handler.
static int direct_media_glare_mitigation_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int ident_to_str(const void *obj, const intptr_t *args, char **buf)
static struct ao2_container * persistent_endpoints
Container for persistent endpoint information.
static int sip_endpoint_identifier_str2type(const char *str)
static int dtlscafile_to_str(const void *obj, const intptr_t *args, char **buf)
static int dtlscertfile_to_str(const void *obj, const intptr_t *args, char **buf)
static int format_ami_endpoints(void *obj, void *arg, int flags)
#define AMI_DEFAULT_STR_SIZE
static int timers_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int direct_media_method_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
int ast_sip_persistent_endpoint_add_to_regcontext(const char *regcontext)
static struct ao2_container * cli_endpoint_get_container(const char *regex)
static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static int dtlsprivatekey_to_str(const void *obj, const intptr_t *args, char **buf)
static int persistent_endpoint_hash(const void *obj, const int flags)
Hashing function for persistent endpoint information.
static int add_to_regcontext(void *obj, void *arg, int flags)
static int named_groups_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int caller_id_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static const char * ast_t38_ec_modes_map[]
static int timers_to_str(const void *obj, const intptr_t *args, char **buf)
struct stasis_forward * sub
struct ao2_container * container
struct ast_geoloc_profile * ast_geoloc_get_profile(const char *id)
Retrieve a geolocation profile by id.
int ast_geoloc_is_loaded(void)
Check if res_geolocation is available.
static struct @450 methods[]
ast_sip_endpoint_identifier_type
Different methods by which incoming requests can be matched to endpoints.
@ AST_SIP_ENDPOINT_IDENTIFY_BY_HEADER
@ AST_SIP_ENDPOINT_IDENTIFY_BY_USERNAME
@ AST_SIP_ENDPOINT_IDENTIFY_BY_REQUEST_URI
@ AST_SIP_ENDPOINT_IDENTIFY_BY_IP
@ AST_SIP_ENDPOINT_IDENTIFY_BY_AUTH_USERNAME
int ast_sip_call_codec_str_to_pref(struct ast_flags *pref, const char *pref_str, int is_outgoing)
Convert a call codec preference string to preference flags.
@ AST_SIP_REDIRECT_URI_CORE
@ AST_SIP_REDIRECT_URI_PJSIP
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.
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.
@ AST_SIP_MEDIA_ENCRYPT_SDES
@ AST_SIP_MEDIA_TRANSPORT_INVALID
@ AST_SIP_MEDIA_ENCRYPT_NONE
@ AST_SIP_MEDIA_ENCRYPT_DTLS
int ast_sip_format_endpoint_ami(struct ast_sip_endpoint *endpoint, struct ast_sip_ami *ami, int *count)
Formats the endpoint and sends over AMI.
int ast_sip_dtmf_to_str(const enum ast_sip_dtmf_mode dtmf, char *buf, size_t buf_len)
Convert the DTMF mode enum value into a string.
void ast_sip_security_mechanisms_vector_destroy(struct ast_sip_security_mechanism_vector *security_mechanisms)
Free contents of a security mechanism vector.
const char * ast_sip_call_codec_pref_to_str(struct ast_flags pref)
Convert the call codec preference flags to a string.
int ast_sip_security_mechanisms_to_str(const struct ast_sip_security_mechanism_vector *security_mechanisms, int add_qvalue, char **buf)
Writes the security mechanisms of an endpoint into a buffer as a string and returns the buffer.
#define SIP_SORCERY_AUTH_TYPE
ast_sip_security_negotiation
The kind of security negotiation.
@ AST_SIP_SECURITY_NEG_MEDIASEC
@ AST_SIP_SECURITY_NEG_NONE
int ast_sip_str_to_dtmf(const char *dtmf_mode)
Convert the DTMF mode name into an enum.
char * ast_sip_get_regcontext(void)
Retrieve the global regcontext setting.
@ AST_SIP_CALL_CODEC_PREF_ALL
@ AST_SIP_CALL_CODEC_PREF_LOCAL
@ AST_SIP_CALL_CODEC_PREF_FIRST
@ AST_SIP_CALL_CODEC_PREF_INTERSECT
int ast_sip_security_mechanism_vector_init(struct ast_sip_security_mechanism_vector *security_mechanism, const char *value)
Initialize security mechanism vector from string of security mechanisms.
const char * ast_sip_get_contact_status_label(const enum ast_sip_contact_status_type status)
translate ast_sip_contact_status_type to character string.
int ast_sip_contact_to_str(void *object, void *arg, int flags)
Handler used to convert a contact to a string.
@ AST_SIP_100REL_PEER_SUPPORTED
@ AST_SIP_100REL_UNSUPPORTED
@ AST_SIP_100REL_SUPPORTED
@ AST_SIP_100REL_REQUIRED
@ AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_NONE
@ AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_INCOMING
@ AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_OUTGOING
@ AST_SIP_SESSION_REFRESH_METHOD_UPDATE
@ AST_SIP_SESSION_REFRESH_METHOD_INVITE
int ast_sip_unregister_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Unregisters a CLI formatter.
int ast_sip_cli_print_sorcery_objectset(void *obj, void *arg, int flags)
Prints a sorcery object's ast_variable list.
struct ast_sip_cli_formatter_entry * ast_sip_lookup_cli_formatter(const char *name)
Looks up a CLI formatter by type.
char * ast_sip_cli_traverse_objects(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define CLI_INDENT_TO_SPACES(x)
int ast_sip_register_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Registers a CLI formatter.
static struct ast_sorcery * sorcery
void ast_sip_destroy_cli(void)
int ast_sip_initialize_sorcery_location(void)
Initialize sorcery with location support.
int ast_sip_destroy_sorcery_location(void)
int ast_sip_initialize_cli(void)
@ AST_RTP_DTLS_SETUP_PASSIVE
@ AST_RTP_DTLS_SETUP_HOLDCONN
@ AST_RTP_DTLS_SETUP_ACTPASS
@ AST_RTP_DTLS_SETUP_ACTIVE
@ AST_RTP_DTLS_HASH_SHA256
void ast_rtp_dtls_cfg_free(struct ast_rtp_dtls_cfg *dtls_cfg)
Free contents of a DTLS configuration structure.
@ AST_RTP_DTLS_VERIFY_FINGERPRINT
int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name, const char *value)
Parse DTLS related configuration options.
int ast_rtp_dtls_cfg_validate(struct ast_rtp_dtls_cfg *dtls_cfg)
Validates DTLS related configuration options.
Security Event Reporting API.
struct stasis_topic * ast_security_topic(void)
A stasis_topic which publishes messages for security related issues.
Sorcery Data Access Layer API.
#define ast_sorcery_unref(sorcery)
Decrease the reference count of a sorcery structure.
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
@ AST_RETRIEVE_FLAG_MULTIPLE
Return all matching objects.
@ AST_RETRIEVE_FLAG_ALL
Perform no matching, return all objects.
void ast_sorcery_load(const struct ast_sorcery *sorcery)
Inform any wizards to load persistent objects.
#define ast_sorcery_object_field_register_alias(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object as an alias.
const char * ast_sorcery_object_get_type(const void *object)
Get the type of a sorcery object.
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
void ast_sorcery_reload(const struct ast_sorcery *sorcery)
Inform any wizards to reload persistent objects.
struct ao2_container * ast_sorcery_retrieve_by_regex(const struct ast_sorcery *sorcery, const char *type, const char *regex)
Retrieve multiple objects using a regular expression on their id.
int ast_sorcery_observer_add(const struct ast_sorcery *sorcery, const char *type, const struct ast_sorcery_observer *callbacks)
Add an observer to a specific object type.
#define ast_sorcery_internal_object_register(sorcery, type, alloc, transform, apply)
Register an internal, hidden object type.
#define ast_sorcery_object_field_register_custom(sorcery, type, name, default_val, config_handler, sorcery_handler, multiple_handler, flags,...)
Register a field within an object with custom handlers.
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
int ast_sorcery_object_id_compare(void *obj, void *arg, int flags)
ao2 object comparator based on sorcery id.
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
int ast_sorcery_object_id_sort(const void *obj, const void *arg, int flags)
ao2 object sorter based on sorcery id.
@ AST_HANDLER_ONLY_STRING
Use string handler only.
void ast_sorcery_force_reload_object(const struct ast_sorcery *sorcery, const char *type)
Inform any wizards of a specific object type to reload persistent objects even if no changes determin...
#define MAX_OBJECT_FIELD
Maximum length of an object field name.
#define ast_sorcery_apply_default(sorcery, type, name, data)
#define ast_sorcery_open()
Open a new sorcery structure.
struct ast_variable * ast_sorcery_objectset_create2(const struct ast_sorcery *sorcery, const void *object, enum ast_sorcery_field_handler_flags flags)
Create an object set (KVP list) for an object.
void * ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const char *type, unsigned int flags, struct ast_variable *fields)
Retrieve an object or multiple objects using specific fields.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
@ STASIS_SUBSCRIPTION_FILTER_SELECTIVE
int stasis_subscription_accept_message_type(struct stasis_subscription *subscription, const struct stasis_message_type *type)
Indicate to a subscription that we are interested in a message type.
int stasis_subscription_set_filter(struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter)
Set the message type filtering level on a subscription.
struct stasis_subscription * stasis_unsubscribe_and_join(struct stasis_subscription *subscription)
Cancel a subscription, blocking until the last message is processed.
#define stasis_subscribe(topic, callback, data)
#define AST_STREAM_MAX_CODEC_PREFS_LENGTH
Define for allocating buffer space for to_str() functions.
ast_stream_codec_negotiation_prefs_operation_values
The "operation" values.
@ CODEC_NEGOTIATION_OPERATION_UNSPECIFIED
@ CODEC_NEGOTIATION_OPERATION_UNION
@ CODEC_NEGOTIATION_OPERATION_INTERSECT
@ CODEC_NEGOTIATION_KEEP_UNSPECIFIED
@ CODEC_NEGOTIATION_KEEP_ALL
int ast_stream_codec_prefs_parse(const char *pref_string, struct ast_stream_codec_negotiation_prefs *prefs, struct ast_str **error_message)
Parses a string representing the codec prefs into a ast_stream_codec_negotiation_pref structure.
#define ast_stream_codec_operation_to_str(value)
Safely get the name of an "operation" parameter value.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
const char * ast_stream_codec_prefs_to_str(const struct ast_stream_codec_negotiation_prefs *prefs, struct ast_str **buf)
Return a string representing the codec preferences.
@ CODEC_NEGOTIATION_TRANSCODE_UNSPECIFIED
@ CODEC_NEGOTIATION_TRANSCODE_ALLOW
struct ast_stream_topology * ast_stream_topology_create_from_format_cap(struct ast_format_cap *cap)
A helper function that, given a format capabilities structure, creates a topology and separates the m...
@ CODEC_NEGOTIATION_PARAM_OPERATION
ast_stream_codec_negotiation_prefs_prefer_values
The "prefer" values.
@ CODEC_NEGOTIATION_PREFER_UNSPECIFIED
@ CODEC_NEGOTIATION_PREFER_PENDING
#define ast_stream_codec_param_to_str(value)
Safely get the name of a preference parameter.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_init_extended(x, field)
Initialize an extended string field.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
char * ast_str_truncate(struct ast_str *buf, ssize_t len)
Truncates the enclosed string to the given length.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static force_inline int attribute_pure ast_strlen_zero(const char *s)
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"....
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
#define AST_YESNO(x)
return Yes or No depending on the argument.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
#define ast_to_camel_case(s)
Attempts to convert the given string to camel case using an underscore as the specified delimiter.
void ast_join_delim(char *s, size_t len, const char *const w[], unsigned int size, char delim)
Join an array of strings into a single string.
Wrapper for an ast_acl linked list.
an ast_acl is a linked list node of ast_ha structs which may have names.
char name[ACL_NAME_LENGTH]
const ast_string_field name
Structure representing a snapshot of channel state.
struct ast_channel_snapshot_base * base
descriptor for a cli entry.
A snapshot of an endpoint's state.
Structure used to handle boolean flags.
Abstract JSON element (object, array, string, int, ...).
char * tag
User-set "tag".
struct ast_party_name name
Subscriber name.
struct ast_party_number number
Subscriber phone number.
int presentation
Q.931 encoded presentation-indicator encoded field.
unsigned char valid
TRUE if the name information is valid/present.
char * str
Subscriber name (Malloced)
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
unsigned char valid
TRUE if the number information is valid/present.
char * str
Subscriber phone number (Malloced)
enum ast_rtp_dtls_setup default_setup
enum ast_rtp_dtls_verify verify
enum ast_rtp_dtls_hash hash
unsigned int ephemeral_cert
CLI Formatter Context passed to all formatters.
CLI Formatter Registry Entry.
int(* iterate)(void *container, ao2_callback_fn callback, void *args)
ao2_callback_fn * print_header
void *(* retrieve_by_id)(const char *id)
const char *(* get_id)(const void *obj)
ao2_callback_fn * print_body
struct ao2_container *(* get_container)(const char *regex)
struct ast_sip_timer_options timer
enum ast_sip_session_refresh_method refresh_method
Endpoint configuration options for INFO packages.
struct ast_namedgroups * named_pickupgroups
struct ast_namedgroups * named_callgroups
Endpoint subscription configuration.
struct ast_sip_mwi_configuration mwi
An entity with which Asterisk communicates.
struct ast_sip_auth_vector outbound_auths
enum ast_sip_endpoint_identifier_type ident_method
struct ast_endpoint * persistent
enum ast_sip_session_redirect redirect_method
const ast_string_field transport
struct ast_sip_endpoint_id_configuration id
const ast_string_field aors
struct ast_sip_endpoint_pickup_configuration pickup
enum ast_sip_security_negotiation security_negotiation
Definit