41 #define PERSISTENT_BUCKETS 53 95 if (!strncmp(var->
name,
"contact_", 8)) {
114 *buf =
"deny/permit";
116 *buf = first_acl->
name;
135 *buf =
"deny/permit";
137 *buf = first_acl->
name;
180 endpoint->
extensions.
flags &= ~(PJSIP_INV_SUPPORT_100REL | PJSIP_INV_REQUIRE_100REL);
184 }
else if (!strcasecmp(var->
value,
"required")) {
214 endpoint->
extensions.
flags &= ~(PJSIP_INV_SUPPORT_TIMER | PJSIP_INV_REQUIRE_TIMER
215 | PJSIP_INV_ALWAYS_USE_TIMER);
220 }
else if (!strcasecmp(var->
value,
"required")) {
222 }
else if (!strcasecmp(var->
value,
"always") || !strcasecmp(var->
value,
"forced")) {
260 for (i = 0; i < size; ++i) {
354 const char *
str =
"<unknown>";
361 str =
"auth_username";
386 if (!strcasecmp(str,
"username")) {
388 }
else if (!strcasecmp(str,
"auth_username")) {
390 }
else if (!strcasecmp(str,
"ip")) {
392 }
else if (!strcasecmp(str,
"header")) {
423 ast_log(
LOG_ERROR,
"Unrecognized identification method %s specified for endpoint %s\n",
459 for (idx = 0; idx <
methods; ++idx) {
461 const char *method_str;
468 if (!strcmp(method_str,
"<unknown>")) {
472 buf_used += snprintf(*buf + buf_used, buf_size - buf_used,
"%s%s",
473 method_str, idx < methods - 1 ?
"," :
"");
474 if (buf_size <= buf_used) {
476 *(*buf + (buf_size - 1)) =
'\0';
489 if (!strcasecmp(var->
value,
"user")) {
491 }
else if (!strcasecmp(var->
value,
"uri_core")) {
493 }
else if (!strcasecmp(var->
value,
"uri_pjsip")) {
496 ast_log(
LOG_ERROR,
"Unrecognized redirect method %s specified for endpoint %s\n",
508 if (!strcasecmp(var->
value,
"invite") || !strcasecmp(var->
value,
"reinvite")) {
510 }
else if (!strcasecmp(var->
value,
"update")) {
538 if (!strcasecmp(var->
value,
"invite") || !strcasecmp(var->
value,
"reinvite")) {
540 }
else if (!strcasecmp(var->
value,
"update")) {
561 if (!strcasecmp(var->
value,
"none")) {
563 }
else if (!strcasecmp(var->
value,
"outgoing")) {
565 }
else if (!strcasecmp(var->
value,
"incoming")) {
635 size += name ? strlen(name) : 0;
636 size += number ? strlen(number) : 0;
638 if (!(*buf =
ast_calloc(size + 1,
sizeof(
char)))) {
650 if (callingpres == -1 && sscanf(var->
value,
"%d", &callingpres) != 1) {
689 if (!strcasecmp(
"no", var->
value)) {
691 }
else if (!strcasecmp(
"sdes", var->
value)) {
693 }
else if (!strcasecmp(
"dtls", var->
value)) {
725 if (!strncmp(var->
name,
"call_group", 10)) {
727 }
else if (!strncmp(var->
name,
"pickup_group", 12)) {
765 if (!strncmp(var->
name,
"named_call_group", 16)) {
773 }
else if (!strncmp(var->
name,
"named_pickup_group", 18)) {
818 front = strtok_r(buf,
"_", &back);
820 int size = strlen(front);
823 front = strtok_r(
NULL,
"_", &back);
921 if (!strcmp(var->
value,
"none")) {
923 }
else if (!strcmp(var->
value,
"fec")) {
925 }
else if (!strcmp(var->
value,
"redundancy")) {
958 "interpret '%s' value '%s'\n",
963 if (!strcmp(var->
name,
"tos_audio")) {
965 }
else if (!strcmp(var->
name,
"tos_video")) {
1000 char *valid_uri_marks =
"-._~%!$&'()*+,;=:";
1003 for (val = var->
value; *val; val++) {
1004 if (!isalpha(*val) && !isdigit(*val) && !strchr(valid_uri_marks, *val)) {
1006 "contains invalid character '%c'\n",
1039 val = strchr(name,
'=');
1129 int outgoing = strcmp(var->
name,
"outgoing_call_offer_pref") == 0;
1189 if (strcmp(var->
name,
"codec_prefs_incoming_offer") == 0) {
1191 ast_log(
LOG_ERROR,
"Endpoint '%s': Codec preference '%s' has invalid value '%s' for option: '%s'",
1201 }
else if (strcmp(var->
name,
"codec_prefs_outgoing_offer") == 0) {
1205 }
else if (strcmp(var->
name,
"codec_prefs_incoming_answer") == 0) {
1209 }
else if (strcmp(var->
name,
"codec_prefs_outgoing_answer") == 0) {
1221 prefs.
prefer = default_prefer;
1239 *option_prefs = prefs;
1245 const void *obj,
const intptr_t *
args,
char **
buf)
1362 blob =
ast_json_pack(
"{s: s}",
"peer_status",
"Unreachable");
1397 snprintf(rtt,
sizeof(rtt),
"%" PRId64, contact_status->
rtt);
1400 "aor", contact_status->
aor,
1401 "uri", contact_status->
uri,
1402 "roundtrip_usec", rtt,
1429 if (!persistent->endpoint) {
1438 ao2_ref(persistent->endpoint, +1);
1439 return persistent->endpoint;
1452 ast_log(
LOG_ERROR,
"Session timer minimum expires time must be 90 or greater on endpoint '%s'\n",
1456 ast_log(
LOG_ERROR,
"Session timer expires must be greater than minimum session expires time on endpoint '%s'\n",
1467 ast_log(
LOG_ERROR,
"Setting both preferred_codec_only and incoming_call_offer_pref is not supported on endpoint '%s'\n",
1529 if (!on_channel_snapshot || !num_channels) {
1542 res = on_channel_snapshot(snapshot, arg, 0);
1573 if (endpoint_snapshot) {
1582 #define AMI_DEFAULT_STR_SIZE 512 1621 for (i = objset; i; i = i->
next) {
1673 #define AMI_SHOW_ENDPOINTS "PJSIPShowEndpoints" 1674 #define AMI_SHOW_ENDPOINT "PJSIPShowEndpoint" 1690 if (!strncasecmp(endpoint_name,
"pjsip/", 6)) {
1701 astman_send_listack(s, m,
"Following are Events for each object associated with the Endpoint",
1786 astman_send_listack(s, m,
"A listing of Endpoints follows, presented as EndpointList events",
1837 if (formatter_entry) {
1838 formatter_entry->print_header(
NULL, context, 0);
1849 " Endpoint: <Endpoint/CID.....................................> <State.....> <Channels.>\n");
1869 if (formatter_entry) {
1870 formatter_entry->iterate((
void *)obj, formatter_entry->print_body, context);
1880 char *print_name =
NULL;
1890 print_name_len = strlen(
id) + strlen(number) + 2;
1892 snprintf(print_name, print_name_len,
"%s/%s",
id, number);
1900 flexwidth, flexwidth, print_name ? print_name :
id,
1902 endpoint_snapshot->num_channels,
1937 .
command =
"pjsip list endpoints",
1938 .
usage =
"Usage: pjsip list endpoints [ like <pattern> ]\n" 1939 " List the configured PJSIP endpoints\n" 1940 " Optional regular expression pattern is used to filter the list.\n"),
1942 .
command =
"pjsip show endpoints",
1943 .
usage =
"Usage: pjsip show endpoints [ like <pattern> ]\n" 1944 " List(detailed) the configured PJSIP endpoints\n" 1945 " Optional regular expression pattern is used to filter the list.\n"),
1947 .
command =
"pjsip show endpoint",
1948 .
usage =
"Usage: pjsip show endpoint <id>\n" 1949 " Show the configured PJSIP endpoint\n"),
1982 if (!persistent_endpoints) {
2004 ast_log(
LOG_ERROR,
"Failed to register SIP endpoint object with sorcery\n");
2144 "prefer: pending, operation: intersect, keep: all, transcode: allow",
2147 "prefer: pending, operation: union, keep: all, transcode: allow",
2150 "prefer: pending, operation: intersect, keep: all",
2153 "prefer: pending, operation: intersect, keep: all",
2159 ast_log(
LOG_ERROR,
"Failed to register SIP transport support with sorcery\n");
2166 ast_log(
LOG_ERROR,
"Failed to register SIP location support with sorcery\n");
2175 ast_log(
LOG_ERROR,
"Failed to register SIP domain aliases support with sorcery\n");
2189 if (!endpoint_formatter) {
2195 endpoint_formatter->
name =
"endpoint";
2238 persistent_endpoints =
NULL;
2357 sip_sorcery,
"endpoint",
name);
2380 for (i = 0; i < num_auths; ++i) {
2386 struct ast_sip_auth_objects_vector *auth_objects)
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.
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
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.
struct ast_sip_endpoint_pickup_configuration pickup
static int direct_media_glare_mitigation_to_str(const void *obj, const intptr_t *args, char **buf)
struct ast_str * output_buffer
struct ast_variable * next
Type for default option handler for format capabilities.
static const char * ast_rtp_dtls_setup_map[]
static int dtlsverify_to_str(const void *obj, const intptr_t *args, char **buf)
struct ao2_container *(* get_container)(const char *regex)
#define ARRAY_IN_BOUNDS(v, a)
Checks to see if value is within the bounds of the given array.
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 char accountcode[AST_MAX_ACCOUNT_CODE]
int presentation
Q.931 encoded presentation-indicator encoded field.
static int init_info_configuration(struct ast_sip_endpoint_info_configuration *info)
const char * ast_devstate2str(enum ast_device_state devstate) attribute_pure
Convert device state to text string for output.
int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name, const char *value)
Parse DTLS related configuration options.
static int named_groups_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
struct ast_endpoint * endpoint
Asterisk endpoint itself.
void ast_join_delim(char *s, size_t len, const char *const w[], unsigned int size, char delim)
static int codec_prefs_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)
#define AST_CLI_DEFINE(fn, txt,...)
ast_device_state
Device States.
enum ast_sip_dtmf_mode dtmf
struct ast_sip_mwi_configuration mwi
char * str
Subscriber phone number (Malloced)
int ast_sip_initialize_sorcery_domain_alias(void)
Initialize sorcery with domain alias support.
const char * ast_named_caller_presentation(int data)
Convert caller ID pres value to text code.
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.
#define AST_LIST_LOCK(head)
Locks a list.
struct ast_channel_snapshot_base * base
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 astman_append(struct mansession *s, const char *fmt,...)
enum ast_endpoint_state ast_endpoint_get_state(const struct ast_endpoint *endpoint)
Gets the state of the given endpoint.
unsigned int sess_expires
Asterisk main include file. File version handling, generic pbx functions.
const ast_string_field fromuser
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
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...
static int pickupgroup_to_str(const void *obj, const intptr_t *args, char **buf)
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
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.
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. ...
static int caller_id_privacy_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 dtlscapath_to_str(const void *obj, const intptr_t *args, char **buf)
static const char * id_configuration_refresh_methods[]
char * ast_sip_get_regcontext(void)
Retrieve the global regcontext setting.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
Endpoint configuration options for INFO packages.
Security Event Reporting API.
void(* deleted)(const void *object)
Callback for when an object is deleted.
static int timers_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int acl_to_str(const void *obj, const intptr_t *args, char **buf)
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
static int init_subscription_configuration(struct ast_sip_endpoint_subscription_configuration *subscription)
static int set_var_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
void ast_res_pjsip_destroy_configuration(void)
static int format_ami_endpoint(const struct ast_sip_endpoint *endpoint, struct ast_sip_ami *ami)
Persistent endpoint information.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
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...
static int init_media_configuration(struct ast_sip_endpoint_media_configuration *media)
struct ast_endpoint * ast_endpoint_create(const char *tech, const char *resource)
Create an endpoint struct.
The arg parameter is a search key, but is not an object.
struct stasis_topic * ast_security_topic(void)
A stasis_topic which publishes messages for security related issues.
const ast_string_field transport
static const char * media_encryption_map[]
static int add_to_regcontext(void *obj, void *arg, int flags)
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
unsigned int devicestate_busy_at
struct ast_party_name name
Subscriber name.
int ast_sip_initialize_cli(void)
struct ast_sip_endpoint_nat_configuration nat
#define ast_sorcery_object_field_register_alias(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object as an alias.
static int format_ami_endpoints(void *obj, void *arg, int flags)
static int dtlscafile_to_str(const void *obj, const intptr_t *args, char **buf)
const char * ast_sip_get_device_state(const struct ast_sip_endpoint *endpoint)
Retrieve the device state for an endpoint.
static int voicemail_extension_to_str(const void *obj, const intptr_t *args, char **buf)
const char * ast_endpoint_get_tech(const struct ast_endpoint *endpoint)
Gets the technology of the given endpoint.
int ast_sip_sorcery_object_to_ami(const void *obj, struct ast_str **buf)
Converts a sorcery object to a string of object properties.
#define AST_STREAM_MAX_CODEC_PREFS_LENGTH
Define for allocating buffer space for to_str() functions.
#define ast_set_flag(p, flag)
enum ast_t38_ec_modes error_correction
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
char * voicemail_extension
Endpoint subscription configuration.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
static int direct_media_method_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
descriptor for a cli entry.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define ao2_callback(c, flags, cb_fn, arg)
static int sip_endpoints_aors_ami(void *obj, void *arg, int flags)
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.
static int ami_show_endpoint(struct mansession *s, const struct message *m)
static int contact_acl_to_str(const void *obj, const intptr_t *args, char **buf)
char name[ACL_NAME_LENGTH]
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
static void endpoint_deleted_observer(const void *object)
enum ast_stream_codec_negotiation_prefs_operation_values operation
static int set_var_to_str(const void *obj, const intptr_t *args, char **buf)
Structure for variables, used for configurations and for channel variables.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
struct ast_sip_auth_vector outbound_auths
Structure representing a snapshot of channel state.
static int outgoing_offer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
static int connected_line_method_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
struct ast_sip_info_recording_configuration recording
static int sip_endpoint_identifier_str2type(const char *str)
void ast_sip_auth_vector_destroy(struct ast_sip_auth_vector *auths)
Free contents of an auth vector.
static void * cli_endpoint_retrieve_by_id(const char *id)
struct ast_sip_endpoint_subscription_configuration subscription
Perform no matching, return all objects.
int ast_sorcery_object_id_compare(void *obj, void *arg, int flags)
ao2 object comparator based on sorcery id.
const ast_string_field context
static int outbound_auths_to_str(const void *obj, const intptr_t *args, char **buf)
Assume that the ao2_container is already locked.
#define CHARFLDSET(type, field)
A helper macro to pass the appropriate arguments to aco_option_register for OPT_CHAR_ARRAY_T.
Full structure for sorcery.
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
int(* iterate)(void *container, ao2_callback_fn callback, void *args)
Type for a default handler that should do nothing.
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_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 ...
char * str
Subscriber name (Malloced)
#define AST_VECTOR_REMOVE_UNORDERED(vec, idx)
Remove an element from an unordered vector by index.
static int named_callgroups_to_str(const void *obj, const intptr_t *args, char **buf)
static struct stasis_subscription * acl_change_sub
static int t38udptl_ec_to_str(const void *obj, const intptr_t *args, char **buf)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
enum ast_stream_codec_negotiation_prefs_prefer_values prefer
static int connected_line_method_to_str(const void *obj, const intptr_t *args, char **buf)
static int caller_id_privacy_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Return all matching objects.
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...
void ast_endpoint_set_state(struct ast_endpoint *endpoint, enum ast_endpoint_state state)
Updates the state of the given endpoint.
static int incoming_call_offer_pref_to_str(const void *obj, const intptr_t *args, char **buf)
static struct @481 methods[]
static int callgroup_to_str(const void *obj, const intptr_t *args, char **buf)
Wrapper for an ast_acl linked list.
#define ao2_alloc_options(data_size, destructor_fn, options)
#define ao2_link_flags(container, obj, flags)
#define AMI_SHOW_ENDPOINT
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.
static int sip_endpoint_apply_handler(const struct ast_sorcery *sorcery, void *obj)
Callback function for when an object is finalized.
void ast_party_id_free(struct ast_party_id *doomed)
Destroy the party id contents.
#define ast_strdup(str)
A wrapper for strdup()
static int persistent_endpoint_hash(const void *obj, const int flags)
Hashing function for persistent endpoint information.
int ast_sip_str_to_dtmf(const char *dtmf_mode)
Convert the DTMF mode name into an enum.
int ast_sip_contact_to_str(void *object, void *arg, int flags)
Handler used to convert a contact to a string.
int ast_str2tos(const char *value, unsigned int *tos)
Convert a string to the appropriate TOS value.
static struct ao2_container * cli_endpoint_get_container(const char *regex)
static int set_var_to_vl(const void *obj, struct ast_variable **fields)
static int outbound_auth_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define ast_to_camel_case(s)
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.
static int media_encryption_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.
void ast_free_ptr(void *ptr)
free() wrapper
static char cid_num[AST_MAX_EXTENSION]
static int ident_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
void astman_send_error_va(struct mansession *s, const struct message *m, const char *fmt,...)
Send error in manager transaction (with va_args support)
ast_endpoint_state
Valid states for an endpoint.
static int dtlscertfile_to_str(const void *obj, const intptr_t *args, char **buf)
#define ast_verb(level,...)
const char * ast_endpoint_get_resource(const struct ast_endpoint *endpoint)
Gets the resource name of the given endpoint.
char * ast_sip_cli_traverse_objects(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
enum ast_sip_endpoint_identifier_type ident_method
static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
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_context_remove_extension(const char *context, const char *extension, int priority, const char *registrar)
Simply remove extension from context.
char * ast_print_group(char *buf, int buflen, ast_group_t group)
Print call and pickup groups into buffer.
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
const char * ast_sorcery_object_get_type(const void *object)
Get the type of a sorcery object.
char * ast_str_truncate(struct ast_str *buf, ssize_t len)
Truncates the enclosed string to the given length.
const char * astman_get_header(const struct message *m, char *var)
Get header from mananger transaction.
static struct ast_endpoint * persistent_endpoint_find_or_create(const struct ast_sip_endpoint *endpoint)
Internal function which finds (or creates) persistent endpoint information.
#define ast_strlen_zero(foo)
#define AMI_DEFAULT_STR_SIZE
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
int ast_res_pjsip_initialize_configuration(void)
int ast_sip_register_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Registers a CLI formatter.
struct ast_acl_list * acl
#define ast_sorcery_unref(sorcery)
Decrease the reference count of a sorcery structure.
static int incoming_offer_codec_prefs_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 tos_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
struct ast_sip_endpoint_media_configuration media
Type for default option handler for character array strings.
struct ast_sip_cli_formatter_entry * endpoint_formatter
static int dtlssetup_to_str(const void *obj, const intptr_t *args, char **buf)
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
Type for default option handler for bools (ast_true/ast_false)
static int call_offer_pref_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int dtls_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int dtlsfingerprint_to_str(const void *obj, const intptr_t *args, char **buf)
struct ast_sip_cli_formatter_entry * channel_formatter
#define ast_stream_codec_operation_to_str(value)
Safely get the name of an "operation" parameter value.
#define EVENT_FLAG_SYSTEM
static const char * sip_endpoint_identifier_type2str(enum ast_sip_endpoint_identifier_type method)
int() ao2_callback_fn(void *obj, void *arg, int flags)
Type of a generic callback function.
static int direct_media_glare_mitigation_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static const char * ast_t38_ec_modes_map[]
#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.
static struct ast_cli_entry cli_commands[]
struct ast_sip_endpoint * ast_sip_default_outbound_endpoint(void)
Retrieve the default outbound endpoint.
struct ast_sip_identify_by_vector ident_method_order
Structure for SIP nat hook information.
static int contact_user_to_str(const void *obj, const intptr_t *args, char **buf)
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
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.
char * ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *num, const char *unknown)
struct ast_namedgroups * named_pickupgroups
const char * ast_sip_call_codec_pref_to_str(struct ast_flags pref)
Convert the call codec preference flags to a string.
static int persistent_endpoint_cmp(void *obj, void *arg, int flags)
Comparison function for persistent endpoint information.
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
int ast_sip_retrieve_auths_vector(const struct ast_sip_auth_vector *auth_ids, struct ast_sip_auth_objects_vector *auth_objects)
int ast_sip_initialize_sorcery_transport(void)
Initialize sorcery with transport support.
static int dtmf_to_str(const void *obj, const intptr_t *args, char **buf)
struct ast_acl_list * contact_acl
#define AST_VECTOR_ELEM_CLEANUP_NOOP(elem)
Vector element cleanup that does nothing.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Type for default option handler for unsigned integers.
int ast_variable_list_replace(struct ast_variable **head, struct ast_variable *replacement)
Replace a variable in the given list with a new value.
static int dtlscipher_to_str(const void *obj, const intptr_t *args, char **buf)
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.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define CLI_INDENT_TO_SPACES(x)
static int dtlsautogeneratecert_to_str(const void *obj, const intptr_t *args, char **buf)
int ast_sip_auth_vector_init(struct ast_sip_auth_vector *auths, const char *value)
Initialize an auth vector with the configured values.
Access Control of various sorts.
static struct ao2_container * codecs
Registered codecs.
static int tos_audio_to_str(const void *obj, const intptr_t *args, char **buf)
static char mohsuggest[MAX_MUSICCLASS]
static int sip_endpoint_to_ami(const struct ast_sip_endpoint *endpoint, struct ast_str **buf)
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
static struct ao2_container * endpoints
void ast_sip_destroy_cli(void)
#define ao2_ref(o, delta)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
In case you didn't read that giant block of text above the mansession_session struct, the struct mansession is named this solely to keep the API the same in Asterisk. This structure really represents data that is different from Manager action to Manager action. The mansession_session pointer contained within points to session-specific data.
int ast_sip_destroy_sorcery_auth(void)
#define ast_strdupa(s)
duplicate a string in memory from the stack
int ast_sorcery_object_id_sort(const void *obj, const void *arg, int flags)
ao2 object sorter based on sorcery id.
static int inbound_auth_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
char * ast_sip_global_default_outbound_endpoint(void)
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
void *(* retrieve_by_id)(const char *id)
struct ast_namedgroups * named_callgroups
ast_stream_codec_negotiation_prefs_operation_values
The "operation" values.
static char language[MAX_LANGUAGE]
enum ast_rtp_dtls_hash hash
#define ast_malloc(len)
A wrapper for malloc()
struct ao2_container * container
static void sip_sorcery_object_ami_set_type_name(const void *obj, struct ast_str **buf)
static void load_all_endpoints(void)
static int cli_endpoint_print_header(void *obj, void *arg, int flags)
#define ast_variable_new(name, value, filename)
ast_group_t ast_get_group(const char *s)
an ast_acl is a linked list node of ast_ha structs which may have names.
int ast_sip_unregister_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Unregisters a CLI formatter.
An entity with which Asterisk communicates.
static int timers_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)
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
enum ast_sip_session_refresh_method refresh_method
static struct ao2_container * persistent_endpoints
Container for persistent endpoint information.
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
#define MAX_OBJECT_FIELD
Maximum length of an object field name.
void ast_sip_cleanup_auths(struct ast_sip_auth *auths[], size_t num_auths)
Clean up retrieved auth structures from memory.
Core PBX routines and definitions.
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
static int tos_video_to_str(const void *obj, const intptr_t *args, char **buf)
void * ast_sip_endpoint_alloc(const char *name)
Allocate a new SIP endpoint.
enum ast_stream_codec_negotiation_prefs_keep_values keep
ast_sip_endpoint_identifier_type
Different methods by which incoming requests can be matched to endpoints.
A snapshot of an endpoint's state.
int ast_acl_list_is_empty(struct ast_acl_list *acl_list)
Determines if an ACL is empty or if it contains entries.
#define stasis_subscribe(topic, callback, data)
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_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
struct ast_sip_endpoint_id_configuration id
static void * sip_nat_hook_alloc(const char *name)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
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...
static int t38udptl_ec_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static void endpoint_destructor(void *obj)
static void persistent_endpoint_destroy(void *obj)
Destructor function for persistent endpoint information.
enum ast_rtp_dtls_setup default_setup
static int outgoing_call_offer_pref_to_str(const void *obj, const intptr_t *args, char **buf)
void ast_sip_location_prune_boot_contacts(void)
Prune the prune_on_boot contacts.
struct ast_namedgroups * ast_get_namedgroups(const char *s)
Create an ast_namedgroups set with group names from comma separated string.
struct ast_sip_endpoint_info_configuration info
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
#define ast_sorcery_internal_object_register(sorcery, type, alloc, transform, apply)
Register an internal, hidden object type.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
struct ast_sip_auth_vector inbound_auths
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.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
enum ast_rtp_dtls_verify verify
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.
static struct ast_sorcery * sip_sorcery
Interface for a sorcery object type observer.
static int active_channels_to_str_cb(void *object, void *arg, int flags)
Type for default option handler for bools (ast_true/ast_false)
struct ast_acl_list * ast_free_acl_list(struct ast_acl_list *acl)
Free a list of ACLs.
struct stasis_message_type * ast_endpoint_state_type(void)
Message type for endpoint state changes.
static int ident_to_str(const void *obj, const intptr_t *args, char **buf)
#define ast_sorcery_apply_default(sorcery, type, name, data)
struct ast_endpoint_snapshot * ast_sip_get_endpoint_snapshot(const struct ast_sip_endpoint *endpoint)
Retrieve the endpoint snapshot for an endpoint.
static int media_encryption_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int ami_show_endpoints(struct mansession *s, const struct message *m)
static int contact_user_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int group_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
def ignore(key=None, val=None, section=None, pjsip=None, nmapped=None, type='endpoint')
static int incoming_answer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
#define ao2_alloc(data_size, destructor_fn)
static int from_user_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)
int ast_sip_destroy_sorcery_global(void)
static void cli_endpoint_print_child_body(char *type, const void *obj, struct ast_sip_cli_context *context)
int ast_rtp_dtls_cfg_validate(struct ast_rtp_dtls_cfg *dtls_cfg)
Validates DTLS related configuration options.
unsigned int preferred_codec_only
static const char * direct_media_glare_mitigation_map[]
struct ast_sip_timer_options timer
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
#define ast_calloc(num, len)
A wrapper for calloc()
#define AST_VECTOR_RESET(vec, cleanup)
Reset vector.
static int regex(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
static int prack_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static void subscription_configuration_destroy(struct ast_sip_endpoint_subscription_configuration *subscription)
static void info_configuration_destroy(struct ast_sip_endpoint_info_configuration *info)
static const char * ast_rtp_dtls_fingerprint_map[]
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
struct stasis_subscription * stasis_unsubscribe_and_join(struct stasis_subscription *subscription)
Cancel a subscription, blocking until the last message is processed.
static int prack_to_str(const void *obj, const intptr_t *args, char **buf)
#define ao2_find(container, arg, flags)
unsigned int ephemeral_cert
const char *(* get_id)(const void *obj)
void ast_party_id_init(struct ast_party_id *init)
Initialize the given party id structure.
int ast_sip_initialize_sorcery_auth(void)
Initialize sorcery with auth support.
static int caller_id_to_str(const void *obj, const intptr_t *args, char **buf)
static int endpoint_acl_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Structure used to handle boolean flags.
#define PERSISTENT_BUCKETS
Number of buckets for persistent endpoint information.
#define ast_clear_flag(p, flag)
static char cid_name[AST_MAX_EXTENSION]
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.
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.
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
void ast_sorcery_load(const struct ast_sorcery *sorcery)
Inform any wizards to load persistent objects.
#define AST_YESNO(x)
return Yes or No depending on the argument.
int ast_sip_destroy_sorcery_location(void)
char * tag
User-set "tag".
void ast_sorcery_reload(const struct ast_sorcery *sorcery)
Inform any wizards to reload persistent objects.
struct ast_endpoint * persistent
static int caller_id_tag_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int dtlsprivatekey_to_str(const void *obj, const intptr_t *args, char **buf)
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
static int codec_prefs_to_str(const struct ast_stream_codec_negotiation_prefs *prefs, const void *obj, const intptr_t *args, char **buf)
char * strsep(char **str, const char *delims)
int ast_res_pjsip_reload_configuration(void)
static struct ast_sorcery * sorcery
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.
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...
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
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.
static int dtmf_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
void ast_rtp_dtls_cfg_free(struct ast_rtp_dtls_cfg *dtls_cfg)
Free contents of a DTLS configuration structure.
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"...
enum ast_stream_codec_negotiation_prefs_transcode_values transcode
int ast_sip_persistent_endpoint_add_to_regcontext(const char *regcontext)
int ast_sip_initialize_sorcery_global(void)
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.
static int direct_media_method_to_str(const void *obj, const intptr_t *args, char **buf)
struct stasis_forward * sub
#define ast_sorcery_open()
static int from_user_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int cli_endpoint_iterate(void *obj, ao2_callback_fn callback, void *args)
static void active_channels_to_str(const struct ast_sip_endpoint *endpoint, struct ast_str **str)
static char regcontext[AST_MAX_CONTEXT]
struct stasis_message_type * ast_endpoint_contact_state_type(void)
Message type for endpoint contact state changes.
struct ast_sip_endpoint_extensions extensions
Abstract JSON element (object, array, string, int, ...).
Type for default option handler for stringfields.
#define ast_stream_codec_param_to_str(value)
Safely get the name of a preference parameter.
ao2_callback_fn * print_header
static int named_pickupgroups_to_str(const void *obj, const intptr_t *args, char **buf)
ast_stream_codec_negotiation_prefs_prefer_values
The "prefer" values.
int error(const char *format,...)
struct ast_sip_cli_formatter_entry * ast_sip_lookup_cli_formatter(const char *name)
Looks up a CLI formatter by type.
unsigned char valid
TRUE if the name information is valid/present.
struct ast_namedgroups * ast_unref_namedgroups(struct ast_namedgroups *groups)
static char context[AST_MAX_CONTEXT]
struct ast_variable * channel_vars
int ast_sip_destroy_sorcery_transport(void)
static int redirect_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
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_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.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
const ast_string_field aors
static const struct ast_sorcery_observer endpoint_observers
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
int ast_sip_persistent_endpoint_update_state(const char *endpoint_name, enum ast_endpoint_state state)
Change state of a persistent endpoint.
static int cli_endpoint_print_body(void *obj, void *arg, int flags)
ao2_callback_fn * print_body
void ast_endpoint_shutdown(struct ast_endpoint *endpoint)
Shutsdown an ast_endpoint.
static int format_str_append_auth(const struct ast_sip_auth_vector *auths, struct ast_str **buf)
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
int ast_sip_cli_print_sorcery_objectset(void *obj, void *arg, int flags)
Prints a sorcery object's ast_variable list.
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)
char * ast_print_namedgroups(struct ast_str **buf, struct ast_namedgroups *groups)
Print named call groups and named pickup groups.
static int inbound_auths_to_str(const void *obj, const intptr_t *args, char **buf)
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
enum ast_sip_session_redirect redirect_method
int ast_sip_initialize_sorcery_location(void)
Initialize sorcery with location support.
static int dtlsrekey_to_str(const void *obj, const intptr_t *args, char **buf)
struct ast_variable * ast_variables_dup(struct ast_variable *var)
Duplicate variable list.
unsigned char valid
TRUE if the number information is valid/present.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
#define ast_variable_list_append(head, new_var)
const ast_string_field name
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
Sorcery Data Access Layer API.
static int caller_id_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define AMI_SHOW_ENDPOINTS
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
unsigned show_details_only_level_0
struct ast_party_number number
Subscriber phone number.
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.