Asterisk - The Open Source Telephony Project GIT-master-80b953f
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
pjsip_configuration.c File Reference
#include "asterisk.h"
#include <pjsip.h>
#include <pjsip_ua.h>
#include "asterisk/res_geolocation.h"
#include "asterisk/res_pjsip.h"
#include "include/res_pjsip_private.h"
#include "asterisk/res_pjsip_cli.h"
#include "asterisk/acl.h"
#include "asterisk/manager.h"
#include "asterisk/astobj2.h"
#include "asterisk/utils.h"
#include "asterisk/sorcery.h"
#include "asterisk/callerid.h"
#include "asterisk/test.h"
#include "asterisk/statsd.h"
#include "asterisk/pbx.h"
#include "asterisk/stream.h"
#include "asterisk/stasis.h"
#include "asterisk/security_events.h"
#include "asterisk/res_stir_shaken.h"
Include dependency graph for pjsip_configuration.c:

Go to the source code of this file.

Data Structures

struct  redirect_method_map
 Mapping of SIP method names to their corresponding redirect flags. More...
 
struct  sip_persistent_endpoint
 Persistent endpoint information. More...
 

Macros

#define AMI_DEFAULT_STR_SIZE   512
 
#define AMI_SHOW_ENDPOINT   "PJSIPShowEndpoint"
 
#define AMI_SHOW_ENDPOINTS   "PJSIPShowEndpoints"
 
#define PERSISTENT_BUCKETS   53
 Number of buckets for persistent endpoint information.
 

Functions

static void acl_change_stasis_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message)
 
static int acl_to_str (const void *obj, const intptr_t *args, char **buf)
 
static void active_channels_to_str (const struct ast_sip_endpoint *endpoint, struct ast_str **str)
 
static int add_to_regcontext (void *obj, void *arg, int flags)
 
static int ami_show_endpoint (struct mansession *s, const struct message *m)
 
static int ami_show_endpoints (struct mansession *s, const struct message *m)
 
void ast_res_pjsip_destroy_configuration (void)
 
int ast_res_pjsip_initialize_configuration (void)
 
int ast_res_pjsip_reload_configuration (void)
 
void ast_sip_auth_vector_destroy (struct ast_sip_auth_vector *auths)
 Free contents of an auth vector.
 
int ast_sip_auth_vector_init (struct ast_sip_auth_vector *auths, const char *value)
 Initialize an auth vector with the configured values.
 
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.
 
void ast_sip_cleanup_auths (struct ast_sip_auth *auths[], size_t num_auths)
 Clean up retrieved auth structures from memory.
 
struct ast_strast_sip_create_ami_event (const char *event, struct ast_sip_ami *ami)
 Creates a string to store AMI event data in.
 
struct ast_sip_endpointast_sip_default_outbound_endpoint (void)
 Retrieve the default outbound endpoint.
 
void * ast_sip_endpoint_alloc (const char *name)
 Allocate a new SIP endpoint.
 
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.
 
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.
 
const char * ast_sip_get_device_state (const struct ast_sip_endpoint *endpoint)
 Retrieve the device state for an endpoint.
 
struct ast_endpoint_snapshotast_sip_get_endpoint_snapshot (const struct ast_sip_endpoint *endpoint)
 Retrieve the endpoint snapshot for an endpoint.
 
struct ao2_containerast_sip_get_endpoints (void)
 Retrieve any endpoints available to sorcery.
 
struct ast_sorceryast_sip_get_sorcery (void)
 Get a pointer to the SIP sorcery structure.
 
int ast_sip_persistent_endpoint_add_to_regcontext (const char *regcontext)
 
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.
 
int ast_sip_persistent_endpoint_update_state (const char *endpoint_name, enum ast_endpoint_state state)
 Change state of a persistent endpoint.
 
int ast_sip_retrieve_auths (const struct ast_sip_auth_vector *auths, struct ast_sip_auth **out)
 Retrieve relevant SIP auth structures from sorcery.
 
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.
 
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.
 
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 call_offer_pref_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 int caller_id_privacy_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int caller_id_privacy_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 caller_id_tag_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int caller_id_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int callgroup_to_str (const void *obj, const intptr_t *args, char **buf)
 
static struct ao2_containercli_endpoint_get_container (const char *regex)
 
static int cli_endpoint_iterate (void *obj, ao2_callback_fn callback, void *args)
 
static int cli_endpoint_print_body (void *obj, void *arg, int flags)
 
static void cli_endpoint_print_child_body (char *type, const void *obj, struct ast_sip_cli_context *context)
 
static void cli_endpoint_print_child_header (char *type, struct ast_sip_cli_context *context)
 
static int cli_endpoint_print_header (void *obj, void *arg, int flags)
 
static void * cli_endpoint_retrieve_by_id (const char *id)
 
static int codec_prefs_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int codec_prefs_to_str (const struct ast_stream_codec_negotiation_prefs *prefs, 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)
 
static int connected_line_method_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 contact_user_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int contact_user_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int direct_media_glare_mitigation_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int direct_media_glare_mitigation_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int direct_media_method_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int direct_media_method_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int dtls_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int dtlsautogeneratecert_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int dtlscafile_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int dtlscapath_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 dtlscipher_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int dtlsfingerprint_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int dtlsprivatekey_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int dtlsrekey_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int dtlssetup_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int dtlsverify_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int dtmf_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int dtmf_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)
 
static void endpoint_deleted_observer (const void *object)
 
static void endpoint_destructor (void *obj)
 
static int follow_redirect_methods_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int follow_redirect_methods_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int format_ami_endpoint (const struct ast_sip_endpoint *endpoint, struct ast_sip_ami *ami)
 
static int format_ami_endpoints (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 from_user_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int from_user_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int group_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 int ident_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int inbound_auth_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int inbound_auths_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)
 
static int incoming_call_offer_pref_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int incoming_offer_codec_prefs_to_str (const void *obj, const intptr_t *args, char **buf)
 
static void info_configuration_destroy (struct ast_sip_endpoint_info_configuration *info)
 
static int init_info_configuration (struct ast_sip_endpoint_info_configuration *info)
 
static int init_media_configuration (struct ast_sip_endpoint_media_configuration *media)
 
static int init_subscription_configuration (struct ast_sip_endpoint_subscription_configuration *subscription)
 
static void load_all_endpoints (void)
 
static int media_address_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int media_address_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 media_encryption_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 named_callgroups_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int named_groups_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int named_pickupgroups_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 int outbound_auths_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int outgoing_answer_codec_prefs_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 int outgoing_offer_codec_prefs_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int persistent_endpoint_cmp (void *obj, void *arg, int flags)
 Comparison function for persistent endpoint information.
 
static void persistent_endpoint_destroy (void *obj)
 Destructor function for persistent endpoint information.
 
static struct ast_endpointpersistent_endpoint_find_or_create (const struct ast_sip_endpoint *endpoint)
 Internal function which finds (or creates) persistent endpoint information.
 
static int persistent_endpoint_hash (const void *obj, const int flags)
 Hashing function for persistent endpoint information.
 
static int pickupgroup_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int prack_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int prack_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int redirect_method_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int redirect_method_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 security_mechanism_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int security_negotiation_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int security_negotiation_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)
 
static int set_var_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int set_var_to_vl (const void *obj, struct ast_variable **fields)
 
static int sip_endpoint_apply_handler (const struct ast_sorcery *sorcery, void *obj)
 Callback function for when an object is finalized.
 
static int sip_endpoint_identifier_str2type (const char *str)
 
static const char * sip_endpoint_identifier_type2str (enum ast_sip_endpoint_identifier_type method)
 
static int sip_endpoint_to_ami (const struct ast_sip_endpoint *endpoint, struct ast_str **buf)
 
static int sip_endpoints_aors_ami (void *obj, void *arg, int flags)
 
static void * sip_nat_hook_alloc (const char *name)
 
static void sip_sorcery_object_ami_set_type_name (const void *obj, struct ast_str **buf)
 
static int stir_shaken_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int stir_shaken_to_str (const void *obj, const intptr_t *args, char **buf)
 
static void subscription_configuration_destroy (struct ast_sip_endpoint_subscription_configuration *subscription)
 
static int t38udptl_ec_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int t38udptl_ec_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int timers_handler (const struct aco_option *opt, struct ast_variable *var, void *obj)
 
static int timers_to_str (const void *obj, const intptr_t *args, char **buf)
 
static int tos_audio_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 tos_video_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 voicemail_extension_to_str (const void *obj, const intptr_t *args, char **buf)
 

Variables

static struct stasis_subscriptionacl_change_sub
 
static const char * ast_rtp_dtls_fingerprint_map []
 
static const char * ast_rtp_dtls_setup_map []
 
static const char * ast_t38_ec_modes_map []
 
struct ast_sip_cli_formatter_entrychannel_formatter
 
static struct ast_cli_entry cli_commands []
 
static const char * direct_media_glare_mitigation_map []
 
struct ast_sip_cli_formatter_entryendpoint_formatter
 
static const struct ast_sorcery_observer endpoint_observers
 
static const char * id_configuration_refresh_methods []
 
static const char * media_encryption_map []
 
static struct ao2_containerpersistent_endpoints
 Container for persistent endpoint information.
 
static const char * redirect_method_map []
 
static const struct redirect_method_map redirect_method_mappings []
 
static const char * security_negotiation_map []
 
static struct ast_sorcerysip_sorcery
 

Macro Definition Documentation

◆ AMI_DEFAULT_STR_SIZE

#define AMI_DEFAULT_STR_SIZE   512

Definition at line 1810 of file pjsip_configuration.c.

◆ AMI_SHOW_ENDPOINT

#define AMI_SHOW_ENDPOINT   "PJSIPShowEndpoint"

Definition at line 1902 of file pjsip_configuration.c.

◆ AMI_SHOW_ENDPOINTS

#define AMI_SHOW_ENDPOINTS   "PJSIPShowEndpoints"

Definition at line 1901 of file pjsip_configuration.c.

◆ PERSISTENT_BUCKETS

#define PERSISTENT_BUCKETS   53

Number of buckets for persistent endpoint information.

Definition at line 43 of file pjsip_configuration.c.

Function Documentation

◆ acl_change_stasis_cb()

static void acl_change_stasis_cb ( void *  data,
struct stasis_subscription sub,
struct stasis_message message 
)
static

Definition at line 2191 of file pjsip_configuration.c.

2193{
2195 return;
2196 }
2197
2199}
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
static struct ast_sorcery * sip_sorcery
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...
Definition sorcery.c:1521

References ast_named_acl_change_type(), ast_sorcery_force_reload_object(), and sip_sorcery.

Referenced by ast_res_pjsip_initialize_configuration().

◆ acl_to_str()

static int acl_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 106 of file pjsip_configuration.c.

107{
108 const struct ast_sip_endpoint *endpoint = obj;
109 struct ast_acl_list *acl_list;
110 struct ast_acl *first_acl;
111
112 if (endpoint && !ast_acl_list_is_empty(acl_list=endpoint->acl)) {
113 AST_LIST_LOCK(acl_list);
114 first_acl = AST_LIST_FIRST(acl_list);
115 if (ast_strlen_zero(first_acl->name)) {
116 *buf = "deny/permit";
117 } else {
118 *buf = first_acl->name;
119 }
120 AST_LIST_UNLOCK(acl_list);
121 }
122
123 *buf = ast_strdup(*buf);
124 return 0;
125}
int ast_acl_list_is_empty(struct ast_acl_list *acl_list)
Determines if an ACL is empty or if it contains entries.
Definition acl.c:540
#define ast_strdup(str)
A wrapper for strdup()
Definition astmm.h:241
char buf[BUFSIZE]
Definition eagi_proxy.c:66
#define AST_LIST_LOCK(head)
Locks a list.
Definition linkedlists.h:40
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition strings.h:65
Wrapper for an ast_acl linked list.
Definition acl.h:76
an ast_acl is a linked list node of ast_ha structs which may have names.
Definition acl.h:67
char name[ACL_NAME_LENGTH]
Definition acl.h:71
An entity with which Asterisk communicates.
Definition res_pjsip.h:1061
struct ast_acl_list * acl
Definition res_pjsip.h:1136

References ast_sip_endpoint::acl, ast_acl_list_is_empty(), AST_LIST_FIRST, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_strdup, ast_strlen_zero(), buf, and ast_acl::name.

Referenced by ast_res_pjsip_initialize_configuration().

◆ active_channels_to_str()

static void active_channels_to_str ( const struct ast_sip_endpoint endpoint,
struct ast_str **  str 
)
static

Definition at line 1799 of file pjsip_configuration.c.

1801{
1802
1803 RAII_VAR(struct ast_endpoint_snapshot *, endpoint_snapshot,
1805
1806 ast_str_append(str, 0, "%d",
1807 endpoint_snapshot ? endpoint_snapshot->num_channels : 0);
1808}
const char * str
Definition app_jack.c:150
#define ao2_cleanup(obj)
Definition astobj2.h:1934
struct ast_endpoint_snapshot * ast_sip_get_endpoint_snapshot(const struct ast_sip_endpoint *endpoint)
Retrieve the endpoint snapshot for an endpoint.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition strings.h:1139
A snapshot of an endpoint's state.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition utils.h:981

References ao2_cleanup, ast_sip_get_endpoint_snapshot(), ast_str_append(), RAII_VAR, and str.

Referenced by format_ami_endpoints(), and sip_endpoint_to_ami().

◆ add_to_regcontext()

static int add_to_regcontext ( void *  obj,
void *  arg,
int  flags 
)
static

Definition at line 1488 of file pjsip_configuration.c.

1489{
1490 struct sip_persistent_endpoint *persistent = obj;
1491 const char *regcontext = arg;
1492
1495 persistent->endpoint), 1, NULL)) {
1497 "Noop", ast_strdup(ast_endpoint_get_resource(persistent->endpoint)), ast_free_ptr, "PJSIP");
1498 }
1499 }
1500
1501 return 0;
1502}
void ast_free_ptr(void *ptr)
free() wrapper
Definition astmm.c:1739
static char regcontext[AST_MAX_CONTEXT]
Definition chan_iax2.c:349
@ AST_ENDPOINT_ONLINE
Definition endpoints.h:57
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.
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.
Definition pbx.c:6968
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
Definition pbx.c:4211
#define NULL
Definition resample.c:96
Persistent endpoint information.
struct ast_endpoint * endpoint
Asterisk endpoint itself.

References ast_add_extension(), ast_endpoint_get_resource(), ast_endpoint_get_state(), AST_ENDPOINT_ONLINE, ast_exists_extension(), ast_free_ptr(), ast_strdup, sip_persistent_endpoint::endpoint, NULL, and regcontext.

Referenced by ast_sip_persistent_endpoint_add_to_regcontext().

◆ ami_show_endpoint()

static int ami_show_endpoint ( struct mansession s,
const struct message m 
)
static

Definition at line 1904 of file pjsip_configuration.c.

1905{
1906 struct ast_sip_ami ami = { .s = s, .m = m, .action_id = astman_get_header(m, "ActionID"),
1907 .count = 0, };
1908 RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);
1909 const char *endpoint_name = astman_get_header(m, "Endpoint");
1910 int count = 0;
1911
1912 if (ast_strlen_zero(endpoint_name)) {
1913 astman_send_error_va(s, m, "%s requires an endpoint name\n",
1915 return 0;
1916 }
1917
1918 if (!strncasecmp(endpoint_name, "pjsip/", 6)) {
1919 endpoint_name += 6;
1920 }
1921
1922 if (!(endpoint = ast_sorcery_retrieve_by_id(
1923 ast_sip_get_sorcery(), "endpoint", endpoint_name))) {
1924 astman_send_error_va(s, m, "Unable to retrieve endpoint %s\n",
1925 endpoint_name);
1926 return 0;
1927 }
1928
1929 astman_send_listack(s, m, "Following are Events for each object associated with the Endpoint",
1930 "start");
1931
1932 /* the endpoint detail needs to always come first so apply as such */
1933 if (format_ami_endpoint(endpoint, &ami) ||
1934 ast_sip_format_endpoint_ami(endpoint, &ami, &count)) {
1935 astman_send_error_va(s, m, "Unable to format endpoint %s\n",
1936 endpoint_name);
1937 }
1938
1939 astman_send_list_complete_start(s, m, "EndpointDetailComplete", ami.count + 1);
1941
1942 return 0;
1943}
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
Definition manager.c:2030
void astman_send_error_va(struct mansession *s, const struct message *m, const char *fmt,...)
Send error in manager transaction (with va_args support)
Definition manager.c:1993
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
Definition manager.c:2066
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
Definition manager.c:1649
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
Definition manager.c:2074
static int format_ami_endpoint(const struct ast_sip_endpoint *endpoint, struct ast_sip_ami *ami)
#define AMI_SHOW_ENDPOINT
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
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.
Definition res_pjsip.c:495
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
Definition sorcery.c:1917
AMI variable container.
Definition res_pjsip.h:3225
struct mansession * s
Definition res_pjsip.h:3227
const struct message * m
Definition res_pjsip.h:3229

References AMI_SHOW_ENDPOINT, ao2_cleanup, ast_sip_format_endpoint_ami(), ast_sip_get_sorcery(), ast_sorcery_retrieve_by_id(), ast_strlen_zero(), astman_get_header(), astman_send_error_va(), astman_send_list_complete_end(), astman_send_list_complete_start(), astman_send_listack(), ast_sip_ami::count, format_ami_endpoint(), ast_sip_ami::m, NULL, RAII_VAR, and ast_sip_ami::s.

Referenced by ast_res_pjsip_initialize_configuration().

◆ ami_show_endpoints()

static int ami_show_endpoints ( struct mansession s,
const struct message m 
)
static

Definition at line 1997 of file pjsip_configuration.c.

1998{
1999 struct ast_sip_ami ami = { .s = s, .m = m, .action_id = astman_get_header(m, "ActionID"), };
2001 int num;
2002
2004 if (!endpoints) {
2005 astman_send_error(s, m, "Could not get endpoints\n");
2006 return 0;
2007 }
2008
2009 if (!(num = ao2_container_count(endpoints))) {
2010 astman_send_error(s, m, "No endpoints found\n");
2011 return 0;
2012 }
2013
2014 astman_send_listack(s, m, "A listing of Endpoints follows, presented as EndpointList events",
2015 "start");
2016
2018
2019 astman_send_list_complete_start(s, m, "EndpointListComplete", num);
2021 return 0;
2022}
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
Definition astobj2.h:1693
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
@ OBJ_NODATA
Definition astobj2.h:1044
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
Definition manager.c:1988
static struct ao2_container * endpoints
struct ao2_container * ast_sip_get_endpoints(void)
Retrieve any endpoints available to sorcery.
static int format_ami_endpoints(void *obj, void *arg, int flags)
Generic container type.

References ao2_callback, ao2_cleanup, ao2_container_count(), ast_sip_get_endpoints(), astman_get_header(), astman_send_error(), astman_send_list_complete_end(), astman_send_list_complete_start(), astman_send_listack(), endpoints, format_ami_endpoints(), ast_sip_ami::m, NULL, OBJ_NODATA, RAII_VAR, and ast_sip_ami::s.

Referenced by ast_res_pjsip_initialize_configuration().

◆ ast_res_pjsip_destroy_configuration()

void ast_res_pjsip_destroy_configuration ( void  )

Definition at line 2458 of file pjsip_configuration.c.

2459{
2460 if (!sip_sorcery) {
2461 return;
2462 }
2463
2470 sip_sorcery = NULL;
2478}
void ast_cli_unregister_multiple(void)
Definition ael_main.c:408
int ast_sip_destroy_sorcery_auth(void)
int ast_sip_destroy_sorcery_global(void)
int ast_sip_destroy_sorcery_transport(void)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
Definition manager.c:7704
static struct ast_cli_entry cli_commands[]
struct ast_sip_cli_formatter_entry * endpoint_formatter
static struct stasis_subscription * acl_change_sub
#define AMI_SHOW_ENDPOINTS
static struct ao2_container * persistent_endpoints
Container for persistent endpoint information.
int ast_sip_unregister_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Unregisters a CLI formatter.
Definition pjsip_cli.c:326
void ast_sip_destroy_cli(void)
Definition pjsip_cli.c:375
int ast_sip_destroy_sorcery_location(void)
Definition location.c:1479
#define ast_sorcery_unref(sorcery)
Decrease the reference count of a sorcery structure.
Definition sorcery.h:1500
struct stasis_subscription * stasis_unsubscribe_and_join(struct stasis_subscription *subscription)
Cancel a subscription, blocking until the last message is processed.
Definition stasis.c:1201
#define ARRAY_LEN(a)
Definition utils.h:706

References acl_change_sub, AMI_SHOW_ENDPOINT, AMI_SHOW_ENDPOINTS, ao2_cleanup, ARRAY_LEN, ast_cli_unregister_multiple(), ast_manager_unregister(), ast_sip_destroy_cli(), ast_sip_destroy_sorcery_auth(), ast_sip_destroy_sorcery_global(), ast_sip_destroy_sorcery_location(), ast_sip_destroy_sorcery_transport(), ast_sip_unregister_cli_formatter(), ast_sorcery_unref, cli_commands, endpoint_formatter, NULL, persistent_endpoints, sip_sorcery, and stasis_unsubscribe_and_join().

Referenced by unload_pjsip().

◆ ast_res_pjsip_initialize_configuration()

int ast_res_pjsip_initialize_configuration ( void  )

Definition at line 2201 of file pjsip_configuration.c.

2202{
2205 return -1;
2206 }
2207
2210 if (!persistent_endpoints) {
2211 return -1;
2212 }
2213
2214 if (!(sip_sorcery = ast_sorcery_open())) {
2215 ast_log(LOG_ERROR, "Failed to open SIP sorcery failed to open\n");
2216 return -1;
2217 }
2218
2220
2222 ast_log(LOG_ERROR, "Failed to register SIP authentication support\n");
2224 sip_sorcery = NULL;
2225 return -1;
2226 }
2227
2228 ast_sorcery_apply_default(sip_sorcery, "endpoint", "config", "pjsip.conf,criteria=type=endpoint");
2229 ast_sorcery_apply_default(sip_sorcery, "nat_hook", "memory", NULL);
2230
2232 ast_log(LOG_ERROR, "Failed to register SIP endpoint object with sorcery\n");
2234 sip_sorcery = NULL;
2235 return -1;
2236 }
2237
2239 ast_log(LOG_ERROR, "Failed to register nat_hook\n");
2240 }
2241
2242 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "type", "", OPT_NOOP_T, 0, 0);
2243 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "context", "default", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, context));
2244 ast_sorcery_object_field_register_alias(sip_sorcery, "endpoint", "disallow", "", OPT_CODEC_T, 0, FLDSET(struct ast_sip_endpoint, media.codecs));
2245 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow", "", OPT_CODEC_T, 1, FLDSET(struct ast_sip_endpoint, media.codecs));
2246 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "dtmf_mode", "rfc4733", dtmf_handler, dtmf_to_str, NULL, 0, 0);
2247 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_ipv6", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.ipv6));
2248 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_symmetric", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.symmetric));
2249 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "ice_support", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.ice_support));
2250 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "use_ptime", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.use_ptime));
2251 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "force_rport", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, nat.force_rport));
2252 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rewrite_contact", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, nat.rewrite_contact));
2253 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "transport", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, transport));
2254 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, outbound_proxy));
2255 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "moh_suggest", "default", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, mohsuggest));
2258 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "timers_min_se", "90", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, extensions.timer.min_se));
2259 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "timers_sess_expires", "1800", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, extensions.timer.sess_expires));
2264 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "bind_rtp_to_media_address", "no", OPT_BOOL_T, 1, STRFLDSET(struct ast_sip_endpoint, media.bind_rtp_to_media_address));
2265 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "identify_by", "username,ip", ident_handler, ident_to_str, NULL, 0, 0);
2266 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "direct_media", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.direct_media.enabled));
2268 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_connected_line", "yes", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, id.trust_connected_line));
2269 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_connected_line", "yes", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, id.send_connected_line));
2272 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "disable_direct_media_on_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.direct_media.disable_on_nat));
2274 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "callerid_privacy", "allowed_not_screened", caller_id_privacy_handler, caller_id_privacy_to_str, NULL, 0, 0);
2276 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_inbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.trust_inbound));
2277 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_id_outbound", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.trust_outbound));
2278 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_pai", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.send_pai));
2279 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_rpid", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.send_rpid));
2280 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rpid_immediate", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.rpid_immediate));
2281 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_diversion", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.send_diversion));
2282 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_history_info", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, id.send_history_info));
2283 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mailboxes", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, subscription.mwi.mailboxes));
2285 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "aggregate_mwi", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, subscription.mwi.aggregate));
2286 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mwi_subscribe_replaces_unsolicited", "no", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, subscription.mwi.subscribe_replaces_unsolicited));
2288 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "use_avpf", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.use_avpf));
2289 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "force_avp", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.force_avp));
2290 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "media_use_received_transport", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.use_received_transport));
2291 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_keepalive", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.rtp.keepalive));
2292 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_timeout", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.rtp.timeout));
2293 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_timeout_hold", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.rtp.timeout_hold));
2294 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "one_touch_recording", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, info.recording.enabled));
2295 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "inband_progress", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, inband_progress));
2300 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "device_state_busy_at", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, devicestate_busy_at));
2301 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38_udptl", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.t38.enabled));
2303 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38_udptl_maxdatagram", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.t38.maxdatagram));
2304 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "fax_detect", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, faxdetect));
2305 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "fax_detect_timeout", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, faxdetect_timeout));
2306 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38_udptl_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.t38.nat));
2307 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38_udptl_ipv6", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.t38.ipv6));
2308 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "t38_bind_udptl_to_media_address", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.t38.bind_udptl_to_media_address));
2309 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tone_zone", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, zone));
2311 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "record_on_feature", "automixmon", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, info.recording.onfeature));
2312 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "record_off_feature", "automixmon", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, info.recording.offfeature));
2313 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow_transfer", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allowtransfer));
2314 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "user_eq_phone", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, usereqphone));
2315 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "moh_passthrough", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, moh_passthrough));
2316 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sdp_owner", "-", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, media.sdpowner));
2317 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sdp_session", "Asterisk", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, media.sdpsession));
2320 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_audio", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.cos_audio));
2321 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_video", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.cos_video));
2322 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow_subscribe", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, subscription.allow));
2323 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "sub_min_expiry", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, subscription.minexpiry));
2325 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "from_domain", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, fromdomain));
2326 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mwi_from_user", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, subscription.mwi.fromuser));
2327 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtp_engine", "asterisk", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, media.rtp.engine));
2330 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "dtls_auto_generate_cert", "no", dtls_handler, dtlsautogeneratecert_to_str, NULL, 0, 0);
2338 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "srtp_tag_32", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.srtp_tag_32));
2339 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "media_encryption_optimistic", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.encryption_optimistic));
2340 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "g726_non_standard", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.g726_non_standard));
2344 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "message_context", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, message_context));
2349 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "contact_deny", "", endpoint_acl_handler, NULL, NULL, 0, 0);
2350 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "contact_permit", "", endpoint_acl_handler, NULL, NULL, 0, 0);
2352 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "subscribe_context", "", OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct ast_sip_endpoint, subscription.context));
2354 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "preferred_codec_only", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, preferred_codec_only));
2355 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "asymmetric_rtp_codec", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, asymmetric_rtp_codec));
2356 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "rtcp_mux", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtcp_mux));
2357 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow_overlap", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allow_overlap));
2358 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "overlap_context", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, overlap_context));
2359 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "refer_blind_progress", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, refer_blind_progress));
2360 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "notify_early_inuse_ringing", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, notify_early_inuse_ringing));
2361 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "max_audio_streams", "1", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.max_audio_streams));
2362 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "max_video_streams", "1", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.max_video_streams));
2363 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "bundle", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.bundle));
2364 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "webrtc", "no", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, media.webrtc));
2365 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "incoming_mwi_mailbox", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, incoming_mwi_mailbox));
2366 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "follow_early_media_fork", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.follow_early_media_fork));
2367 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "accept_multiple_sdp_answers", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.rtp.accept_multiple_sdp_answers));
2368 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "suppress_q850_reason_headers", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, suppress_q850_reason_headers));
2369 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "ignore_183_without_sdp", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, ignore_183_without_sdp));
2370 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "incoming_call_offer_pref", "local",
2372 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "outgoing_call_offer_pref", "remote_merge",
2374 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "codec_prefs_incoming_offer",
2375 "prefer: pending, operation: intersect, keep: all, transcode: allow",
2377 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "codec_prefs_outgoing_offer",
2378 "prefer: pending, operation: union, keep: all, transcode: allow",
2380 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "codec_prefs_incoming_answer",
2381 "prefer: pending, operation: intersect, keep: all",
2383 ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "codec_prefs_outgoing_answer",
2384 "prefer: pending, operation: intersect, keep: all",
2387 "stir_shaken", 0, stir_shaken_handler, stir_shaken_to_str, NULL, 0, 0);
2388 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "stir_shaken_profile", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, stir_shaken_profile));
2389 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allow_unauthenticated_options", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, allow_unauthenticated_options));
2390 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "geoloc_incoming_call_profile", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, geoloc_incoming_call_profile));
2391 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "geoloc_outgoing_call_profile", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, geoloc_outgoing_call_profile));
2394 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_aoc", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_aoc));
2395 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "tenantid", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, tenantid));
2396 ast_sorcery_object_field_register(sip_sorcery, "endpoint", "suppress_moh_on_sendonly",
2397 "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, suppress_moh_on_sendonly));
2398
2400 ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
2402 sip_sorcery = NULL;
2403 return -1;
2404 }
2405
2407 ast_log(LOG_ERROR, "Failed to register SIP location support with sorcery\n");
2409 sip_sorcery = NULL;
2410 return -1;
2411 }
2412
2414
2416 ast_log(LOG_ERROR, "Failed to register SIP domain aliases support with sorcery\n");
2418 sip_sorcery = NULL;
2419 return -1;
2420 }
2421
2423 ast_log(LOG_ERROR, "Failed to register SIP Global support\n");
2425 sip_sorcery = NULL;
2426 return -1;
2427 }
2428
2430 if (!endpoint_formatter) {
2431 ast_log(LOG_ERROR, "Unable to allocate memory for endpoint_formatter\n");
2433 sip_sorcery = NULL;
2434 return -1;
2435 }
2436 endpoint_formatter->name = "endpoint";
2443
2446
2448
2450
2454
2455 return 0;
2456}
#define ast_log
Definition astobj2.c:42
@ AO2_ALLOC_OPT_LOCK_MUTEX
Definition astobj2.h:363
#define ao2_alloc(data_size, destructor_fn)
Definition astobj2.h:409
#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.
Definition astobj2.h:1303
static char language[MAX_LANGUAGE]
Definition chan_iax2.c:348
static char accountcode[AST_MAX_ACCOUNT_CODE]
Definition chan_iax2.c:497
static char mohsuggest[MAX_MUSICCLASS]
Definition chan_iax2.c:499
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition cli.h:265
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_initialize_sorcery_global(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.
#define LOG_ERROR
#define EVENT_FLAG_SYSTEM
Definition manager.h:75
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
Definition manager.h:193
static int tos_video_to_str(const void *obj, const intptr_t *args, char **buf)
static int follow_redirect_methods_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int t38udptl_ec_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)
static int outgoing_answer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
static int codec_prefs_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static void load_all_endpoints(void)
static int from_user_to_str(const void *obj, const intptr_t *args, char **buf)
static void * sip_nat_hook_alloc(const char *name)
static int prack_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int set_var_to_vl(const void *obj, struct ast_variable **fields)
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 int incoming_offer_codec_prefs_to_str(const void *obj, const intptr_t *args, char **buf)
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 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 int follow_redirect_methods_to_str(const void *obj, const intptr_t *args, char **buf)
static int redirect_method_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
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 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 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)
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)
static int named_callgroups_to_str(const void *obj, const intptr_t *args, char **buf)
static int security_negotiation_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
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)
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 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)
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 cli_endpoint_print_header(void *obj, void *arg, int flags)
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 redirect_method_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)
static int outbound_auths_to_str(const void *obj, const intptr_t *args, char **buf)
static int sip_endpoint_apply_handler(const struct ast_sorcery *sorcery, void *obj)
Callback function for when an object is finalized.
static int connected_line_method_to_str(const void *obj, const intptr_t *args, char **buf)
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)
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)
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 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)
static int security_negotiation_to_str(const void *obj, const intptr_t *args, char **buf)
static int direct_media_glare_mitigation_to_str(const void *obj, const intptr_t *args, char **buf)
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)
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 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 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 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)
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 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 int timers_to_str(const void *obj, const intptr_t *args, char **buf)
int ast_sip_register_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Registers a CLI formatter.
Definition pjsip_cli.c:310
int ast_sip_initialize_sorcery_location(void)
Initialize sorcery with location support.
Definition location.c:1375
int ast_sip_initialize_cli(void)
Definition pjsip_cli.c:360
struct stasis_topic * ast_security_topic(void)
A stasis_topic which publishes messages for security related issues.
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
Definition sorcery.c:2381
void ast_sorcery_load(const struct ast_sorcery *sorcery)
Inform any wizards to load persistent objects.
Definition sorcery.c:1441
#define ast_sorcery_object_field_register_alias(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object as an alias.
Definition sorcery.h:971
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
Definition sorcery.h:837
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.
Definition sorcery.c:2455
#define ast_sorcery_internal_object_register(sorcery, type, alloc, transform, apply)
Register an internal, hidden object type.
Definition sorcery.h:867
#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.
Definition sorcery.h:1005
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
Definition sorcery.h:955
#define ast_sorcery_apply_default(sorcery, type, name, data)
Definition sorcery.h:476
#define ast_sorcery_open()
Open a new sorcery structure.
Definition sorcery.h:406
@ STASIS_SUBSCRIPTION_FILTER_SELECTIVE
Definition stasis.h:297
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.
Definition stasis.c:1090
int stasis_subscription_set_filter(struct stasis_subscription *subscription, enum stasis_subscription_message_filter filter)
Set the message type filtering level on a subscription.
Definition stasis.c:1144
#define stasis_subscribe(topic, callback, data)
Definition stasis.h:649
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)
const char * name
ao2_callback_fn * print_body
struct ao2_container *(* get_container)(const char *regex)
const ast_string_field context
Definition res_pjsip.h:1090
const ast_string_field fromuser
Definition res_pjsip.h:1090
struct ast_sip_endpoint_nat_configuration nat
Definition res_pjsip.h:1098

References accountcode, acl_change_stasis_cb(), acl_change_sub, acl_to_str(), AMI_SHOW_ENDPOINT, ami_show_endpoint(), AMI_SHOW_ENDPOINTS, ami_show_endpoints(), ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_manager_register_xml, ast_named_acl_change_type(), ast_security_topic(), ast_sip_endpoint_alloc(), ast_sip_initialize_cli(), ast_sip_initialize_sorcery_auth(), ast_sip_initialize_sorcery_domain_alias(), ast_sip_initialize_sorcery_global(), ast_sip_initialize_sorcery_location(), ast_sip_initialize_sorcery_transport(), ast_sip_register_cli_formatter(), ast_sorcery_apply_default, ast_sorcery_internal_object_register, ast_sorcery_load(), ast_sorcery_object_field_register, ast_sorcery_object_field_register_alias, ast_sorcery_object_field_register_custom, ast_sorcery_object_get_id(), ast_sorcery_object_register, ast_sorcery_observer_add(), ast_sorcery_open, ast_sorcery_unref, call_offer_pref_handler(), caller_id_handler(), caller_id_privacy_handler(), caller_id_privacy_to_str(), caller_id_tag_handler(), caller_id_tag_to_str(), caller_id_to_str(), callgroup_to_str(), CHARFLDSET, cli_commands, cli_endpoint_get_container(), cli_endpoint_iterate(), cli_endpoint_print_body(), cli_endpoint_print_header(), cli_endpoint_retrieve_by_id(), codec_prefs_handler(), connected_line_method_handler(), connected_line_method_to_str(), contact_acl_to_str(), contact_user_handler(), contact_user_to_str(), ast_sip_endpoint::context, direct_media_glare_mitigation_handler(), direct_media_glare_mitigation_to_str(), direct_media_method_handler(), direct_media_method_to_str(), dtls_handler(), dtlsautogeneratecert_to_str(), dtlscafile_to_str(), dtlscapath_to_str(), dtlscertfile_to_str(), dtlscipher_to_str(), dtlsfingerprint_to_str(), dtlsprivatekey_to_str(), dtlsrekey_to_str(), dtlssetup_to_str(), dtlsverify_to_str(), dtmf_handler(), dtmf_to_str(), endpoint_acl_handler(), endpoint_formatter, endpoint_observers, EVENT_FLAG_SYSTEM, FLDSET, follow_redirect_methods_handler(), follow_redirect_methods_to_str(), from_user_handler(), from_user_to_str(), ast_sip_endpoint::fromuser, ast_sip_cli_formatter_entry::get_container, ast_sip_cli_formatter_entry::get_id, group_handler(), ident_handler(), ident_to_str(), inbound_auth_handler(), inbound_auths_to_str(), incoming_answer_codec_prefs_to_str(), incoming_call_offer_pref_to_str(), incoming_offer_codec_prefs_to_str(), ast_sip_cli_formatter_entry::iterate, language, load_all_endpoints(), LOG_ERROR, media_address_handler(), media_address_to_str(), media_encryption_handler(), media_encryption_to_str(), mohsuggest, ast_sip_cli_formatter_entry::name, named_callgroups_to_str(), named_groups_handler(), named_pickupgroups_to_str(), ast_sip_endpoint::nat, NULL, OPT_BOOL_T, OPT_CHAR_ARRAY_T, OPT_CODEC_T, OPT_NOOP_T, OPT_STRINGFIELD_T, OPT_UINT_T, OPT_YESNO_T, outbound_auth_handler(), outbound_auths_to_str(), outgoing_answer_codec_prefs_to_str(), outgoing_call_offer_pref_to_str(), outgoing_offer_codec_prefs_to_str(), PERSISTENT_BUCKETS, persistent_endpoint_cmp(), persistent_endpoint_hash(), persistent_endpoints, pickupgroup_to_str(), prack_handler(), prack_to_str(), ast_sip_cli_formatter_entry::print_body, ast_sip_cli_formatter_entry::print_header, redirect_method_handler(), redirect_method_to_str(), ast_sip_cli_formatter_entry::retrieve_by_id, security_mechanism_handler(), security_mechanism_to_str(), security_negotiation_handler(), security_negotiation_to_str(), set_var_handler(), set_var_to_str(), set_var_to_vl(), sip_endpoint_apply_handler(), sip_nat_hook_alloc(), sip_sorcery, stasis_subscribe, stasis_subscription_accept_message_type(), STASIS_SUBSCRIPTION_FILTER_SELECTIVE, stasis_subscription_set_filter(), stir_shaken_handler(), stir_shaken_to_str(), STRFLDSET, t38udptl_ec_handler(), t38udptl_ec_to_str(), timers_handler(), timers_to_str(), tos_audio_to_str(), tos_handler(), tos_video_to_str(), voicemail_extension_handler(), and voicemail_extension_to_str().

Referenced by load_module().

◆ ast_res_pjsip_reload_configuration()

int ast_res_pjsip_reload_configuration ( void  )

Definition at line 2480 of file pjsip_configuration.c.

2481{
2482 if (sip_sorcery) {
2484 }
2485 return 0;
2486}
void ast_sorcery_reload(const struct ast_sorcery *sorcery)
Inform any wizards to reload persistent objects.
Definition sorcery.c:1472

References ast_sorcery_reload(), and sip_sorcery.

Referenced by reload_configuration_task().

◆ ast_sip_auth_vector_destroy()

void ast_sip_auth_vector_destroy ( struct ast_sip_auth_vector vector)

Free contents of an auth vector.

Parameters
vectorVector whose contents are to be freed

Definition at line 306 of file pjsip_configuration.c.

307{
308 int i;
309 size_t size;
310
311 if (!auths) {
312 return;
313 }
314
315 size = AST_VECTOR_SIZE(auths);
316
317 for (i = 0; i < size; ++i) {
318 const char *name = AST_VECTOR_REMOVE_UNORDERED(auths, 0);
319 ast_free((char *) name);
320 }
321 AST_VECTOR_FREE(auths);
322}
#define ast_free(a)
Definition astmm.h:180
static const char name[]
Definition format_mp3.c:68
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
Definition vector.h:620
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
Definition vector.h:185
#define AST_VECTOR_REMOVE_UNORDERED(vec, idx)
Remove an element from an unordered vector by index.
Definition vector.h:449

References ast_free, AST_VECTOR_FREE, AST_VECTOR_REMOVE_UNORDERED, AST_VECTOR_SIZE, and name.

Referenced by ast_sip_auth_vector_init(), endpoint_destructor(), handle_client_state_destruction(), sip_outbound_publish_destroy(), sip_outbound_registration_destroy(), and sip_outbound_registration_perform().

◆ ast_sip_auth_vector_init()

int ast_sip_auth_vector_init ( struct ast_sip_auth_vector vector,
const char *  auth_names 
)

Initialize an auth vector with the configured values.

Parameters
vectorVector to initialize
auth_namesComma-separated list of names to set in the array
Return values
0Success
non-zeroFailure

Definition at line 324 of file pjsip_configuration.c.

325{
326 char *auth_names = ast_strdupa(value);
327 char *val;
328
329 ast_assert(auths != NULL);
330
331 if (AST_VECTOR_SIZE(auths)) {
333 }
334 if (AST_VECTOR_INIT(auths, 1)) {
335 return -1;
336 }
337
338 while ((val = ast_strip(strsep(&auth_names, ",")))) {
339 if (ast_strlen_zero(val)) {
340 continue;
341 }
342
343 val = ast_strdup(val);
344 if (!val) {
345 goto failure;
346 }
347 if (AST_VECTOR_APPEND(auths, val)) {
348 ast_free(val);
349
350 goto failure;
351 }
352 }
353 return 0;
354
355failure:
357 return -1;
358}
char * strsep(char **str, const char *delims)
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition astmm.h:298
void ast_sip_auth_vector_destroy(struct ast_sip_auth_vector *auths)
Free contents of an auth vector.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
Definition strings.h:223
int value
Definition syslog.c:37
#define ast_assert(a)
Definition utils.h:779
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
Definition vector.h:124
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
Definition vector.h:267

References ast_assert, ast_free, ast_sip_auth_vector_destroy(), ast_strdup, ast_strdupa, ast_strip(), ast_strlen_zero(), AST_VECTOR_APPEND, AST_VECTOR_INIT, AST_VECTOR_SIZE, NULL, strsep(), and value.

Referenced by inbound_auth_handler(), outbound_auth_handler(), outbound_auth_handler(), and outbound_auth_handler().

◆ ast_sip_auths_to_str()

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.

Parameters
authsan auth array
bufthe string buffer to write the object data
Return values
0Success, non-zero on failure

Definition at line 374 of file pjsip_configuration.c.

375{
376 if (!auths || !AST_VECTOR_SIZE(auths)) {
377 return 0;
378 }
379
380 if (!(*buf = ast_calloc(MAX_OBJECT_FIELD, sizeof(char)))) {
381 return -1;
382 }
383
384 /* I feel like accessing the vector's elem array directly is cheating...*/
386 return 0;
387}
#define ast_calloc(num, len)
A wrapper for calloc()
Definition astmm.h:202
#define MAX_OBJECT_FIELD
Maximum length of an object field name.
Definition sorcery.h:110
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.
Definition utils.c:2412
const char ** elems
Definition res_pjsip.h:694

References ast_calloc, ast_join_delim(), AST_VECTOR_SIZE, buf, ast_sip_auth_vector::elems, and MAX_OBJECT_FIELD.

Referenced by format_str_append_auth(), inbound_auths_to_str(), outbound_auths_to_str(), and outbound_auths_to_str().

◆ ast_sip_cleanup_auths()

void ast_sip_cleanup_auths ( struct ast_sip_auth auths[],
size_t  num_auths 
)

Clean up retrieved auth structures from memory.

Call this function once you have completed operating on auths retrieved from ast_sip_retrieve_auths

Parameters
authsAn array of auth object pointers to clean up
num_authsThe number of auths in the array

Definition at line 2631 of file pjsip_configuration.c.

2632{
2633 int i;
2634 for (i = 0; i < num_auths; ++i) {
2635 ao2_cleanup(auths[i]);
2636 }
2637}

References ao2_cleanup.

Referenced by digest_check_auth(), and set_outbound_initial_authentication_credentials().

◆ ast_sip_create_ami_event()

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.

Parameters
eventthe event to set
amiAMI session and message container
Return values
aninitialized ast_str or NULL on error.

Definition at line 1812 of file pjsip_configuration.c.

1813{
1815
1816 if (!(buf)) {
1817 astman_send_error_va(ami->s, ami->m, "Unable create event "
1818 "for %s\n", event);
1819 return NULL;
1820 }
1821
1822 ast_str_set(&buf, 0, "Event: %s\r\n", event);
1823 if (!ast_strlen_zero(ami->action_id)) {
1824 ast_str_append(&buf, 0, "ActionID: %s\r\n", ami->action_id);
1825 }
1826 return buf;
1827}
#define AMI_DEFAULT_STR_SIZE
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
Definition strings.h:659
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
Definition strings.h:1113
const char * action_id
Definition res_pjsip.h:3231
Support for dynamic strings.
Definition strings.h:623

References ast_sip_ami::action_id, AMI_DEFAULT_STR_SIZE, ast_str_append(), ast_str_create, ast_str_set(), ast_strlen_zero(), astman_send_error_va(), buf, ast_sip_ami::m, NULL, and ast_sip_ami::s.

Referenced by ami_outbound_registration_task(), ami_registrations_aor(), ami_subscription_detail(), ast_sip_format_contact_ami(), format_ami_aor_handler(), format_ami_aorlist_handler(), format_ami_auth_handler(), format_ami_authlist_handler(), format_ami_contactlist_handler(), format_ami_endpoint(), format_ami_endpoint_transport(), format_ami_endpoints(), format_ami_resource_lists(), and send_identify_ami_event().

◆ ast_sip_default_outbound_endpoint()

struct ast_sip_endpoint * ast_sip_default_outbound_endpoint ( void  )

Retrieve the default outbound endpoint.

Return values
Thedefault outbound endpoint, NULL if not found.

Definition at line 2607 of file pjsip_configuration.c.

2608{
2611 sip_sorcery, "endpoint", name);
2612}
char * ast_sip_global_default_outbound_endpoint(void)

References ast_free, ast_sip_global_default_outbound_endpoint(), ast_sorcery_retrieve_by_id(), ast_strlen_zero(), name, NULL, RAII_VAR, and sip_sorcery.

Referenced by ast_sip_get_endpoint(), handle_atsign(), handle_single_token(), and notify_uri().

◆ ast_sip_endpoint_alloc()

void * ast_sip_endpoint_alloc ( const char *  name)

Allocate a new SIP endpoint.

This will return an endpoint with its refcount increased by one. This reference can be released using ao2_ref().

Parameters
nameThe name of the endpoint.
Return values
NULLEndpoint allocation failed
non-NULLThe newly allocated endpoint

Definition at line 2546 of file pjsip_configuration.c.

2547{
2548 struct ast_sip_endpoint *endpoint = ast_sorcery_generic_alloc(sizeof(*endpoint), endpoint_destructor);
2549 if (!endpoint) {
2550 return NULL;
2551 }
2552 if (ast_string_field_init(endpoint, 128)) {
2553 ao2_cleanup(endpoint);
2554 return NULL;
2555 }
2556
2557 if (ast_string_field_init_extended(endpoint, geoloc_incoming_call_profile) ||
2558 ast_string_field_init_extended(endpoint, geoloc_outgoing_call_profile)) {
2559 ao2_cleanup(endpoint);
2560 return NULL;
2561 }
2562 if (ast_string_field_init_extended(endpoint, overlap_context)) {
2563 ao2_cleanup(endpoint);
2564 return NULL;
2565 }
2566 if (ast_string_field_init_extended(endpoint, tenantid)) {
2567 ao2_cleanup(endpoint);
2568 return NULL;
2569 }
2570
2572 ao2_cleanup(endpoint);
2573 return NULL;
2574 }
2576 ao2_cleanup(endpoint);
2577 return NULL;
2578 }
2579 if (init_info_configuration(&endpoint->info)) {
2580 ao2_cleanup(endpoint);
2581 return NULL;
2582 }
2583 if (init_media_configuration(&endpoint->media)) {
2584 ao2_cleanup(endpoint);
2585 return NULL;
2586 }
2587
2588 ast_party_id_init(&endpoint->id.self);
2589 endpoint->id.self.tag = ast_strdup("");
2590
2591 if (AST_VECTOR_INIT(&endpoint->ident_method_order, 1)) {
2592 return NULL;
2593 }
2594
2595 return endpoint;
2596}
void ast_party_id_init(struct ast_party_id *init)
Initialize the given party id structure.
Definition channel.c:1744
@ AST_FORMAT_CAP_FLAG_DEFAULT
Definition format_cap.h:38
#define ast_format_cap_alloc(flags)
Allocate a new ast_format_cap structure.
Definition format_cap.h:49
static int init_info_configuration(struct ast_sip_endpoint_info_configuration *info)
static int init_media_configuration(struct ast_sip_endpoint_media_configuration *media)
static int init_subscription_configuration(struct ast_sip_endpoint_subscription_configuration *subscription)
static void endpoint_destructor(void *obj)
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
Definition sorcery.c:1792
#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.
char * tag
User-set "tag".
Definition channel.h:356
struct ast_format_cap * codecs
Definition res_pjsip.h:1019
struct ast_sip_endpoint_id_configuration id
Definition res_pjsip.h:1100
struct ast_sip_identify_by_vector ident_method_order
Definition res_pjsip.h:1114
struct ast_sip_endpoint_media_configuration media
Definition res_pjsip.h:1094
struct ast_sip_endpoint_subscription_configuration subscription
Definition res_pjsip.h:1096
struct ast_sip_endpoint_info_configuration info
Definition res_pjsip.h:1102

References ao2_cleanup, ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_party_id_init(), ast_sorcery_generic_alloc(), ast_strdup, ast_string_field_init, ast_string_field_init_extended, AST_VECTOR_INIT, ast_sip_endpoint_media_configuration::codecs, endpoint_destructor(), ast_sip_endpoint::id, ast_sip_endpoint::ident_method_order, ast_sip_endpoint::info, init_info_configuration(), init_media_configuration(), init_subscription_configuration(), ast_sip_endpoint::media, NULL, ast_sip_endpoint_id_configuration::self, ast_sip_endpoint::subscription, and ast_party_id::tag.

Referenced by ast_res_pjsip_initialize_configuration().

◆ ast_sip_for_each_channel()

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.

Parameters
endpointendpoint
on_channel_snapshotcallback for each channel snapshot
arguser data passed to handler
Return values
0Success, non-zero on failure

Definition at line 1791 of file pjsip_configuration.c.

1794{
1795 RAII_VAR(struct ast_endpoint_snapshot *, endpoint_snapshot, ast_sip_get_endpoint_snapshot(endpoint), ao2_cleanup);
1796 return ast_sip_for_each_channel_snapshot(endpoint_snapshot, on_channel_snapshot, arg);
1797}
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.

References ao2_cleanup, ast_sip_for_each_channel_snapshot(), ast_sip_get_endpoint_snapshot(), and RAII_VAR.

Referenced by cli_channel_iterate(), and cli_channelstats_iterate().

◆ ast_sip_for_each_channel_snapshot()

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.

Parameters
endpoint_snapshotsnapshot of an endpoint
on_channel_snapshotcallback for each channel snapshot
arguser data passed to handler
Return values
0Success, non-zero on failure

Definition at line 1764 of file pjsip_configuration.c.

1767{
1768 int num, num_channels = endpoint_snapshot->num_channels;
1769
1770 if (!on_channel_snapshot || !num_channels) {
1771 return 0;
1772 }
1773
1774 for (num = 0; num < num_channels; ++num) {
1775 RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
1776 int res;
1777
1778 snapshot = ast_channel_snapshot_get_latest(endpoint_snapshot->channel_ids[num]);
1779 if (!snapshot) {
1780 continue;
1781 }
1782
1783 res = on_channel_snapshot(snapshot, arg, 0);
1784 if (res) {
1785 return -1;
1786 }
1787 }
1788 return 0;
1789}
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,...
Structure representing a snapshot of channel state.

References ao2_cleanup, ast_channel_snapshot_get_latest(), ast_endpoint_snapshot::channel_ids, NULL, ast_endpoint_snapshot::num_channels, and RAII_VAR.

Referenced by ast_sip_for_each_channel().

◆ ast_sip_get_device_state()

const char * ast_sip_get_device_state ( const struct ast_sip_endpoint endpoint)

Retrieve the device state for an endpoint.

Parameters
endpointThe endpoint whose state is to be retrieved.
Return values
Thedevice state.

Definition at line 1748 of file pjsip_configuration.c.

1749{
1750 char device[MAX_OBJECT_FIELD];
1751
1752 snprintf(device, MAX_OBJECT_FIELD, "PJSIP/%s", ast_sorcery_object_get_id(endpoint));
1753 return ast_devstate2str(ast_device_state(device));
1754}
const char * ast_devstate2str(enum ast_device_state devstate) attribute_pure
Convert device state to text string for output.
ast_device_state
Device States.
Definition devicestate.h:52

References ast_devstate2str(), ast_sorcery_object_get_id(), and MAX_OBJECT_FIELD.

Referenced by cli_endpoint_print_body(), format_ami_endpoints(), and sip_endpoint_to_ami().

◆ ast_sip_get_endpoint_snapshot()

struct ast_endpoint_snapshot * ast_sip_get_endpoint_snapshot ( const struct ast_sip_endpoint endpoint)

Retrieve the endpoint snapshot for an endpoint.

Parameters
endpointThe endpoint whose snapshot is to be retrieved.
Return values
Theendpoint snapshot

Definition at line 1756 of file pjsip_configuration.c.

1758{
1762}
const char * ast_endpoint_get_tech(const struct ast_endpoint *endpoint)
Gets the technology of the given endpoint.
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 ast_endpoint * persistent
Definition res_pjsip.h:1118

References ast_endpoint_get_resource(), ast_endpoint_get_tech(), ast_endpoint_latest_snapshot(), and ast_sip_endpoint::persistent.

Referenced by active_channels_to_str(), ast_sip_for_each_channel(), and cli_endpoint_print_body().

◆ ast_sip_get_endpoints()

struct ao2_container * ast_sip_get_endpoints ( void  )

Retrieve any endpoints available to sorcery.

Return values
Endpointsavailable to sorcery, NULL if no endpoints found.

Definition at line 2598 of file pjsip_configuration.c.

2599{
2600 struct ao2_container *endpoints;
2601
2603
2604 return endpoints;
2605}
@ AST_RETRIEVE_FLAG_MULTIPLE
Return all matching objects.
Definition sorcery.h:120
@ AST_RETRIEVE_FLAG_ALL
Perform no matching, return all objects.
Definition sorcery.h:123
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.
Definition sorcery.c:1961

References AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_retrieve_by_fields(), endpoints, NULL, and sip_sorcery.

Referenced by ami_registrations_endpoints(), ami_show_endpoints(), and load_module().

◆ ast_sip_get_sorcery()

struct ast_sorcery * ast_sip_get_sorcery ( void  )

Get a pointer to the SIP sorcery structure.

Return values
NULLsorcery has not been initialized
non-NULLsorcery structure

Definition at line 2658 of file pjsip_configuration.c.

2659{
2660 return sip_sorcery;
2661}

References sip_sorcery.

Referenced by acl_change_stasis_cb(), acl_change_stasis_cb(), acl_on_rx_msg(), add_security_headers(), alloc_artificial_auth(), ami_show_endpoint(), ami_show_registration_contact_statuses(), ami_show_resource_lists(), ami_sip_qualify(), anonymous_identify(), aor_deleted_observer(), ast_res_pjsip_cleanup_options_handling(), ast_sip_cli_print_sorcery_objectset(), ast_sip_destroy_distributor(), ast_sip_destroy_sorcery_auth(), ast_sip_destroy_sorcery_global(), ast_sip_destroy_sorcery_location(), ast_sip_destroy_transport_management(), ast_sip_for_each_auth(), ast_sip_initialize_distributor(), ast_sip_initialize_sorcery_auth(), ast_sip_initialize_sorcery_domain_alias(), ast_sip_initialize_sorcery_global(), ast_sip_initialize_sorcery_location(), ast_sip_initialize_sorcery_transport(), ast_sip_initialize_transport_management(), ast_sip_location_create_contact(), ast_sip_location_delete_contact(), ast_sip_location_prune_boot_contacts(), ast_sip_location_retrieve_aor(), ast_sip_location_retrieve_aor_contacts_nolock_filtered(), ast_sip_location_retrieve_contact(), ast_sip_location_update_contact(), ast_sip_retrieve_auths(), ast_sip_retrieve_auths_vector(), ast_sip_rewrite_uri_to_local(), ast_sip_set_tpselector_from_transport_name(), ast_sip_sorcery_object_to_ami(), asterisk_publication_devicestate_state_change(), asterisk_publication_mwi_state_change(), asterisk_publication_new(), asterisk_publication_send_refresh(), auth_observer(), can_reuse_registration(), chan_pjsip_devicestate(), check_expiration_thread(), check_state(), cli_aor_get_container(), cli_aor_retrieve_by_id(), cli_complete_endpoint(), cli_complete_registration(), cli_contact_get_container(), cli_endpoint_retrieve_by_id(), cli_get_aors(), cli_get_auths(), cli_get_container(), cli_get_container(), cli_get_container(), cli_get_container(), cli_iterate(), cli_iterator(), cli_qualify(), cli_reload_qualify_aor(), cli_reload_qualify_endpoint(), cli_retrieve_by_id(), cli_retrieve_by_id(), cli_retrieve_by_id(), cli_retrieve_by_id(), cli_show_qualify_endpoint(), common_identify(), contact_observer_updated(), create_artificial_endpoint(), create_mwi_subscriptions(), create_rtp(), find_aor2(), find_aor_name(), find_endpoint(), format_ami_endpoint_identify(), format_ami_endpoint_transport(), get_all_contacts(), get_publishes_and_update_state(), get_registrations(), get_write_timeout(), global_loaded(), handle_atsign(), handle_export_primitives(), handle_registration_response(), handle_single_token(), handle_slash(), line_identify(), load_module(), load_module(), load_module(), load_module(), load_module(), load_module(), load_module(), load_module(), load_module(), load_module(), load_module(), load_module(), load_module(), mwi_contact_changed(), mwi_contact_deleted(), mwi_subscription_shutdown(), on_rx_process_symmetric_transport(), permanent_uri_handler(), pjsip_acf_dial_contacts_read(), pjsip_aor_function_read(), pjsip_contact_function_read(), pjsip_endpoint_function_read(), pjsip_outbound_registration_metrics_init(), pjsip_outbound_registration_metrics_unload_cb(), process_nat(), publish_request_initial(), push_notify(), register_aor_core(), reload_module(), reload_module(), reload_module(), reload_module(), reload_module(), request(), reregister_all(), retrieve_resource_list(), send_unsolicited_mwi_notify(), sip_aor_to_ami(), sip_cli_print_global(), sip_options_aor_observer_modified_task(), sip_options_apply_aor_configuration(), sip_options_contact_add_management_task(), sip_options_init_task(), sip_options_qualify_contact(), sip_options_synchronize_task(), sub_persistence_recreate(), subscription_persistence_create(), subscription_persistence_load(), subscription_persistence_recreate(), subscription_persistence_remove(), subscription_persistence_update(), t38_initialize_session(), transfer(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), unload_module(), and unload_module().

◆ ast_sip_persistent_endpoint_add_to_regcontext()

int ast_sip_persistent_endpoint_add_to_regcontext ( const char *  regcontext)

Definition at line 1504 of file pjsip_configuration.c.

1505{
1507 return 0;
1508 }
1509
1510 /* Make sure the regcontext exists */
1512 ast_log(LOG_ERROR, "Failed to create regcontext '%s'\n", regcontext);
1513 return -1;
1514 }
1515
1516 /* Add any online endpoints */
1518 return 0;
1519}
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.
Definition pbx.c:6185
static int add_to_regcontext(void *obj, void *arg, int flags)

References add_to_regcontext(), ao2_callback, ast_context_find_or_create(), ast_log, ast_strlen_zero(), LOG_ERROR, NULL, OBJ_NODATA, persistent_endpoints, and regcontext.

Referenced by check_regcontext().

◆ ast_sip_persistent_endpoint_publish_contact_state()

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.

Parameters
endpoint_nameThe SIP endpoint name.
contact_statusThe contact status.

Definition at line 1578 of file pjsip_configuration.c.

1579{
1580 struct sip_persistent_endpoint *persistent;
1581 struct ast_json *blob;
1582 char rtt[32];
1583
1584 persistent = ao2_find(persistent_endpoints, endpoint_name, OBJ_SEARCH_KEY);
1585 if (!persistent) {
1586 return;
1587 }
1588
1589 snprintf(rtt, sizeof(rtt), "%" PRId64, contact_status->rtt);
1590 blob = ast_json_pack("{s: s, s: s, s: s, s: s, s: s}",
1591 "contact_status", ast_sip_get_contact_status_label(contact_status->status),
1592 "aor", contact_status->aor,
1593 "uri", contact_status->uri,
1594 "roundtrip_usec", rtt,
1595 "endpoint_name", ast_endpoint_get_resource(persistent->endpoint));
1596 if (blob) {
1598 ast_json_unref(blob);
1599 }
1600
1601 ao2_ref(persistent, -1);
1602}
#define ao2_find(container, arg, flags)
Definition astobj2.h:1736
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition astobj2.h:459
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
Definition astobj2.h:1101
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.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
Definition json.c:73
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
Definition json.c:612
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.
Abstract JSON element (object, array, string, int, ...).
const ast_string_field uri
Definition res_pjsip.h:457
enum ast_sip_contact_status_type status
Definition res_pjsip.h:468
const ast_string_field aor
Definition res_pjsip.h:457

References ao2_find, ao2_ref, ast_sip_contact_status::aor, ast_endpoint_blob_publish(), ast_endpoint_contact_state_type(), ast_endpoint_get_resource(), ast_json_pack(), ast_json_unref(), ast_sip_get_contact_status_label(), sip_persistent_endpoint::endpoint, OBJ_SEARCH_KEY, persistent_endpoints, ast_sip_contact_status::rtt, ast_sip_contact_status::status, and ast_sip_contact_status::uri.

Referenced by sip_options_publish_contact_state().

◆ ast_sip_persistent_endpoint_update_state()

int ast_sip_persistent_endpoint_update_state ( const char *  endpoint_name,
enum ast_endpoint_state  state 
)

Change state of a persistent endpoint.

Parameters
endpoint_nameThe SIP endpoint name to change state.
stateThe new state
Return values
0Success
-1Endpoint not found

Definition at line 1521 of file pjsip_configuration.c.

1522{
1523 struct sip_persistent_endpoint *persistent;
1524 struct ast_json *blob;
1525 char *regcontext;
1526
1527 persistent = ao2_find(persistent_endpoints, endpoint_name, OBJ_SEARCH_KEY);
1528 if (!persistent) {
1529 return -1;
1530 }
1531
1532 /* If there was no state change, don't publish anything. */
1533 if (ast_endpoint_get_state(persistent->endpoint) == state) {
1534 ao2_ref(persistent, -1);
1535 return 0;
1536 }
1537
1539
1540 if (state == AST_ENDPOINT_ONLINE) {
1542 blob = ast_json_pack("{s: s}", "peer_status", "Reachable");
1543
1547 "Noop", ast_strdup(ast_endpoint_get_resource(persistent->endpoint)), ast_free_ptr, "PJSIP");
1548 }
1549 }
1550
1551 ast_verb(2, "Endpoint %s is now Reachable\n", ast_endpoint_get_resource(persistent->endpoint));
1552 } else {
1554 blob = ast_json_pack("{s: s}", "peer_status", "Unreachable");
1555
1557 struct pbx_find_info q = { .stacklen = 0 };
1558
1561 }
1562 }
1563
1564 ast_verb(2, "Endpoint %s is now Unreachable\n", ast_endpoint_get_resource(persistent->endpoint));
1565 }
1566
1568
1570 ast_json_unref(blob);
1572
1573 ao2_ref(persistent, -1);
1574
1575 return 0;
1576}
@ AST_DEVSTATE_CACHABLE
Definition devicestate.h:70
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.
@ AST_DEVICE_UNKNOWN
Definition devicestate.h:53
@ AST_ENDPOINT_OFFLINE
Definition endpoints.h:55
void ast_endpoint_set_state(struct ast_endpoint *endpoint, enum ast_endpoint_state state)
Updates the state of the given endpoint.
@ E_MATCH
Definition extconf.h:217
struct stasis_message_type * ast_endpoint_state_type(void)
Message type for endpoint state changes.
#define ast_verb(level,...)
int ast_context_remove_extension(const char *context, const char *extension, int priority, const char *registrar)
Simply remove extension from context.
Definition pbx.c:4984
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)
Definition ael_main.c:152
char * ast_sip_get_regcontext(void)
Retrieve the global regcontext setting.

References ao2_find, ao2_ref, ast_add_extension(), ast_context_remove_extension(), AST_DEVICE_UNKNOWN, AST_DEVSTATE_CACHABLE, ast_devstate_changed(), ast_endpoint_blob_publish(), ast_endpoint_get_resource(), ast_endpoint_get_state(), AST_ENDPOINT_OFFLINE, AST_ENDPOINT_ONLINE, ast_endpoint_set_state(), ast_endpoint_state_type(), ast_exists_extension(), ast_free, ast_free_ptr(), ast_json_pack(), ast_json_unref(), ast_sip_get_regcontext(), ast_strdup, ast_strlen_zero(), ast_verb, E_MATCH, sip_persistent_endpoint::endpoint, NULL, OBJ_SEARCH_KEY, pbx_find_extension(), persistent_endpoints, regcontext, and pbx_find_info::stacklen.

Referenced by sip_options_synchronize_endpoint(), sip_options_unused_endpoint_state_compositor(), and sip_options_update_endpoint_state_compositor_aor().

◆ ast_sip_retrieve_auths()

int ast_sip_retrieve_auths ( const struct ast_sip_auth_vector auths,
struct ast_sip_auth **  out 
)

Retrieve relevant SIP auth structures from sorcery.

Parameters
authsVector of sorcery IDs of auth credentials to retrieve
[out]outThe retrieved auths are stored here

Definition at line 2614 of file pjsip_configuration.c.

2615{
2616 int i;
2617
2618 for (i = 0; i < AST_VECTOR_SIZE(auths); ++i) {
2619 /* Using AST_VECTOR_GET is safe since the vector is immutable */
2620 const char *name = AST_VECTOR_GET(auths, i);
2622 if (!out[i]) {
2623 ast_log(LOG_NOTICE, "Couldn't find auth '%s'. Cannot authenticate\n", name);
2624 return -1;
2625 }
2626 }
2627
2628 return 0;
2629}
#define LOG_NOTICE
#define SIP_SORCERY_AUTH_TYPE
Definition res_pjsip.h:597
FILE * out
Definition utils/frame.c:33
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
Definition vector.h:691

References ast_log, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_id(), AST_VECTOR_GET, AST_VECTOR_SIZE, LOG_NOTICE, name, out, and SIP_SORCERY_AUTH_TYPE.

Referenced by digest_check_auth(), and set_outbound_initial_authentication_credentials().

◆ ast_sip_retrieve_auths_vector()

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.

Parameters
auth_idsVector of sorcery IDs of auth credentials to retrieve
[out]auth_objectsA pointer ast_sip_auth_objects_vector to hold the objects
Return values
0Success
-1Number of auth objects found is less than the number of names supplied.
Warning
The number of auth objects retrieved may be less than the number of auth ids supplied if auth objects couldn't be found for some of them.
Note
Since the ref count on all auth objects returned has been bumped, you must call ast_sip_cleanup_auth_objects_vector() to decrement the ref count on all of the auth objects in the vector, then call AST_VECTOR_FREE() on the vector itself.

Definition at line 2639 of file pjsip_configuration.c.

2641{
2642 int i;
2643
2644 for (i = 0; i < AST_VECTOR_SIZE(auth_ids); ++i) {
2645 /* Using AST_VECTOR_GET is safe since the vector is immutable */
2646 const char *name = AST_VECTOR_GET(auth_ids, i);
2648 if (!auth_object) {
2649 ast_log(LOG_WARNING, "Auth object '%s' could not be found\n", name);
2650 } else {
2651 AST_VECTOR_APPEND(auth_objects, auth_object);
2652 }
2653 }
2654
2655 return AST_VECTOR_SIZE(auth_objects) == AST_VECTOR_SIZE(auth_ids) ? 0 : -1;
2656}
#define LOG_WARNING

References ast_log, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_id(), AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_SIZE, LOG_WARNING, name, and SIP_SORCERY_AUTH_TYPE.

Referenced by digest_create_request_with_auth().

◆ ast_sip_set_security_negotiation()

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.

Parameters
security_negotiationSecurity negotiation enum to set.
valString that represents a security_negotiation value.
Return values
0Success
non-zeroFailure

Definition at line 288 of file pjsip_configuration.c.

288 {
289 if (!strcasecmp("no", val)) {
290 *security_negotiation = AST_SIP_SECURITY_NEG_NONE;
291 } else if (!strcasecmp("mediasec", val)) {
292 *security_negotiation = AST_SIP_SECURITY_NEG_MEDIASEC;
293 } else {
294 return -1;
295 }
296 return 0;
297}
@ AST_SIP_SECURITY_NEG_MEDIASEC
Definition res_pjsip.h:355
@ AST_SIP_SECURITY_NEG_NONE
Definition res_pjsip.h:353

References AST_SIP_SECURITY_NEG_MEDIASEC, AST_SIP_SECURITY_NEG_NONE, and ast_sip_endpoint::security_negotiation.

Referenced by security_negotiation_handler(), and security_negotiation_handler().

◆ ast_sip_sorcery_object_to_ami()

int ast_sip_sorcery_object_to_ami ( const void *  obj,
struct ast_str **  buf 
)

Converts a sorcery object to a string of object properties.

Parameters
objthe sorcery object to convert
bufthe string buffer to write the object data
Return values
0Success, non-zero on failure

Definition at line 1837 of file pjsip_configuration.c.

1838{
1841 struct ast_variable *i;
1842
1843 if (!objset) {
1844 return -1;
1845 }
1846
1848
1849 for (i = objset; i; i = i->next) {
1850 RAII_VAR(char *, camel, ast_to_camel_case(i->name), ast_free);
1851 ast_str_append(buf, 0, "%s: %s\r\n", camel, i->value);
1852 }
1853
1854 return 0;
1855}
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Definition extconf.c:1260
static void sip_sorcery_object_ami_set_type_name(const void *obj, struct ast_str **buf)
@ AST_HANDLER_ONLY_STRING
Use string handler only.
Definition sorcery.h:137
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.
Definition sorcery.c:1575
#define ast_to_camel_case(s)
Attempts to convert the given string to camel case using an underscore as the specified delimiter.
Definition strings.h:546
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next

References ast_free, AST_HANDLER_ONLY_STRING, ast_sip_get_sorcery(), ast_sorcery_objectset_create2(), ast_str_append(), ast_to_camel_case, ast_variables_destroy(), buf, ast_variable::name, ast_variable::next, RAII_VAR, sip_sorcery_object_ami_set_type_name(), and ast_variable::value.

Referenced by ami_outbound_registration_task(), ami_registrations_aor(), format_ami_resource_lists(), sip_auth_to_ami(), sip_contact_to_ami(), sip_endpoint_to_ami(), sip_identify_to_ami(), and sip_transport_to_ami().

◆ call_offer_pref_handler()

static int call_offer_pref_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1316 of file pjsip_configuration.c.

1318{
1319 struct ast_sip_endpoint *endpoint = obj;
1320 struct ast_flags pref = { 0, };
1321 int outgoing = strcmp(var->name, "outgoing_call_offer_pref") == 0;
1322
1323 int res = ast_sip_call_codec_str_to_pref(&pref, var->value, outgoing);
1324 if (res != 0) {
1325 return -1;
1326 }
1327
1328 if (outgoing) {
1329 endpoint->media.outgoing_call_offer_pref = pref;
1330 } else {
1331 endpoint->media.incoming_call_offer_pref = pref;
1332 }
1333
1334 return 0;
1335}
#define var
Definition ast_expr2f.c:605
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.
Definition res_pjsip.c:2548
Structure used to handle boolean flags.
Definition utils.h:220
struct ast_flags incoming_call_offer_pref
Definition res_pjsip.h:1045
struct ast_flags outgoing_call_offer_pref
Definition res_pjsip.h:1047

References ast_sip_call_codec_str_to_pref(), ast_sip_endpoint_media_configuration::incoming_call_offer_pref, ast_sip_endpoint::media, ast_sip_endpoint_media_configuration::outgoing_call_offer_pref, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ caller_id_handler()

static int caller_id_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 766 of file pjsip_configuration.c.

767{
768 struct ast_sip_endpoint *endpoint = obj;
769 char cid_name[80] = { '\0' };
770 char cid_num[80] = { '\0' };
771
772 ast_free(endpoint->id.self.name.str);
773 endpoint->id.self.name.str = NULL;
774 endpoint->id.self.name.valid = 0;
775 ast_free(endpoint->id.self.number.str);
776 endpoint->id.self.number.str = NULL;
777 endpoint->id.self.number.valid = 0;
778
779 ast_callerid_split(var->value, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num));
780 if (!ast_strlen_zero(cid_name)) {
781 endpoint->id.self.name.str = ast_strdup(cid_name);
782 if (!endpoint->id.self.name.str) {
783 return -1;
784 }
785 endpoint->id.self.name.valid = 1;
786 }
787 if (!ast_strlen_zero(cid_num)) {
788 endpoint->id.self.number.str = ast_strdup(cid_num);
789 if (!endpoint->id.self.number.str) {
790 return -1;
791 }
792 endpoint->id.self.number.valid = 1;
793 }
794 return 0;
795}
int ast_callerid_split(const char *src, char *name, int namelen, char *num, int numlen)
Definition callerid.c:1292
struct ast_party_name name
Subscriber name.
Definition channel.h:342
struct ast_party_number number
Subscriber phone number.
Definition channel.h:344
unsigned char valid
TRUE if the name information is valid/present.
Definition channel.h:281
char * str
Subscriber name (Malloced)
Definition channel.h:266
unsigned char valid
TRUE if the number information is valid/present.
Definition channel.h:299
char * str
Subscriber phone number (Malloced)
Definition channel.h:293

References ast_callerid_split(), ast_free, ast_strdup, ast_strlen_zero(), ast_sip_endpoint::id, ast_party_id::name, NULL, ast_party_id::number, ast_sip_endpoint_id_configuration::self, ast_party_name::str, ast_party_number::str, ast_party_name::valid, ast_party_number::valid, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ caller_id_privacy_handler()

static int caller_id_privacy_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 820 of file pjsip_configuration.c.

821{
822 struct ast_sip_endpoint *endpoint = obj;
823 int callingpres = ast_parse_caller_presentation(var->value);
824 if (callingpres == -1 && sscanf(var->value, "%d", &callingpres) != 1) {
825 return -1;
826 }
827 endpoint->id.self.number.presentation = callingpres;
828 endpoint->id.self.name.presentation = callingpres;
829 return 0;
830}
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
Definition callerid.c:1343
int presentation
Q.931 encoded presentation-indicator encoded field.
Definition channel.h:279
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
Definition channel.h:297

References ast_parse_caller_presentation(), ast_sip_endpoint::id, ast_party_id::name, ast_party_id::number, ast_party_name::presentation, ast_party_number::presentation, ast_sip_endpoint_id_configuration::self, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ caller_id_privacy_to_str()

static int caller_id_privacy_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 832 of file pjsip_configuration.c.

833{
834 const struct ast_sip_endpoint *endpoint = obj;
835 const char *presentation = ast_named_caller_presentation(
836 endpoint->id.self.name.presentation);
837
838 *buf = ast_strdup(presentation);
839 return 0;
840}
const char * ast_named_caller_presentation(int data)
Convert caller ID pres value to text code.
Definition callerid.c:1382

References ast_named_caller_presentation(), ast_strdup, buf, ast_sip_endpoint::id, ast_party_id::name, ast_party_name::presentation, and ast_sip_endpoint_id_configuration::self.

Referenced by ast_res_pjsip_initialize_configuration().

◆ caller_id_tag_handler()

static int caller_id_tag_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 842 of file pjsip_configuration.c.

843{
844 struct ast_sip_endpoint *endpoint = obj;
845
846 ast_free(endpoint->id.self.tag);
847 endpoint->id.self.tag = ast_strdup(var->value);
848
849 return endpoint->id.self.tag ? 0 : -1;
850}

References ast_free, ast_strdup, ast_sip_endpoint::id, ast_sip_endpoint_id_configuration::self, ast_party_id::tag, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ caller_id_tag_to_str()

static int caller_id_tag_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 852 of file pjsip_configuration.c.

853{
854 const struct ast_sip_endpoint *endpoint = obj;
855 *buf = ast_strdup(endpoint->id.self.tag);
856 return 0;
857}

References ast_strdup, buf, ast_sip_endpoint::id, ast_sip_endpoint_id_configuration::self, and ast_party_id::tag.

Referenced by ast_res_pjsip_initialize_configuration().

◆ caller_id_to_str()

static int caller_id_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 797 of file pjsip_configuration.c.

798{
799 const struct ast_sip_endpoint *endpoint = obj;
800 const char *name = S_COR(endpoint->id.self.name.valid,
801 endpoint->id.self.name.str, NULL);
802 const char *number = S_COR(endpoint->id.self.number.valid,
803 endpoint->id.self.number.str, NULL);
804
805 /* make sure size is at least 10 - that should cover the "<unknown>"
806 case as well as any additional formatting characters added in
807 the name and/or number case. */
808 int size = 10;
809 size += name ? strlen(name) : 0;
810 size += number ? strlen(number) : 0;
811
812 if (!(*buf = ast_calloc(size + 1, sizeof(char)))) {
813 return -1;
814 }
815
816 ast_callerid_merge(*buf, size + 1, name, number, NULL);
817 return 0;
818}
char * ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *num, const char *unknown)
Definition callerid.c:1273
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
Definition strings.h:87
Number structure.

References ast_callerid_merge(), ast_calloc, buf, ast_sip_endpoint::id, name, ast_party_id::name, NULL, ast_party_id::number, S_COR, ast_sip_endpoint_id_configuration::self, ast_party_name::str, ast_party_number::str, ast_party_name::valid, and ast_party_number::valid.

Referenced by ast_res_pjsip_initialize_configuration().

◆ callgroup_to_str()

static int callgroup_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 928 of file pjsip_configuration.c.

929{
930 const struct ast_sip_endpoint *endpoint = obj;
931
932 if (!(*buf = ast_calloc(MAX_OBJECT_FIELD, sizeof(char)))) {
933 return -1;
934 }
935
937 return 0;
938}
char * ast_print_group(char *buf, int buflen, ast_group_t group)
Print call and pickup groups into buffer.
Definition channel.c:8115
struct ast_sip_endpoint_pickup_configuration pickup
Definition res_pjsip.h:1104

References ast_calloc, ast_print_group(), buf, ast_sip_endpoint_pickup_configuration::callgroup, MAX_OBJECT_FIELD, and ast_sip_endpoint::pickup.

Referenced by ast_res_pjsip_initialize_configuration().

◆ cli_endpoint_get_container()

static struct ao2_container * cli_endpoint_get_container ( const char *  regex)
static

Definition at line 2024 of file pjsip_configuration.c.

2025{
2027 struct ao2_container *s_container;
2028
2030 if (!container) {
2031 return NULL;
2032 }
2033
2036 if (!s_container) {
2037 return NULL;
2038 }
2039
2040 if (ao2_container_dup(s_container, container, 0)) {
2041 ao2_ref(s_container, -1);
2042 return NULL;
2043 }
2044
2045 return s_container;
2046}
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
Definition astobj2.h:367
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a list container.
Definition astobj2.h:1327
static int regex(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
struct ao2_container * container
Definition res_fax.c:603
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.
Definition sorcery.c:2018
int ast_sorcery_object_id_compare(void *obj, void *arg, int flags)
ao2 object comparator based on sorcery id.
Definition sorcery.c:2528
int ast_sorcery_object_id_sort(const void *obj, const void *arg, int flags)
ao2 object sorter based on sorcery id.
Definition sorcery.c:2504

References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_list, ao2_container_dup(), ao2_ref, ast_sorcery_object_id_compare(), ast_sorcery_object_id_sort(), ast_sorcery_retrieve_by_regex(), container, NULL, RAII_VAR, regex(), and sip_sorcery.

Referenced by ast_res_pjsip_initialize_configuration().

◆ cli_endpoint_iterate()

static int cli_endpoint_iterate ( void *  obj,
ao2_callback_fn  callback,
void *  args 
)
static

Definition at line 2048 of file pjsip_configuration.c.

2049{
2051
2052 return 0;
2053}
static struct ast_channel * callback(struct ast_channelstorage_instance *driver, ao2_callback_data_fn *cb_fn, void *arg, void *data, int ao2_flags, int rdlock)
static struct @521 args

References ao2_callback, args, callback(), and OBJ_NODATA.

Referenced by ast_res_pjsip_initialize_configuration().

◆ cli_endpoint_print_body()

static int cli_endpoint_print_body ( void *  obj,
void *  arg,
int  flags 
)
static

Definition at line 2102 of file pjsip_configuration.c.

2103{
2104 struct ast_sip_endpoint *endpoint = obj;
2105 RAII_VAR(struct ast_endpoint_snapshot *, endpoint_snapshot, ast_sip_get_endpoint_snapshot(endpoint), ao2_cleanup);
2106 struct ast_sip_cli_context *context = arg;
2107 const char *id = ast_sorcery_object_get_id(endpoint);
2108 char *print_name = NULL;
2109 int print_name_len;
2110 char *number = S_COR(endpoint->id.self.number.valid,
2111 endpoint->id.self.number.str, NULL);
2112 int indent;
2113 int flexwidth;
2114
2115 ast_assert(context->output_buffer != NULL);
2116
2117 if (number) {
2118 print_name_len = strlen(id) + strlen(number) + 2;
2119 print_name = ast_alloca(print_name_len);
2120 snprintf(print_name, print_name_len, "%s/%s", id, number);
2121 }
2122
2123 indent = CLI_INDENT_TO_SPACES(context->indent_level);
2124 flexwidth = CLI_LAST_TABSTOP - indent - 2;
2125
2126 ast_str_append(&context->output_buffer, 0, "%*s: %-*.*s %-12.12s %d of %.0f\n",
2127 indent, "Endpoint",
2128 flexwidth, flexwidth, print_name ? print_name : id,
2129 ast_sip_get_device_state(endpoint),
2130 endpoint_snapshot->num_channels,
2131 (double) endpoint->devicestate_busy_at ? endpoint->devicestate_busy_at :
2132 INFINITY
2133 );
2134
2135 if (context->recurse) {
2136 context->indent_level++;
2137
2138 context->auth_direction = "Out";
2139 cli_endpoint_print_child_body("auth", &endpoint->outbound_auths, context);
2140 context->auth_direction = "In";
2141 cli_endpoint_print_child_body("auth", &endpoint->inbound_auths, context);
2142
2143 cli_endpoint_print_child_body("aor", endpoint->aors, context);
2144 cli_endpoint_print_child_body("transport", endpoint, context);
2145 cli_endpoint_print_child_body("identify", endpoint, context);
2146 cli_endpoint_print_child_body("channel", endpoint, context);
2147
2148 context->indent_level--;
2149
2150 if (context->indent_level == 0) {
2151 ast_str_append(&context->output_buffer, 0, "\n");
2152 }
2153 }
2154
2155 if (context->show_details || (context->show_details_only_level_0 && context->indent_level == 0)) {
2156 ast_str_append(&context->output_buffer, 0, "\n");
2157 ast_sip_cli_print_sorcery_objectset(endpoint, context, 0);
2158 }
2159
2160 return 0;
2161}
enum queue_result id
Definition app_queue.c:1790
#define INFINITY
#define ast_alloca(size)
call __builtin_alloca to ensure we get gcc builtin semantics
Definition astmm.h:288
static void cli_endpoint_print_child_body(char *type, const void *obj, struct ast_sip_cli_context *context)
const char * ast_sip_get_device_state(const struct ast_sip_endpoint *endpoint)
Retrieve the device state for an endpoint.
int ast_sip_cli_print_sorcery_objectset(void *obj, void *arg, int flags)
Prints a sorcery object's ast_variable list.
Definition pjsip_cli.c:36
#define CLI_LAST_TABSTOP
#define CLI_INDENT_TO_SPACES(x)
CLI Formatter Context passed to all formatters.
struct ast_sip_auth_vector outbound_auths
Definition res_pjsip.h:1108
const ast_string_field aors
Definition res_pjsip.h:1090
struct ast_sip_auth_vector inbound_auths
Definition res_pjsip.h:1106

References ao2_cleanup, ast_sip_endpoint::aors, ast_alloca, ast_assert, ast_sip_cli_print_sorcery_objectset(), ast_sip_get_device_state(), ast_sip_get_endpoint_snapshot(), ast_sorcery_object_get_id(), ast_str_append(), cli_endpoint_print_child_body(), CLI_INDENT_TO_SPACES, CLI_LAST_TABSTOP, ast_sip_endpoint::devicestate_busy_at, id, ast_sip_endpoint::id, ast_sip_endpoint::inbound_auths, INFINITY, NULL, ast_party_id::number, ast_sip_endpoint::outbound_auths, RAII_VAR, S_COR, ast_sip_endpoint_id_configuration::self, ast_party_number::str, and ast_party_number::valid.

Referenced by ast_res_pjsip_initialize_configuration().

◆ cli_endpoint_print_child_body()

static void cli_endpoint_print_child_body ( char *  type,
const void *  obj,
struct ast_sip_cli_context context 
)
static

Definition at line 2092 of file pjsip_configuration.c.

2093{
2094 RAII_VAR(struct ast_sip_cli_formatter_entry *, formatter_entry, NULL, ao2_cleanup);
2095
2096 formatter_entry = ast_sip_lookup_cli_formatter(type);
2097 if (formatter_entry) {
2098 formatter_entry->iterate((void *)obj, formatter_entry->print_body, context);
2099 }
2100}
static const char type[]
struct ast_sip_cli_formatter_entry * ast_sip_lookup_cli_formatter(const char *name)
Looks up a CLI formatter by type.
Definition pjsip_cli.c:305

References ao2_cleanup, ast_sip_lookup_cli_formatter(), NULL, RAII_VAR, and type.

Referenced by cli_endpoint_print_body().

◆ cli_endpoint_print_child_header()

static void cli_endpoint_print_child_header ( char *  type,
struct ast_sip_cli_context context 
)
static

Definition at line 2060 of file pjsip_configuration.c.

2061{
2062 RAII_VAR(struct ast_sip_cli_formatter_entry *, formatter_entry, NULL, ao2_cleanup);
2063
2064 formatter_entry = ast_sip_lookup_cli_formatter(type);
2065 if (formatter_entry) {
2066 formatter_entry->print_header(NULL, context, 0);
2067 }
2068}

References ao2_cleanup, ast_sip_lookup_cli_formatter(), NULL, RAII_VAR, and type.

Referenced by cli_endpoint_print_header().

◆ cli_endpoint_print_header()

static int cli_endpoint_print_header ( void *  obj,
void *  arg,
int  flags 
)
static

Definition at line 2070 of file pjsip_configuration.c.

2071{
2072 struct ast_sip_cli_context *context = arg;
2073
2074 ast_assert(context->output_buffer != NULL);
2075
2076 ast_str_append(&context->output_buffer, 0,
2077 " Endpoint: <Endpoint/CID.....................................> <State.....> <Channels.>\n");
2078
2079 if (context->recurse) {
2080 context->indent_level++;
2081 cli_endpoint_print_child_header("auth", context);
2082 cli_endpoint_print_child_header("aor", context);
2083 cli_endpoint_print_child_header("transport", context);
2084 cli_endpoint_print_child_header("identify", context);
2085 cli_endpoint_print_child_header("channel", context);
2086 context->indent_level--;
2087 }
2088
2089 return 0;
2090}
static void cli_endpoint_print_child_header(char *type, struct ast_sip_cli_context *context)

References ast_assert, ast_str_append(), cli_endpoint_print_child_header(), and NULL.

Referenced by ast_res_pjsip_initialize_configuration().

◆ cli_endpoint_retrieve_by_id()

static void * cli_endpoint_retrieve_by_id ( const char *  id)
static

Definition at line 2055 of file pjsip_configuration.c.

2056{
2057 return ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", id);
2058}

References ast_sip_get_sorcery(), and ast_sorcery_retrieve_by_id().

Referenced by ast_res_pjsip_initialize_configuration().

◆ codec_prefs_handler()

static int codec_prefs_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1361 of file pjsip_configuration.c.

1363{
1364 struct ast_sip_endpoint *endpoint = obj;
1365 struct ast_stream_codec_negotiation_prefs *option_prefs;
1367 struct ast_str *error_message = ast_str_create(128);
1370 int res = 0;
1371
1372 res = ast_stream_codec_prefs_parse(var->value, &prefs, &error_message);
1373 if (res < 0) {
1374 ast_log(LOG_ERROR, "Endpoint '%s': %s for option '%s'\n",
1375 ast_sorcery_object_get_id(endpoint), ast_str_buffer(error_message), var->name);
1376 ast_free(error_message);
1377 return -1;
1378 }
1379 ast_free(error_message);
1380
1381 if (strcmp(var->name, "codec_prefs_incoming_offer") == 0) {
1382 if (prefs.operation == CODEC_NEGOTIATION_OPERATION_UNION) {
1383 ast_log(LOG_ERROR, "Endpoint '%s': Codec preference '%s' has invalid value '%s' for option: '%s'",
1384 ast_sorcery_object_get_id(endpoint),
1387 var->name);
1388 return -1;
1389 }
1390 option_prefs = &endpoint->media.codec_prefs_incoming_offer;
1391 default_prefer = CODEC_NEGOTIATION_PREFER_PENDING;
1392 default_operation = CODEC_NEGOTIATION_OPERATION_INTERSECT;
1393 } else if (strcmp(var->name, "codec_prefs_outgoing_offer") == 0) {
1394 option_prefs = &endpoint->media.codec_prefs_outgoing_offer;
1395 default_prefer = CODEC_NEGOTIATION_PREFER_PENDING;
1396 default_operation = CODEC_NEGOTIATION_OPERATION_UNION;
1397 } else if (strcmp(var->name, "codec_prefs_incoming_answer") == 0) {
1398 option_prefs = &endpoint->media.codec_prefs_incoming_answer;
1399 default_prefer = CODEC_NEGOTIATION_PREFER_PENDING;
1400 default_operation = CODEC_NEGOTIATION_OPERATION_INTERSECT;
1401 } else if (strcmp(var->name, "codec_prefs_outgoing_answer") == 0) {
1402 option_prefs = &endpoint->media.codec_prefs_outgoing_answer;
1403 default_prefer = CODEC_NEGOTIATION_PREFER_PENDING;
1404 default_operation = CODEC_NEGOTIATION_OPERATION_INTERSECT;
1405 } else {
1406 ast_log(LOG_ERROR, "Endpoint '%s': Unsupported option '%s'\n",
1407 ast_sorcery_object_get_id(endpoint),
1408 var->name);
1409 return -1;
1410 }
1411
1412 if (prefs.prefer == CODEC_NEGOTIATION_PREFER_UNSPECIFIED) {
1413 prefs.prefer = default_prefer;
1414 }
1415
1416 if (prefs.operation == CODEC_NEGOTIATION_OPERATION_UNSPECIFIED) {
1417 prefs.operation = default_operation;
1418 }
1419
1420 if (prefs.keep == CODEC_NEGOTIATION_KEEP_UNSPECIFIED) {
1421 prefs.keep = CODEC_NEGOTIATION_KEEP_ALL;
1422 }
1423
1424 if (prefs.transcode == CODEC_NEGOTIATION_TRANSCODE_UNSPECIFIED) {
1425 prefs.transcode = CODEC_NEGOTIATION_TRANSCODE_ALLOW;
1426 }
1427
1428 /* Now that defaults have been applied as needed we apply the full codec
1429 * preference configuration to the option.
1430 */
1431 *option_prefs = prefs;
1432
1433 return 0;
1434}
ast_stream_codec_negotiation_prefs_operation_values
The "operation" values.
Definition stream.h:159
@ CODEC_NEGOTIATION_OPERATION_UNSPECIFIED
Definition stream.h:160
@ CODEC_NEGOTIATION_OPERATION_UNION
Definition stream.h:164
@ CODEC_NEGOTIATION_OPERATION_INTERSECT
Definition stream.h:162
@ CODEC_NEGOTIATION_KEEP_UNSPECIFIED
Definition stream.h:178
@ CODEC_NEGOTIATION_KEEP_ALL
Definition stream.h:180
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.
Definition stream.c:181
#define ast_stream_codec_operation_to_str(value)
Safely get the name of an "operation" parameter value.
Definition stream.h:264
@ CODEC_NEGOTIATION_TRANSCODE_UNSPECIFIED
Definition stream.h:192
@ CODEC_NEGOTIATION_TRANSCODE_ALLOW
Definition stream.h:194
@ CODEC_NEGOTIATION_PARAM_OPERATION
Definition stream.h:132
ast_stream_codec_negotiation_prefs_prefer_values
The "prefer" values.
Definition stream.h:145
@ CODEC_NEGOTIATION_PREFER_UNSPECIFIED
Definition stream.h:146
@ CODEC_NEGOTIATION_PREFER_PENDING
Definition stream.h:148
#define ast_stream_codec_param_to_str(value)
Safely get the name of a preference parameter.
Definition stream.h:244
char *attribute_pure ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition strings.h:761
struct ast_stream_codec_negotiation_prefs codec_prefs_incoming_offer
Definition res_pjsip.h:1049
struct ast_stream_codec_negotiation_prefs codec_prefs_incoming_answer
Definition res_pjsip.h:1053
struct ast_stream_codec_negotiation_prefs codec_prefs_outgoing_offer
Definition res_pjsip.h:1051
struct ast_stream_codec_negotiation_prefs codec_prefs_outgoing_answer
Definition res_pjsip.h:1055

References ast_free, ast_log, ast_sorcery_object_get_id(), ast_str_buffer(), ast_str_create, ast_stream_codec_operation_to_str, ast_stream_codec_param_to_str, ast_stream_codec_prefs_parse(), CODEC_NEGOTIATION_KEEP_ALL, CODEC_NEGOTIATION_KEEP_UNSPECIFIED, CODEC_NEGOTIATION_OPERATION_INTERSECT, CODEC_NEGOTIATION_OPERATION_UNION, CODEC_NEGOTIATION_OPERATION_UNSPECIFIED, CODEC_NEGOTIATION_PARAM_OPERATION, CODEC_NEGOTIATION_PREFER_PENDING, CODEC_NEGOTIATION_PREFER_UNSPECIFIED, CODEC_NEGOTIATION_TRANSCODE_ALLOW, CODEC_NEGOTIATION_TRANSCODE_UNSPECIFIED, ast_sip_endpoint_media_configuration::codec_prefs_incoming_answer, ast_sip_endpoint_media_configuration::codec_prefs_incoming_offer, ast_sip_endpoint_media_configuration::codec_prefs_outgoing_answer, ast_sip_endpoint_media_configuration::codec_prefs_outgoing_offer, ast_stream_codec_negotiation_prefs::keep, LOG_ERROR, ast_sip_endpoint::media, ast_stream_codec_negotiation_prefs::operation, ast_stream_codec_negotiation_prefs::prefer, ast_stream_codec_negotiation_prefs::transcode, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ codec_prefs_to_str()

static int codec_prefs_to_str ( const struct ast_stream_codec_negotiation_prefs prefs,
const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 1436 of file pjsip_configuration.c.

1438{
1440
1441 if (!codecs) {
1442 return -1;
1443 }
1444
1447
1448 return 0;
1449}
static struct ao2_container * codecs
Registered codecs.
Definition codec.c:48
#define AST_STREAM_MAX_CODEC_PREFS_LENGTH
Define for allocating buffer space for to_str() functions.
Definition stream.h:307
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.
Definition stream.c:132

References ast_free, ast_str_create, ast_strdup, ast_stream_codec_prefs_to_str(), AST_STREAM_MAX_CODEC_PREFS_LENGTH, buf, and codecs.

Referenced by incoming_answer_codec_prefs_to_str(), incoming_offer_codec_prefs_to_str(), outgoing_answer_codec_prefs_to_str(), and outgoing_offer_codec_prefs_to_str().

◆ connected_line_method_handler()

static int connected_line_method_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 708 of file pjsip_configuration.c.

709{
710 struct ast_sip_endpoint *endpoint = obj;
711
712 if (!strcasecmp(var->value, "invite") || !strcasecmp(var->value, "reinvite")) {
714 } else if (!strcasecmp(var->value, "update")) {
716 } else {
717 ast_log(LOG_NOTICE, "Unrecognized option value %s for %s on endpoint %s\n",
718 var->value, var->name, ast_sorcery_object_get_id(endpoint));
719 return -1;
720 }
721 return 0;
722}
@ AST_SIP_SESSION_REFRESH_METHOD_UPDATE
Definition res_pjsip.h:717
@ AST_SIP_SESSION_REFRESH_METHOD_INVITE
Definition res_pjsip.h:715
enum ast_sip_session_refresh_method refresh_method
Definition res_pjsip.h:888

References ast_log, AST_SIP_SESSION_REFRESH_METHOD_INVITE, AST_SIP_SESSION_REFRESH_METHOD_UPDATE, ast_sorcery_object_get_id(), ast_sip_endpoint::id, LOG_NOTICE, ast_sip_endpoint_id_configuration::refresh_method, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ connected_line_method_to_str()

static int connected_line_method_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 724 of file pjsip_configuration.c.

725{
726 const struct ast_sip_endpoint *endpoint = obj;
728 return 0;
729}
static const char * id_configuration_refresh_methods[]

References ast_strdup, buf, ast_sip_endpoint::id, id_configuration_refresh_methods, and ast_sip_endpoint_id_configuration::refresh_method.

Referenced by ast_res_pjsip_initialize_configuration().

◆ contact_acl_to_str()

static int contact_acl_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 127 of file pjsip_configuration.c.

128{
129 const struct ast_sip_endpoint *endpoint = obj;
130 struct ast_acl_list *acl_list;
131 struct ast_acl *first_acl;
132
133 if (endpoint && !ast_acl_list_is_empty(acl_list=endpoint->contact_acl)) {
134 AST_LIST_LOCK(acl_list);
135 first_acl = AST_LIST_FIRST(acl_list);
136 if (ast_strlen_zero(first_acl->name)) {
137 *buf = "deny/permit";
138 } else {
139 *buf = first_acl->name;
140 }
141 AST_LIST_UNLOCK(acl_list);
142 }
143
144 *buf = ast_strdup(*buf);
145 return 0;
146}
struct ast_acl_list * contact_acl
Definition res_pjsip.h:1138

References ast_acl_list_is_empty(), AST_LIST_FIRST, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_strdup, ast_strlen_zero(), buf, ast_sip_endpoint::contact_acl, and ast_acl::name.

Referenced by ast_res_pjsip_initialize_configuration().

◆ contact_user_handler()

static int contact_user_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1293 of file pjsip_configuration.c.

1295{
1296 struct ast_sip_endpoint *endpoint = obj;
1297
1298 ast_free(endpoint->contact_user);
1299 endpoint->contact_user = ast_strdup(var->value);
1300
1301 return endpoint->contact_user ? 0 : -1;
1302}

References ast_free, ast_strdup, ast_sip_endpoint::contact_user, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ contact_user_to_str()

static int contact_user_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 1304 of file pjsip_configuration.c.

1305{
1306 const struct ast_sip_endpoint *endpoint = obj;
1307
1308 *buf = ast_strdup(endpoint->contact_user);
1309 if (!(*buf)) {
1310 return -1;
1311 }
1312
1313 return 0;
1314}

References ast_strdup, buf, and ast_sip_endpoint::contact_user.

Referenced by ast_res_pjsip_initialize_configuration().

◆ direct_media_glare_mitigation_handler()

static int direct_media_glare_mitigation_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 731 of file pjsip_configuration.c.

732{
733 struct ast_sip_endpoint *endpoint = obj;
734
735 if (!strcasecmp(var->value, "none")) {
737 } else if (!strcasecmp(var->value, "outgoing")) {
739 } else if (!strcasecmp(var->value, "incoming")) {
741 } else {
742 ast_log(LOG_NOTICE, "Unrecognized option value %s for %s on endpoint %s\n",
743 var->value, var->name, ast_sorcery_object_get_id(endpoint));
744 return -1;
745 }
746
747 return 0;
748}
@ AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_NONE
Definition res_pjsip.h:722
@ AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_INCOMING
Definition res_pjsip.h:730
@ AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_OUTGOING
Definition res_pjsip.h:726
enum ast_sip_direct_media_glare_mitigation glare_mitigation
Definition res_pjsip.h:980
struct ast_sip_direct_media_configuration direct_media
Definition res_pjsip.h:1015

References ast_log, AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_INCOMING, AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_NONE, AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_OUTGOING, ast_sorcery_object_get_id(), ast_sip_endpoint_media_configuration::direct_media, ast_sip_direct_media_configuration::glare_mitigation, LOG_NOTICE, ast_sip_endpoint::media, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ direct_media_glare_mitigation_to_str()

static int direct_media_glare_mitigation_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 756 of file pjsip_configuration.c.

757{
758 const struct ast_sip_endpoint *endpoint = obj;
761 }
762
763 return 0;
764}
static const char * direct_media_glare_mitigation_map[]
#define ARRAY_IN_BOUNDS(v, a)
Checks to see if value is within the bounds of the given array.
Definition utils.h:727

References ARRAY_IN_BOUNDS, ast_strdup, buf, ast_sip_endpoint_media_configuration::direct_media, direct_media_glare_mitigation_map, ast_sip_direct_media_configuration::glare_mitigation, and ast_sip_endpoint::media.

Referenced by ast_res_pjsip_initialize_configuration().

◆ direct_media_method_handler()

static int direct_media_method_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 678 of file pjsip_configuration.c.

679{
680 struct ast_sip_endpoint *endpoint = obj;
681
682 if (!strcasecmp(var->value, "invite") || !strcasecmp(var->value, "reinvite")) {
684 } else if (!strcasecmp(var->value, "update")) {
686 } else {
687 ast_log(LOG_NOTICE, "Unrecognized option value %s for %s on endpoint %s\n",
688 var->value, var->name, ast_sorcery_object_get_id(endpoint));
689 return -1;
690 }
691 return 0;
692}
enum ast_sip_session_refresh_method method
Definition res_pjsip.h:978

References ast_log, AST_SIP_SESSION_REFRESH_METHOD_INVITE, AST_SIP_SESSION_REFRESH_METHOD_UPDATE, ast_sorcery_object_get_id(), ast_sip_endpoint_media_configuration::direct_media, LOG_NOTICE, ast_sip_endpoint::media, ast_sip_direct_media_configuration::method, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ direct_media_method_to_str()

static int direct_media_method_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ dtls_handler()

static int dtls_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1000 of file pjsip_configuration.c.

1002{
1003 struct ast_sip_endpoint *endpoint = obj;
1004 char *name = ast_strdupa(var->name);
1005 char *front = NULL;
1006 char *back = NULL;
1007 char *buf = name;
1008
1009 /* strip out underscores in the name */
1010 front = strtok_r(buf, "_", &back);
1011 while (front) {
1012 int size = strlen(front);
1013 ast_copy_string(buf, front, size + 1);
1014 buf += size;
1015 front = strtok_r(NULL, "_", &back);
1016 }
1017
1018 return ast_rtp_dtls_cfg_parse(&endpoint->media.rtp.dtls_cfg, name, var->value);
1019}
int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name, const char *value)
Parse DTLS related configuration options.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition strings.h:425
struct ast_sip_media_rtp_configuration rtp
Definition res_pjsip.h:1013
struct ast_rtp_dtls_cfg dtls_cfg
DTLS-SRTP configuration information.
Definition res_pjsip.h:952

References ast_copy_string(), ast_rtp_dtls_cfg_parse(), ast_strdupa, buf, ast_sip_media_rtp_configuration::dtls_cfg, ast_sip_endpoint::media, name, NULL, ast_sip_endpoint_media_configuration::rtp, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ dtlsautogeneratecert_to_str()

static int dtlsautogeneratecert_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 1036 of file pjsip_configuration.c.

1037{
1038 const struct ast_sip_endpoint *endpoint = obj;
1040 return 0;
1041}
#define AST_YESNO(x)
return Yes or No depending on the argument.
Definition strings.h:143
unsigned int ephemeral_cert
Definition rtp_engine.h:617

References ast_strdup, AST_YESNO, buf, ast_sip_media_rtp_configuration::dtls_cfg, ast_rtp_dtls_cfg::ephemeral_cert, ast_sip_endpoint::media, and ast_sip_endpoint_media_configuration::rtp.

Referenced by ast_res_pjsip_initialize_configuration().

◆ dtlscafile_to_str()

static int dtlscafile_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ dtlscapath_to_str()

static int dtlscapath_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ dtlscertfile_to_str()

static int dtlscertfile_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ dtlscipher_to_str()

static int dtlscipher_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ dtlsfingerprint_to_str()

static int dtlsfingerprint_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ dtlsprivatekey_to_str()

static int dtlsprivatekey_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ dtlsrekey_to_str()

static int dtlsrekey_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 1028 of file pjsip_configuration.c.

1029{
1030 const struct ast_sip_endpoint *endpoint = obj;
1031
1032 return ast_asprintf(
1033 buf, "%u", endpoint->media.rtp.dtls_cfg.rekey) >=0 ? 0 : -1;
1034}
#define ast_asprintf(ret, fmt,...)
A wrapper for asprintf()
Definition astmm.h:267
unsigned int rekey
Definition rtp_engine.h:607

References ast_asprintf, buf, ast_sip_media_rtp_configuration::dtls_cfg, ast_sip_endpoint::media, ast_rtp_dtls_cfg::rekey, and ast_sip_endpoint_media_configuration::rtp.

Referenced by ast_res_pjsip_initialize_configuration().

◆ dtlssetup_to_str()

static int dtlssetup_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ dtlsverify_to_str()

static int dtlsverify_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ dtmf_handler()

static int dtmf_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 148 of file pjsip_configuration.c.

149{
150 struct ast_sip_endpoint *endpoint = obj;
151 int dtmf = ast_sip_str_to_dtmf(var->value);
152
153 if (dtmf == -1) {
154 return -1;
155 }
156
157 endpoint->dtmf = dtmf;
158 return 0;
159}
int ast_sip_str_to_dtmf(const char *dtmf_mode)
Convert the DTMF mode name into an enum.
Definition res_pjsip.c:2504
enum ast_sip_dtmf_mode dtmf
Definition res_pjsip.h:1110

References ast_sip_str_to_dtmf(), ast_sip_endpoint::dtmf, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ dtmf_to_str()

static int dtmf_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 161 of file pjsip_configuration.c.

162{
163 const struct ast_sip_endpoint *endpoint = obj;
164 char dtmf_str[20];
165 int result = -1;
166
167 result = ast_sip_dtmf_to_str(endpoint->dtmf, dtmf_str, sizeof(dtmf_str));
168
169 if (result == 0) {
170 *buf = ast_strdup(dtmf_str);
171 } else {
172 *buf = ast_strdup("none");
173 }
174 return 0;
175}
static PGresult * result
Definition cel_pgsql.c:84
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.
Definition res_pjsip.c:2475

References ast_sip_dtmf_to_str(), ast_strdup, buf, ast_sip_endpoint::dtmf, and result.

Referenced by ast_res_pjsip_initialize_configuration().

◆ endpoint_acl_handler()

static int endpoint_acl_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 89 of file pjsip_configuration.c.

90{
91 struct ast_sip_endpoint *endpoint = obj;
92 int error = 0;
93 int ignore;
94
95 if (ast_strlen_zero(var->value)) return 0;
96
97 if (!strncmp(var->name, "contact_", 8)) {
98 ast_append_acl(var->name + 8, var->value, &endpoint->contact_acl, &error, &ignore);
99 } else {
100 ast_append_acl(var->name, var->value, &endpoint->acl, &error, &ignore);
101 }
102
103 return error;
104}
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.
Definition acl.c:429
ignore(key=None, val=None, section=None, pjsip=None, nmapped=None, type='endpoint')
int error(const char *format,...)

References ast_sip_endpoint::acl, ast_append_acl(), ast_strlen_zero(), ast_sip_endpoint::contact_acl, error(), and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ endpoint_deleted_observer()

static void endpoint_deleted_observer ( const void *  object)
static

◆ endpoint_destructor()

static void endpoint_destructor ( void *  obj)
static

Definition at line 2506 of file pjsip_configuration.c.

2507{
2508 struct ast_sip_endpoint *endpoint = obj;
2509
2511
2512 ao2_cleanup(endpoint->media.codecs);
2515 info_configuration_destroy(&endpoint->info);
2519 ast_party_id_free(&endpoint->id.self);
2522 ao2_cleanup(endpoint->persistent);
2525 ast_free(endpoint->contact_user);
2526 ast_free_acl_list(endpoint->contact_acl);
2527 ast_free_acl_list(endpoint->acl);
2529}
struct ast_acl_list * ast_free_acl_list(struct ast_acl_list *acl)
Free a list of ACLs.
Definition acl.c:233
void ast_party_id_free(struct ast_party_id *doomed)
Destroy the party id contents.
Definition channel.c:1798
struct ast_namedgroups * ast_unref_namedgroups(struct ast_namedgroups *groups)
Definition channel.c:7784
static void media_configuration_destroy(struct ast_sip_endpoint_media_configuration *media)
static void info_configuration_destroy(struct ast_sip_endpoint_info_configuration *info)
static void subscription_configuration_destroy(struct ast_sip_endpoint_subscription_configuration *subscription)
void ast_sip_security_mechanisms_vector_destroy(struct ast_sip_security_mechanism_vector *security_mechanisms)
Free contents of a security mechanism vector.
void ast_stream_topology_free(struct ast_stream_topology *topology)
Unreference and destroy a stream topology.
Definition stream.c:746
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
struct ast_stream_topology * topology
Definition res_pjsip.h:1021
struct ast_namedgroups * named_pickupgroups
Definition res_pjsip.h:904
struct ast_namedgroups * named_callgroups
Definition res_pjsip.h:902
struct ast_sip_security_mechanism_vector security_mechanisms
Definition res_pjsip.h:1160
struct ast_variable * channel_vars
Definition res_pjsip.h:1130

References ast_sip_endpoint::acl, ao2_cleanup, ast_free, ast_free_acl_list(), ast_party_id_free(), ast_sip_auth_vector_destroy(), ast_sip_security_mechanisms_vector_destroy(), ast_stream_topology_free(), ast_string_field_free_memory, ast_unref_namedgroups(), ast_variables_destroy(), AST_VECTOR_FREE, ast_sip_endpoint::channel_vars, ast_sip_endpoint_media_configuration::codecs, ast_sip_endpoint::contact_acl, ast_sip_endpoint::contact_user, ast_sip_endpoint::id, ast_sip_endpoint::ident_method_order, ast_sip_endpoint::inbound_auths, ast_sip_endpoint::info, info_configuration_destroy(), ast_sip_endpoint::media, media_configuration_destroy(), ast_sip_endpoint_pickup_configuration::named_callgroups, ast_sip_endpoint_pickup_configuration::named_pickupgroups, ast_sip_endpoint::outbound_auths, ast_sip_endpoint::persistent, ast_sip_endpoint::pickup, ast_sip_endpoint::security_mechanisms, ast_sip_endpoint_id_configuration::self, ast_sip_endpoint::subscription, subscription_configuration_destroy(), and ast_sip_endpoint_media_configuration::topology.

Referenced by ast_sip_endpoint_alloc().

◆ follow_redirect_methods_handler()

static int follow_redirect_methods_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 616 of file pjsip_configuration.c.

617{
618 struct ast_sip_endpoint *endpoint = obj;
619 char *methods;
620 char *method;
621 int i;
622
623 /* Clear any existing flags */
625
626 if (ast_strlen_zero(var->value)) {
627 return 0;
628 }
629
630 methods = ast_strdupa(var->value);
631 while ((method = ast_strsep(&methods, ',', AST_STRSEP_TRIM))) {
632 int found = 0;
633
634 /* Look up the method in our mapping table */
635 for (i = 0; i < ARRAY_LEN(redirect_method_mappings); i++) {
636 if (!strcasecmp(method, redirect_method_mappings[i].method_name)) {
638 found = 1;
639 break;
640 }
641 }
642
643 if (!found) {
644 ast_log(LOG_ERROR, "Unrecognized SIP method '%s' for follow_redirect_methods on endpoint %s\n",
646 return -1;
647 }
648 }
649
650 return 0;
651}
static const struct redirect_method_map redirect_method_mappings[]
const char * method
Definition res_pjsip.c:1273
static struct @486 methods[]
@ AST_STRSEP_TRIM
Definition strings.h:256
char * ast_strsep(char **s, const char sep, uint32_t flags)
Act like strsep but ignore separators inside quotes.
Definition utils.c:1869
struct ast_flags follow_redirect_methods
Definition res_pjsip.h:1128
enum ast_sip_redirect_method flag
#define ast_clear_flag(p, flag)
Definition utils.h:78
#define ast_set_flag(p, flag)
Definition utils.h:71

References ARRAY_LEN, ast_clear_flag, ast_log, ast_set_flag, ast_sorcery_object_get_id(), ast_strdupa, ast_strlen_zero(), ast_strsep(), AST_STRSEP_TRIM, redirect_method_map::flag, ast_sip_endpoint::follow_redirect_methods, LOG_ERROR, method, methods, redirect_method_mappings, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ follow_redirect_methods_to_str()

static int follow_redirect_methods_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 653 of file pjsip_configuration.c.

654{
655 const struct ast_sip_endpoint *endpoint = obj;
656 struct ast_str *str = ast_str_create(64);
657 int first = 1;
658 int i;
659
660 if (!str) {
661 return -1;
662 }
663
664 /* Iterate through all supported methods and append if flag is set */
665 for (i = 0; i < ARRAY_LEN(redirect_method_mappings); i++) {
667 ast_str_append(&str, 0, "%s%s", first ? "" : ",", redirect_method_mappings[i].method_name);
668 first = 0;
669 }
670 }
671
673 ast_free(str);
674
675 return 0;
676}
struct sla_ringing_trunk * first
Definition app_sla.c:338
#define ast_test_flag(p, flag)
Definition utils.h:64

References ARRAY_LEN, ast_free, ast_str_append(), ast_str_buffer(), ast_str_create, ast_strdup, ast_test_flag, buf, first, redirect_method_map::flag, ast_sip_endpoint::follow_redirect_methods, redirect_method_map::method_name, redirect_method_mappings, and str.

Referenced by ast_res_pjsip_initialize_configuration().

◆ format_ami_endpoint()

static int format_ami_endpoint ( const struct ast_sip_endpoint endpoint,
struct ast_sip_ami ami 
)
static

Definition at line 1886 of file pjsip_configuration.c.

1888{
1889 RAII_VAR(struct ast_str *, buf,
1890 ast_sip_create_ami_event("EndpointDetail", ami), ast_free);
1891
1892 if (!buf) {
1893 return -1;
1894 }
1895
1896 sip_endpoint_to_ami(endpoint, &buf);
1897 astman_append(ami->s, "%s\r\n", ast_str_buffer(buf));
1898 return 0;
1899}
void astman_append(struct mansession *s, const char *fmt,...)
Definition manager.c:1909
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 sip_endpoint_to_ami(const struct ast_sip_endpoint *endpoint, struct ast_str **buf)

References ast_free, ast_sip_create_ami_event(), ast_str_buffer(), astman_append(), buf, RAII_VAR, ast_sip_ami::s, and sip_endpoint_to_ami().

Referenced by ami_show_endpoint().

◆ format_ami_endpoints()

static int format_ami_endpoints ( void *  obj,
void *  arg,
int  flags 
)
static

Definition at line 1957 of file pjsip_configuration.c.

1958{
1959
1960 struct ast_sip_endpoint *endpoint = obj;
1961 struct ast_sip_ami *ami = arg;
1962 RAII_VAR(struct ast_str *, buf,
1963 ast_sip_create_ami_event("EndpointList", ami), ast_free);
1964
1965 if (!buf) {
1966 return CMP_STOP;
1967 }
1968
1970 ast_str_append(&buf, 0, "Transport: %s\r\n",
1971 endpoint->transport);
1972 ast_str_append(&buf, 0, "Aor: %s\r\n",
1973 endpoint->aors);
1974
1975 ast_str_append(&buf, 0, "Auths: ");
1977 ast_str_append(&buf, 0, "\r\n");
1978
1979 ast_str_append(&buf, 0, "OutboundAuths: ");
1981 ast_str_append(&buf, 0, "\r\n");
1982
1983 ast_sip_for_each_aor(endpoint->aors,
1985
1986 ast_str_append(&buf, 0, "DeviceState: %s\r\n",
1987 ast_sip_get_device_state(endpoint));
1988
1989 ast_str_append(&buf, 0, "ActiveChannels: ");
1990 active_channels_to_str(endpoint, &buf);
1991 ast_str_append(&buf, 0, "\r\n");
1992
1993 astman_append(ami->s, "%s\r\n", ast_str_buffer(buf));
1994 return 0;
1995}
@ CMP_STOP
Definition astobj2.h:1028
static int format_str_append_auth(const struct ast_sip_auth_vector *auths, struct ast_str **buf)
static int sip_endpoints_aors_ami(void *obj, void *arg, int flags)
static void active_channels_to_str(const struct ast_sip_endpoint *endpoint, struct ast_str **str)
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.
Definition location.c:688
const ast_string_field transport
Definition res_pjsip.h:1090

References active_channels_to_str(), ast_sip_endpoint::aors, ast_sip_ami::arg, ast_free, ast_sip_create_ami_event(), ast_sip_for_each_aor(), ast_sip_get_device_state(), ast_str_append(), ast_str_buffer(), astman_append(), buf, CMP_STOP, format_str_append_auth(), ast_sip_endpoint::inbound_auths, ast_sip_endpoint::outbound_auths, RAII_VAR, ast_sip_ami::s, sip_endpoints_aors_ami(), sip_sorcery_object_ami_set_type_name(), and ast_sip_endpoint::transport.

Referenced by ami_show_endpoints().

◆ format_str_append_auth()

static int format_str_append_auth ( const struct ast_sip_auth_vector auths,
struct ast_str **  buf 
)
static

Definition at line 1945 of file pjsip_configuration.c.

1947{
1948 char *str = NULL;
1949 if (ast_sip_auths_to_str(auths, &str)) {
1950 return -1;
1951 }
1952 ast_str_append(buf, 0, "%s", str ? str : "");
1953 ast_free(str);
1954 return 0;
1955}
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.

References ast_free, ast_sip_auths_to_str(), ast_str_append(), buf, NULL, and str.

Referenced by format_ami_endpoints().

◆ from_user_handler()

static int from_user_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1187 of file pjsip_configuration.c.

1189{
1190 struct ast_sip_endpoint *endpoint = obj;
1191 /* Valid non-alphanumeric characters for URI */
1192 char *valid_uri_marks = "-._~%!$&'()*+,;=:";
1193 const char *val;
1194
1195 for (val = var->value; *val; val++) {
1196 if (!isalpha(*val) && !isdigit(*val) && !strchr(valid_uri_marks, *val)) {
1197 ast_log(LOG_ERROR, "Error configuring endpoint '%s' - '%s' field "
1198 "contains invalid character '%c'\n",
1199 ast_sorcery_object_get_id(endpoint), var->name, *val);
1200 return -1;
1201 }
1202 }
1203
1204 ast_string_field_set(endpoint, fromuser, var->value);
1205
1206 return 0;
1207}
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.

References ast_log, ast_sorcery_object_get_id(), ast_string_field_set, ast_sip_endpoint::fromuser, LOG_ERROR, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ from_user_to_str()

static int from_user_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 1209 of file pjsip_configuration.c.

1210{
1211 const struct ast_sip_endpoint *endpoint = obj;
1212
1213 *buf = ast_strdup(endpoint->fromuser);
1214
1215 return 0;
1216}

References ast_strdup, buf, and ast_sip_endpoint::fromuser.

Referenced by ast_res_pjsip_initialize_configuration().

◆ group_handler()

static int group_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 912 of file pjsip_configuration.c.

914{
915 struct ast_sip_endpoint *endpoint = obj;
916
917 if (!strncmp(var->name, "call_group", 10)) {
918 endpoint->pickup.callgroup = ast_get_group(var->value);
919 } else if (!strncmp(var->name, "pickup_group", 12)) {
920 endpoint->pickup.pickupgroup = ast_get_group(var->value);
921 } else {
922 return -1;
923 }
924
925 return 0;
926}
ast_group_t ast_get_group(const char *s)
Definition channel.c:7670

References ast_get_group(), ast_sip_endpoint_pickup_configuration::callgroup, ast_sip_endpoint::pickup, ast_sip_endpoint_pickup_configuration::pickupgroup, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ ident_handler()

static int ident_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 462 of file pjsip_configuration.c.

463{
464 struct ast_sip_endpoint *endpoint = obj;
465 char *idents = ast_strdupa(var->value);
466 char *val;
467 int method;
468
469 /*
470 * If there's already something in the vector when we get here,
471 * it's the default value so we need to clean it out.
472 */
473 if (AST_VECTOR_SIZE(&endpoint->ident_method_order)) {
475 endpoint->ident_method = 0;
476 }
477
478 while ((val = ast_strip(strsep(&idents, ",")))) {
479 if (ast_strlen_zero(val)) {
480 continue;
481 }
482
484 if (method == -1) {
485 ast_log(LOG_ERROR, "Unrecognized identification method %s specified for endpoint %s\n",
486 val, ast_sorcery_object_get_id(endpoint));
488 endpoint->ident_method = 0;
489 return -1;
490 }
491 if (endpoint->ident_method & method) {
492 /* We are already identifying by this method. No need to do it again. */
493 continue;
494 }
495
496 endpoint->ident_method |= method;
498 }
499
500 return 0;
501}
static int sip_endpoint_identifier_str2type(const char *str)
enum ast_sip_endpoint_identifier_type ident_method
Definition res_pjsip.h:1112
#define AST_VECTOR_RESET(vec, cleanup)
Reset vector.
Definition vector.h:636
#define AST_VECTOR_ELEM_CLEANUP_NOOP(elem)
Vector element cleanup that does nothing.
Definition vector.h:582

References ast_log, ast_sorcery_object_get_id(), ast_strdupa, ast_strip(), ast_strlen_zero(), AST_VECTOR_APPEND, AST_VECTOR_ELEM_CLEANUP_NOOP, AST_VECTOR_RESET, AST_VECTOR_SIZE, ast_sip_endpoint::ident_method, ast_sip_endpoint::ident_method_order, LOG_ERROR, method, sip_endpoint_identifier_str2type(), strsep(), and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ ident_to_str()

static int ident_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 503 of file pjsip_configuration.c.

504{
505 const struct ast_sip_endpoint *endpoint = obj;
506 int methods;
507 int idx;
508 int buf_used = 0;
509 int buf_size = MAX_OBJECT_FIELD;
510
512 if (!methods) {
513 return 0;
514 }
515
516 *buf = ast_malloc(buf_size);
517 if (!*buf) {
518 return -1;
519 }
520
521 for (idx = 0; idx < methods; ++idx) {
523 const char *method_str;
524
525 method = AST_VECTOR_GET(&endpoint->ident_method_order, idx);
527
528 /* Should never have an "<unknown>" method string */
529 ast_assert(strcmp(method_str, "<unknown>"));
530 if (!strcmp(method_str, "<unknown>")) {
531 continue;
532 }
533
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) {
537 /* Need more room than available, truncating. */
538 *(*buf + (buf_size - 1)) = '\0';
539 ast_log(LOG_WARNING, "Truncated identify_by string: %s\n", *buf);
540 break;
541 }
542 }
543
544 return 0;
545}
#define ast_malloc(len)
A wrapper for malloc()
Definition astmm.h:191
static const char * sip_endpoint_identifier_type2str(enum ast_sip_endpoint_identifier_type method)
ast_sip_endpoint_identifier_type
Different methods by which incoming requests can be matched to endpoints.
Definition res_pjsip.h:699

References ast_assert, ast_log, ast_malloc, AST_VECTOR_GET, AST_VECTOR_SIZE, buf, ast_sip_endpoint::ident_method_order, LOG_WARNING, MAX_OBJECT_FIELD, method, methods, and sip_endpoint_identifier_type2str().

Referenced by ast_res_pjsip_initialize_configuration().

◆ inbound_auth_handler()

static int inbound_auth_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 360 of file pjsip_configuration.c.

361{
362 struct ast_sip_endpoint *endpoint = obj;
363
364 return ast_sip_auth_vector_init(&endpoint->inbound_auths, var->value);
365}
int ast_sip_auth_vector_init(struct ast_sip_auth_vector *auths, const char *value)
Initialize an auth vector with the configured values.

References ast_sip_auth_vector_init(), ast_sip_endpoint::inbound_auths, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ inbound_auths_to_str()

static int inbound_auths_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 389 of file pjsip_configuration.c.

390{
391 const struct ast_sip_endpoint *endpoint = obj;
392 return ast_sip_auths_to_str(&endpoint->inbound_auths, buf);
393}

References ast_sip_auths_to_str(), buf, and ast_sip_endpoint::inbound_auths.

Referenced by ast_res_pjsip_initialize_configuration().

◆ incoming_answer_codec_prefs_to_str()

static int incoming_answer_codec_prefs_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 1463 of file pjsip_configuration.c.

1464{
1465 const struct ast_sip_endpoint *endpoint = obj;
1467}
static int codec_prefs_to_str(const struct ast_stream_codec_negotiation_prefs *prefs, const void *obj, const intptr_t *args, char **buf)

References args, buf, ast_sip_endpoint_media_configuration::codec_prefs_incoming_answer, codec_prefs_to_str(), and ast_sip_endpoint::media.

Referenced by ast_res_pjsip_initialize_configuration().

◆ incoming_call_offer_pref_to_str()

static int incoming_call_offer_pref_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 1337 of file pjsip_configuration.c.

1338{
1339 const struct ast_sip_endpoint *endpoint = obj;
1340
1342 if (!(*buf)) {
1343 return -1;
1344 }
1345
1346 return 0;
1347}
const char * ast_sip_call_codec_pref_to_str(struct ast_flags pref)
Convert the call codec preference flags to a string.
Definition res_pjsip.c:2525

References ast_sip_call_codec_pref_to_str(), ast_strdup, buf, ast_sip_endpoint_media_configuration::incoming_call_offer_pref, and ast_sip_endpoint::media.

Referenced by ast_res_pjsip_initialize_configuration().

◆ incoming_offer_codec_prefs_to_str()

static int incoming_offer_codec_prefs_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ info_configuration_destroy()

static void info_configuration_destroy ( struct ast_sip_endpoint_info_configuration info)
static

Definition at line 2494 of file pjsip_configuration.c.

2495{
2497}

References ast_string_field_free_memory.

Referenced by endpoint_destructor().

◆ init_info_configuration()

static int init_info_configuration ( struct ast_sip_endpoint_info_configuration info)
static

Definition at line 2536 of file pjsip_configuration.c.

2537{
2538 return ast_string_field_init(&info->recording, 32);
2539}

References ast_string_field_init, ast_sip_endpoint::info, and ast_sip_endpoint_info_configuration::recording.

Referenced by ast_sip_endpoint_alloc().

◆ init_media_configuration()

static int init_media_configuration ( struct ast_sip_endpoint_media_configuration media)
static

Definition at line 2541 of file pjsip_configuration.c.

2542{
2543 return ast_string_field_init(media, 64) || ast_string_field_init(&media->rtp, 32);
2544}

References ast_string_field_init, ast_sip_endpoint::media, and ast_sip_endpoint_media_configuration::rtp.

Referenced by ast_sip_endpoint_alloc().

◆ init_subscription_configuration()

static int init_subscription_configuration ( struct ast_sip_endpoint_subscription_configuration subscription)
static

Definition at line 2531 of file pjsip_configuration.c.

2532{
2533 return ast_string_field_init(&subscription->mwi, 64);
2534}
struct ast_sip_mwi_configuration mwi
Definition res_pjsip.h:849

References ast_string_field_init, ast_sip_endpoint_subscription_configuration::mwi, and ast_sip_endpoint::subscription.

Referenced by ast_sip_endpoint_alloc().

◆ load_all_endpoints()

static void load_all_endpoints ( void  )
static

◆ media_address_handler()

static int media_address_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 547 of file pjsip_configuration.c.

548{
549 struct ast_sip_endpoint *endpoint = obj;
550 struct ast_sockaddr addr;
551
552 if (ast_sockaddr_parse(&addr, var->value, 0)) {
553 /* If we're able to parse as an IP, ensure it's formatted correctly for later */
554 ast_string_field_set(endpoint, media.address, ast_sockaddr_stringify_addr_remote(&addr));
555 } else {
556 /* If we weren't able to parse it as an IP, just assume it's a hostname */
557 ast_string_field_set(endpoint, media.address, var->value);
558 }
559
560 return 0;
561}
int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
Parse an IPv4 or IPv6 address string.
Definition netsock2.c:230
static char * ast_sockaddr_stringify_addr_remote(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() to return an address only.
Definition netsock2.h:313
Socket address structure.
Definition netsock2.h:97

References ast_sockaddr_parse(), ast_sockaddr_stringify_addr_remote(), ast_string_field_set, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ media_address_to_str()

static int media_address_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 563 of file pjsip_configuration.c.

564{
565 const struct ast_sip_endpoint *endpoint = obj;
566 *buf = ast_strdup(endpoint->media.address);
567 return 0;
568}
const ast_string_field address
Definition res_pjsip.h:1011

References ast_sip_endpoint_media_configuration::address, ast_strdup, buf, and ast_sip_endpoint::media.

Referenced by ast_res_pjsip_initialize_configuration().

◆ media_configuration_destroy()

static void media_configuration_destroy ( struct ast_sip_endpoint_media_configuration media)
static

Definition at line 2499 of file pjsip_configuration.c.

2500{
2504}
void ast_rtp_dtls_cfg_free(struct ast_rtp_dtls_cfg *dtls_cfg)
Free contents of a DTLS configuration structure.

References ast_rtp_dtls_cfg_free(), ast_string_field_free_memory, ast_sip_media_rtp_configuration::dtls_cfg, and ast_sip_endpoint_media_configuration::rtp.

Referenced by endpoint_destructor().

◆ media_encryption_handler()

static int media_encryption_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 859 of file pjsip_configuration.c.

860{
861 struct ast_sip_endpoint *endpoint = obj;
862
863 if (!strcasecmp("no", var->value)) {
865 } else if (!strcasecmp("sdes", var->value)) {
867 } else if (!strcasecmp("dtls", var->value)) {
869 return ast_rtp_dtls_cfg_parse(&endpoint->media.rtp.dtls_cfg, "dtlsenable", "yes");
870 } else {
871 return -1;
872 }
873
874 return 0;
875}
@ AST_SIP_MEDIA_ENCRYPT_SDES
Definition res_pjsip.h:739
@ AST_SIP_MEDIA_ENCRYPT_NONE
Definition res_pjsip.h:737
@ AST_SIP_MEDIA_ENCRYPT_DTLS
Definition res_pjsip.h:741
enum ast_sip_session_media_encryption encryption
Definition res_pjsip.h:956

References ast_rtp_dtls_cfg_parse(), AST_SIP_MEDIA_ENCRYPT_DTLS, AST_SIP_MEDIA_ENCRYPT_NONE, AST_SIP_MEDIA_ENCRYPT_SDES, ast_sip_media_rtp_configuration::dtls_cfg, ast_sip_media_rtp_configuration::encryption, ast_sip_endpoint::media, ast_sip_endpoint_media_configuration::rtp, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ media_encryption_to_str()

static int media_encryption_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ named_callgroups_to_str()

static int named_callgroups_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 980 of file pjsip_configuration.c.

981{
982 const struct ast_sip_endpoint *endpoint = obj;
984
987 return 0;
988}
char * ast_print_namedgroups(struct ast_str **buf, struct ast_namedgroups *groups)
Print named call groups and named pickup groups.
Definition channel.c:8140

References ast_free, ast_print_namedgroups(), ast_str_buffer(), ast_str_create, ast_strdup, buf, MAX_OBJECT_FIELD, ast_sip_endpoint_pickup_configuration::named_callgroups, ast_sip_endpoint::pickup, RAII_VAR, and str.

Referenced by ast_res_pjsip_initialize_configuration().

◆ named_groups_handler()

static int named_groups_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 952 of file pjsip_configuration.c.

954{
955 struct ast_sip_endpoint *endpoint = obj;
956
957 if (!strncmp(var->name, "named_call_group", 16)) {
958 if (ast_strlen_zero(var->value)) {
959 endpoint->pickup.named_callgroups =
961 } else if (!(endpoint->pickup.named_callgroups =
962 ast_get_namedgroups(var->value))) {
963 return -1;
964 }
965 } else if (!strncmp(var->name, "named_pickup_group", 18)) {
966 if (ast_strlen_zero(var->value)) {
967 endpoint->pickup.named_pickupgroups =
969 } else if (!(endpoint->pickup.named_pickupgroups =
970 ast_get_namedgroups(var->value))) {
971 return -1;
972 }
973 } else {
974 return -1;
975 }
976
977 return 0;
978}
struct ast_namedgroups * ast_get_namedgroups(const char *s)
Create an ast_namedgroups set with group names from comma separated string.
Definition channel.c:7727

References ast_get_namedgroups(), ast_strlen_zero(), ast_unref_namedgroups(), ast_sip_endpoint_pickup_configuration::named_callgroups, ast_sip_endpoint_pickup_configuration::named_pickupgroups, ast_sip_endpoint::pickup, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ named_pickupgroups_to_str()

static int named_pickupgroups_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ outbound_auth_handler()

static int outbound_auth_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 367 of file pjsip_configuration.c.

368{
369 struct ast_sip_endpoint *endpoint = obj;
370
371 return ast_sip_auth_vector_init(&endpoint->outbound_auths, var->value);
372}

References ast_sip_auth_vector_init(), ast_sip_endpoint::outbound_auths, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ outbound_auths_to_str()

static int outbound_auths_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 395 of file pjsip_configuration.c.

396{
397 const struct ast_sip_endpoint *endpoint = obj;
398 return ast_sip_auths_to_str(&endpoint->outbound_auths, buf);
399}

References ast_sip_auths_to_str(), buf, and ast_sip_endpoint::outbound_auths.

Referenced by ast_res_pjsip_initialize_configuration().

◆ outgoing_answer_codec_prefs_to_str()

static int outgoing_answer_codec_prefs_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ outgoing_call_offer_pref_to_str()

static int outgoing_call_offer_pref_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 1349 of file pjsip_configuration.c.

1350{
1351 const struct ast_sip_endpoint *endpoint = obj;
1352
1354 if (!(*buf)) {
1355 return -1;
1356 }
1357
1358 return 0;
1359}

References ast_sip_call_codec_pref_to_str(), ast_strdup, buf, ast_sip_endpoint::media, and ast_sip_endpoint_media_configuration::outgoing_call_offer_pref.

Referenced by ast_res_pjsip_initialize_configuration().

◆ outgoing_offer_codec_prefs_to_str()

static int outgoing_offer_codec_prefs_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ persistent_endpoint_cmp()

static int persistent_endpoint_cmp ( void *  obj,
void *  arg,
int  flags 
)
static

Comparison function for persistent endpoint information.

Definition at line 68 of file pjsip_configuration.c.

69{
70 const struct sip_persistent_endpoint *persistent1 = obj;
71 const struct sip_persistent_endpoint *persistent2 = arg;
72 const char *id = (flags & OBJ_KEY ? arg : ast_endpoint_get_resource(persistent2->endpoint));
73
74 return !strcmp(ast_endpoint_get_resource(persistent1->endpoint), id) ? CMP_MATCH | CMP_STOP : 0;
75}
@ CMP_MATCH
Definition astobj2.h:1027
#define OBJ_KEY
Definition astobj2.h:1151

References ast_endpoint_get_resource(), CMP_MATCH, CMP_STOP, sip_persistent_endpoint::endpoint, and OBJ_KEY.

Referenced by ast_res_pjsip_initialize_configuration().

◆ persistent_endpoint_destroy()

static void persistent_endpoint_destroy ( void *  obj)
static

Destructor function for persistent endpoint information.

Definition at line 1481 of file pjsip_configuration.c.

1482{
1483 struct sip_persistent_endpoint *persistent = obj;
1484
1485 ast_endpoint_shutdown(persistent->endpoint);
1486}
void ast_endpoint_shutdown(struct ast_endpoint *endpoint)
Shutsdown an ast_endpoint.

References ast_endpoint_shutdown(), and sip_persistent_endpoint::endpoint.

Referenced by persistent_endpoint_find_or_create().

◆ persistent_endpoint_find_or_create()

static struct ast_endpoint * persistent_endpoint_find_or_create ( const struct ast_sip_endpoint endpoint)
static

Internal function which finds (or creates) persistent endpoint information.

Definition at line 1605 of file pjsip_configuration.c.

1606{
1607 RAII_VAR(struct sip_persistent_endpoint *, persistent, NULL, ao2_cleanup);
1609
1612 if (!persistent) {
1613 persistent = ao2_alloc_options(sizeof(*persistent), persistent_endpoint_destroy,
1615 if (!persistent) {
1616 return NULL;
1617 }
1618
1619 persistent->endpoint = ast_endpoint_create("PJSIP",
1620 ast_sorcery_object_get_id(endpoint));
1621 if (!persistent->endpoint) {
1622 return NULL;
1623 }
1624
1625 ast_endpoint_set_state(persistent->endpoint, AST_ENDPOINT_OFFLINE);
1626
1628 }
1629
1630 ao2_ref(persistent->endpoint, +1);
1631 return persistent->endpoint;
1632}
ast_mutex_t lock
Definition app_sla.c:337
#define ao2_link_flags(container, obj, flags)
Add an object to a container.
Definition astobj2.h:1554
#define ao2_alloc_options(data_size, destructor_fn, options)
Definition astobj2.h:404
@ OBJ_NOLOCK
Assume that the ao2_container is already locked.
Definition astobj2.h:1063
struct ast_endpoint * ast_endpoint_create(const char *tech, const char *resource)
Create an endpoint struct.
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
Definition lock.h:611
static void persistent_endpoint_destroy(void *obj)
Destructor function for persistent endpoint information.

References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, ao2_find, ao2_link_flags, ao2_ref, ast_endpoint_create(), AST_ENDPOINT_OFFLINE, ast_endpoint_set_state(), ast_sorcery_object_get_id(), lock, NULL, OBJ_NOLOCK, OBJ_SEARCH_KEY, persistent_endpoint_destroy(), persistent_endpoints, RAII_VAR, and SCOPED_AO2LOCK.

Referenced by sip_endpoint_apply_handler().

◆ persistent_endpoint_hash()

static int persistent_endpoint_hash ( const void *  obj,
const int  flags 
)
static

Hashing function for persistent endpoint information.

Definition at line 59 of file pjsip_configuration.c.

60{
61 const struct sip_persistent_endpoint *persistent = obj;
62 const char *id = (flags & OBJ_KEY ? obj : ast_endpoint_get_resource(persistent->endpoint));
63
64 return ast_str_hash(id);
65}
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
Definition strings.h:1259

References ast_endpoint_get_resource(), ast_str_hash(), sip_persistent_endpoint::endpoint, and OBJ_KEY.

Referenced by ast_res_pjsip_initialize_configuration().

◆ pickupgroup_to_str()

static int pickupgroup_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 940 of file pjsip_configuration.c.

941{
942 const struct ast_sip_endpoint *endpoint = obj;
943
944 if (!(*buf = ast_calloc(MAX_OBJECT_FIELD, sizeof(char)))) {
945 return -1;
946 }
947
949 return 0;
950}

References ast_calloc, ast_print_group(), buf, MAX_OBJECT_FIELD, ast_sip_endpoint::pickup, and ast_sip_endpoint_pickup_configuration::pickupgroup.

Referenced by ast_res_pjsip_initialize_configuration().

◆ prack_handler()

static int prack_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 177 of file pjsip_configuration.c.

178{
179 struct ast_sip_endpoint *endpoint = obj;
180
181 /* clear all */
182 endpoint->extensions.flags &= ~(PJSIP_INV_SUPPORT_100REL | PJSIP_INV_REQUIRE_100REL);
183
184 if (ast_true(var->value)) {
185 endpoint->extensions.flags |= PJSIP_INV_SUPPORT_100REL;
187 } else if (!strcasecmp(var->value, "peer_supported")) {
188 endpoint->extensions.flags |= PJSIP_INV_SUPPORT_100REL;
190 } else if (!strcasecmp(var->value, "required")) {
191 endpoint->extensions.flags |= PJSIP_INV_REQUIRE_100REL;
193 } else if (ast_false(var->value)) {
195 } else {
196 return -1;
197 }
198
199 return 0;
200}
@ AST_SIP_100REL_PEER_SUPPORTED
Definition res_pjsip.h:537
@ AST_SIP_100REL_UNSUPPORTED
Definition res_pjsip.h:533
@ AST_SIP_100REL_SUPPORTED
Definition res_pjsip.h:535
@ AST_SIP_100REL_REQUIRED
Definition res_pjsip.h:539
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
Definition utils.c:2233
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"....
Definition utils.c:2250
struct ast_sip_endpoint_extensions extensions
Definition res_pjsip.h:1092
enum ast_sip_100rel_mode rel100
Definition res_pjsip.h:1172

References ast_false(), AST_SIP_100REL_PEER_SUPPORTED, AST_SIP_100REL_REQUIRED, AST_SIP_100REL_SUPPORTED, AST_SIP_100REL_UNSUPPORTED, ast_true(), ast_sip_endpoint::extensions, ast_sip_endpoint_extensions::flags, ast_sip_endpoint::rel100, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ prack_to_str()

static int prack_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 202 of file pjsip_configuration.c.

203{
204 const struct ast_sip_endpoint *endpoint = obj;
205
206 if (endpoint->rel100 == AST_SIP_100REL_SUPPORTED) {
207 *buf = "yes";
208 } else if (endpoint->rel100 == AST_SIP_100REL_PEER_SUPPORTED) {
209 *buf = "peer_supported";
210 } else if (endpoint->rel100 == AST_SIP_100REL_REQUIRED) {
211 *buf = "required";
212 } else {
213 *buf = "no";
214 }
215
216 *buf = ast_strdup(*buf);
217 return 0;
218}

References AST_SIP_100REL_PEER_SUPPORTED, AST_SIP_100REL_REQUIRED, AST_SIP_100REL_SUPPORTED, ast_strdup, buf, and ast_sip_endpoint::rel100.

Referenced by ast_res_pjsip_initialize_configuration().

◆ redirect_method_handler()

static int redirect_method_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 570 of file pjsip_configuration.c.

571{
572 struct ast_sip_endpoint *endpoint = obj;
573
574 if (!strcasecmp(var->value, "user")) {
576 } else if (!strcasecmp(var->value, "uri_core")) {
578 } else if (!strcasecmp(var->value, "uri_pjsip")) {
580 } else {
581 ast_log(LOG_ERROR, "Unrecognized redirect method %s specified for endpoint %s\n",
582 var->value, ast_sorcery_object_get_id(endpoint));
583 return -1;
584 }
585
586 return 0;
587}
@ AST_SIP_REDIRECT_URI_CORE
Definition res_pjsip.h:748
@ AST_SIP_REDIRECT_URI_PJSIP
Definition res_pjsip.h:750
@ AST_SIP_REDIRECT_USER
Definition res_pjsip.h:746
enum ast_sip_session_redirect redirect_method
Definition res_pjsip.h:1126

References ast_log, AST_SIP_REDIRECT_URI_CORE, AST_SIP_REDIRECT_URI_PJSIP, AST_SIP_REDIRECT_USER, ast_sorcery_object_get_id(), LOG_ERROR, ast_sip_endpoint::redirect_method, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ redirect_method_to_str()

static int redirect_method_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 595 of file pjsip_configuration.c.

596{
597 const struct ast_sip_endpoint *endpoint = obj;
600 }
601 return 0;
602}
Mapping of SIP method names to their corresponding redirect flags.

References ARRAY_IN_BOUNDS, ast_strdup, buf, and ast_sip_endpoint::redirect_method.

Referenced by ast_res_pjsip_initialize_configuration().

◆ security_mechanism_handler()

static int security_mechanism_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 267 of file pjsip_configuration.c.

268{
269 struct ast_sip_endpoint *endpoint = obj;
270
272}
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.

References ast_sip_security_mechanism_vector_init(), ast_sip_endpoint::security_mechanisms, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ security_mechanism_to_str()

static int security_mechanism_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 260 of file pjsip_configuration.c.

261{
262 const struct ast_sip_endpoint *endpoint = obj;
263
265}
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.

References ast_sip_security_mechanisms_to_str(), buf, and ast_sip_endpoint::security_mechanisms.

Referenced by ast_res_pjsip_initialize_configuration().

◆ security_negotiation_handler()

static int security_negotiation_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 299 of file pjsip_configuration.c.

300{
301 struct ast_sip_endpoint *endpoint = obj;
302
304}
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.
enum ast_sip_security_negotiation security_negotiation
Definition res_pjsip.h:1158

References ast_sip_set_security_negotiation(), ast_sip_endpoint::security_negotiation, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ security_negotiation_to_str()

static int security_negotiation_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 279 of file pjsip_configuration.c.

280{
281 const struct ast_sip_endpoint *endpoint = obj;
284 }
285 return 0;
286}
static const char * security_negotiation_map[]

References ARRAY_IN_BOUNDS, ast_strdup, buf, ast_sip_endpoint::security_negotiation, and security_negotiation_map.

Referenced by ast_res_pjsip_initialize_configuration().

◆ set_var_handler()

static int set_var_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1218 of file pjsip_configuration.c.

1220{
1221 struct ast_sip_endpoint *endpoint = obj;
1222 struct ast_variable *new_var;
1223 char *name;
1224 char *val;
1225
1226 if (ast_strlen_zero(var->value)) {
1227 return 0;
1228 }
1229
1230 name = ast_strdupa(var->value);
1231 val = strchr(name, '=');
1232
1233 if (!val) {
1234 return -1;
1235 }
1236
1237 *val++ = '\0';
1238
1239 if (!(new_var = ast_variable_new(name, val, ""))) {
1240 return -1;
1241 }
1242
1243 if (ast_variable_list_replace(&endpoint->channel_vars, new_var)) {
1244 ast_variable_list_append(&endpoint->channel_vars, new_var);
1245 }
1246
1247 return 0;
1248}
#define ast_variable_new(name, value, filename)
#define ast_variable_list_append(head, new_var)
int ast_variable_list_replace(struct ast_variable **head, struct ast_variable *replacement)
Replace a variable in the given list with a new value.

References ast_strdupa, ast_strlen_zero(), ast_variable_list_append, ast_variable_list_replace(), ast_variable_new, ast_sip_endpoint::channel_vars, name, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ set_var_to_str()

static int set_var_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 1250 of file pjsip_configuration.c.

1251{
1253 const struct ast_sip_endpoint *endpoint = obj;
1254 struct ast_variable *var;
1255
1256 for (var = endpoint->channel_vars; var; var = var->next) {
1257 ast_str_append(&str, 0, "%s=%s,", var->name, var->value);
1258 }
1259
1261 ast_free(str);
1262 return 0;
1263}
char * ast_str_truncate(struct ast_str *buf, ssize_t len)
Truncates the enclosed string to the given length.
Definition strings.h:786

References ast_free, ast_str_append(), ast_str_create, ast_str_truncate(), ast_strdup, buf, ast_sip_endpoint::channel_vars, MAX_OBJECT_FIELD, str, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ set_var_to_vl()

static int set_var_to_vl ( const void *  obj,
struct ast_variable **  fields 
)
static

Definition at line 1265 of file pjsip_configuration.c.

1266{
1267 const struct ast_sip_endpoint *endpoint = obj;
1268 if (endpoint->channel_vars) {
1269 *fields = ast_variables_dup(endpoint->channel_vars);
1270 }
1271 return 0;
1272}
struct ast_variable * ast_variables_dup(struct ast_variable *var)
Duplicate variable list.

References ast_variables_dup(), and ast_sip_endpoint::channel_vars.

Referenced by ast_res_pjsip_initialize_configuration().

◆ sip_endpoint_apply_handler()

static int sip_endpoint_apply_handler ( const struct ast_sorcery sorcery,
void *  obj 
)
static

Callback function for when an object is finalized.

Definition at line 1635 of file pjsip_configuration.c.

1636{
1637 struct ast_sip_endpoint *endpoint = obj;
1638
1639 if (!(endpoint->persistent = persistent_endpoint_find_or_create(endpoint))) {
1640 return -1;
1641 }
1642
1643 if (endpoint->extensions.timer.min_se < 90) {
1644 ast_log(LOG_ERROR, "Session timer minimum expires time must be 90 or greater on endpoint '%s'\n",
1645 ast_sorcery_object_get_id(endpoint));
1646 return -1;
1647 } else if (endpoint->extensions.timer.sess_expires < endpoint->extensions.timer.min_se) {
1648 ast_log(LOG_ERROR, "Session timer expires must be greater than minimum session expires time on endpoint '%s'\n",
1649 ast_sorcery_object_get_id(endpoint));
1650 return -1;
1651 }
1652
1653 if (ast_strlen_zero(endpoint->media.sdpsession) || !*ast_skip_blanks(endpoint->media.sdpsession)) {
1654 ast_log(LOG_WARNING, "SDP session was set to empty on endpoint '%s'. Not permitted as per RFC8866. SDP session set to '-'. \n",
1655 ast_sorcery_object_get_id(endpoint));
1656 ast_string_field_set(endpoint, media.sdpsession, "-");
1657 }
1658
1660 ast_log(LOG_WARNING, "SDP origin username on endpoint '%s' is empty or contains spaces ('%s'). Not permitted as per RFC8866. Setting to '-'.\n",
1661 ast_sorcery_object_get_id(endpoint), endpoint->media.sdpowner);
1662 ast_string_field_set(endpoint, media.sdpowner, "-");
1663 }
1664
1665 if (ast_rtp_dtls_cfg_validate(&endpoint->media.rtp.dtls_cfg)) {
1666 return -1;
1667 }
1668
1669 if (endpoint->preferred_codec_only) {
1671 ast_log(LOG_ERROR, "Setting both preferred_codec_only and incoming_call_offer_pref is not supported on endpoint '%s'\n",
1672 ast_sorcery_object_get_id(endpoint));
1673 return -1;
1674 }
1677 }
1678
1680 if (!endpoint->media.topology) {
1681 return -1;
1682 }
1683
1684 endpoint->media.rtcp_mux |= endpoint->media.bundle;
1685
1686 /*
1687 * If webrtc has been enabled then enable those attributes, and default
1688 * some, that are needed in order for webrtc to work.
1689 */
1690 endpoint->media.bundle |= endpoint->media.webrtc;
1691 endpoint->media.rtcp_mux |= endpoint->media.webrtc;
1692 endpoint->media.rtp.use_avpf |= endpoint->media.webrtc;
1693 endpoint->media.rtp.ice_support |= endpoint->media.webrtc;
1694 endpoint->media.rtp.use_received_transport |= endpoint->media.webrtc;
1695
1696 if (endpoint->media.webrtc) {
1698 endpoint->media.rtp.dtls_cfg.enabled = 1;
1701
1702 /* RFC8827 says: Implementations MUST NOT implement DTLS renegotiation
1703 * and MUST reject it with a "no_renegotiation" alert if offered. */
1704 if (endpoint->media.rtp.dtls_cfg.rekey) {
1705 ast_log(LOG_WARNING, "DTLS renegotiation is not supported with WebRTC. Disabling dtls_rekey.\n");
1706 endpoint->media.rtp.dtls_cfg.rekey = 0;
1707 }
1708
1709 if (ast_strlen_zero(endpoint->media.rtp.dtls_cfg.certfile)) {
1710 /* If no certificate has been specified, try to automatically create one */
1711 endpoint->media.rtp.dtls_cfg.ephemeral_cert = 1;
1712 }
1713 }
1714
1715 if (!ast_strlen_zero(endpoint->geoloc_incoming_call_profile) ||
1716 !ast_strlen_zero(endpoint->geoloc_outgoing_call_profile)) {
1717
1718 if (!ast_geoloc_is_loaded()) {
1719 ast_log(LOG_ERROR, "A geoloc incoming and/or outgoing call_profile was specified on endpoint '%s'"
1720 " but res_geolocation is not loaded.\n", ast_sorcery_object_get_id(endpoint));
1721 return -1;
1722 }
1723
1724 if (!ast_strlen_zero(endpoint->geoloc_incoming_call_profile)) {
1725 struct ast_geoloc_profile *profile = ast_geoloc_get_profile(endpoint->geoloc_incoming_call_profile);
1726 if (!profile) {
1727 ast_log(LOG_ERROR, "geoloc_incoming_call_profile '%s' on endpoint '%s' doesn't exist\n",
1728 endpoint->geoloc_incoming_call_profile, ast_sorcery_object_get_id(endpoint));
1729 return -1;
1730 }
1731 ao2_cleanup(profile);
1732 }
1733
1734 if (!ast_strlen_zero(endpoint->geoloc_outgoing_call_profile)) {
1735 struct ast_geoloc_profile *profile = ast_geoloc_get_profile(endpoint->geoloc_outgoing_call_profile);
1736 if (!profile) {
1737 ast_log(LOG_ERROR, "geoloc_outgoing_call_profile '%s' on endpoint '%s' doesn't exist\n",
1738 endpoint->geoloc_outgoing_call_profile, ast_sorcery_object_get_id(endpoint));
1739 return -1;
1740 }
1741 ao2_cleanup(profile);
1742 }
1743 }
1744
1745 return 0;
1746}
static struct ast_endpoint * persistent_endpoint_find_or_create(const struct ast_sip_endpoint *endpoint)
Internal function which finds (or creates) persistent endpoint information.
int AST_OPTIONAL_API_NAME() ast_geoloc_is_loaded(void)
Check if res_geolocation is available.
struct ast_geoloc_profile *AST_OPTIONAL_API_NAME() ast_geoloc_get_profile(const char *id)
Retrieve a geolocation profile by id.
@ AST_SIP_CALL_CODEC_PREF_ALL
Definition res_pjsip.h:777
@ AST_SIP_CALL_CODEC_PREF_LOCAL
Definition res_pjsip.h:783
@ AST_SIP_CALL_CODEC_PREF_FIRST
Definition res_pjsip.h:779
@ AST_SIP_CALL_CODEC_PREF_INTERSECT
Definition res_pjsip.h:771
@ AST_RTP_DTLS_SETUP_ACTPASS
Definition rtp_engine.h:567
@ AST_RTP_DTLS_VERIFY_FINGERPRINT
Definition rtp_engine.h:586
int ast_rtp_dtls_cfg_validate(struct ast_rtp_dtls_cfg *dtls_cfg)
Validates DTLS related configuration options.
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...
Definition stream.c:851
char *attribute_pure ast_skip_nonblanks(const char *str)
Gets a pointer to first whitespace character in a string.
Definition strings.h:204
char *attribute_pure ast_skip_blanks(const char *str)
Gets a pointer to the first non-whitespace character in a string.
Definition strings.h:161
unsigned int flags
Definition utils.h:221
unsigned int enabled
Definition rtp_engine.h:606
struct ast_sip_timer_options timer
Definition res_pjsip.h:819
const ast_string_field sdpowner
Definition res_pjsip.h:1011
const ast_string_field sdpsession
Definition res_pjsip.h:1011
unsigned int preferred_codec_only
Definition res_pjsip.h:1144
unsigned int sess_expires
Definition res_pjsip.h:806
unsigned int min_se
Definition res_pjsip.h:804

References ao2_cleanup, ast_clear_flag, ast_geoloc_get_profile(), ast_geoloc_is_loaded(), ast_log, ast_rtp_dtls_cfg_validate(), AST_RTP_DTLS_SETUP_ACTPASS, AST_RTP_DTLS_VERIFY_FINGERPRINT, ast_set_flag, AST_SIP_CALL_CODEC_PREF_ALL, AST_SIP_CALL_CODEC_PREF_FIRST, AST_SIP_CALL_CODEC_PREF_INTERSECT, AST_SIP_CALL_CODEC_PREF_LOCAL, AST_SIP_MEDIA_ENCRYPT_DTLS, ast_skip_blanks(), ast_skip_nonblanks(), ast_sorcery_object_get_id(), ast_stream_topology_create_from_format_cap(), ast_string_field_set, ast_strlen_zero(), ast_sip_endpoint_media_configuration::bundle, ast_rtp_dtls_cfg::certfile, ast_sip_endpoint_media_configuration::codecs, ast_rtp_dtls_cfg::default_setup, ast_sip_media_rtp_configuration::dtls_cfg, ast_rtp_dtls_cfg::enabled, ast_sip_media_rtp_configuration::encryption, ast_rtp_dtls_cfg::ephemeral_cert, ast_sip_endpoint::extensions, ast_flags::flags, ast_sip_media_rtp_configuration::ice_support, ast_sip_endpoint_media_configuration::incoming_call_offer_pref, LOG_ERROR, LOG_WARNING, ast_sip_endpoint::media, ast_sip_timer_options::min_se, ast_sip_endpoint::persistent, persistent_endpoint_find_or_create(), ast_sip_endpoint::preferred_codec_only, ast_rtp_dtls_cfg::rekey, ast_sip_endpoint_media_configuration::rtcp_mux, ast_sip_endpoint_media_configuration::rtp, ast_sip_endpoint_media_configuration::sdpowner, ast_sip_endpoint_media_configuration::sdpsession, ast_sip_timer_options::sess_expires, ast_sip_endpoint_extensions::timer, ast_sip_endpoint_media_configuration::topology, ast_sip_media_rtp_configuration::use_avpf, ast_sip_media_rtp_configuration::use_received_transport, ast_rtp_dtls_cfg::verify, and ast_sip_endpoint_media_configuration::webrtc.

Referenced by ast_res_pjsip_initialize_configuration().

◆ sip_endpoint_identifier_str2type()

static int sip_endpoint_identifier_str2type ( const char *  str)
static

Definition at line 442 of file pjsip_configuration.c.

443{
444 int method;
445
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")) {
456 } else {
457 method = -1;
458 }
459 return method;
460}
@ AST_SIP_ENDPOINT_IDENTIFY_BY_HEADER
Definition res_pjsip.h:707
@ AST_SIP_ENDPOINT_IDENTIFY_BY_USERNAME
Definition res_pjsip.h:701
@ AST_SIP_ENDPOINT_IDENTIFY_BY_REQUEST_URI
Definition res_pjsip.h:709
@ AST_SIP_ENDPOINT_IDENTIFY_BY_IP
Definition res_pjsip.h:705
@ AST_SIP_ENDPOINT_IDENTIFY_BY_AUTH_USERNAME
Definition res_pjsip.h:703

References AST_SIP_ENDPOINT_IDENTIFY_BY_AUTH_USERNAME, AST_SIP_ENDPOINT_IDENTIFY_BY_HEADER, AST_SIP_ENDPOINT_IDENTIFY_BY_IP, AST_SIP_ENDPOINT_IDENTIFY_BY_REQUEST_URI, AST_SIP_ENDPOINT_IDENTIFY_BY_USERNAME, method, and str.

Referenced by ident_handler().

◆ sip_endpoint_identifier_type2str()

static const char * sip_endpoint_identifier_type2str ( enum ast_sip_endpoint_identifier_type  method)
static

Definition at line 409 of file pjsip_configuration.c.

410{
411 const char *str = "<unknown>";
412
413 switch (method) {
415 str = "username";
416 break;
418 str = "auth_username";
419 break;
421 str = "ip";
422 break;
424 str = "header";
425 break;
427 str = "request_uri";
428 break;
429 }
430 return str;
431}

References AST_SIP_ENDPOINT_IDENTIFY_BY_AUTH_USERNAME, AST_SIP_ENDPOINT_IDENTIFY_BY_HEADER, AST_SIP_ENDPOINT_IDENTIFY_BY_IP, AST_SIP_ENDPOINT_IDENTIFY_BY_REQUEST_URI, AST_SIP_ENDPOINT_IDENTIFY_BY_USERNAME, method, and str.

Referenced by ident_to_str().

◆ sip_endpoint_to_ami()

static int sip_endpoint_to_ami ( const struct ast_sip_endpoint endpoint,
struct ast_str **  buf 
)
static

Definition at line 1869 of file pjsip_configuration.c.

1871{
1872 if (ast_sip_sorcery_object_to_ami(endpoint, buf)) {
1873 return -1;
1874 }
1875
1876 ast_str_append(buf, 0, "DeviceState: %s\r\n",
1877 ast_sip_get_device_state(endpoint));
1878
1879 ast_str_append(buf, 0, "ActiveChannels: ");
1880 active_channels_to_str(endpoint, buf);
1881 ast_str_append(buf, 0, "\r\n");
1882
1883 return 0;
1884}
int ast_sip_sorcery_object_to_ami(const void *obj, struct ast_str **buf)
Converts a sorcery object to a string of object properties.

References active_channels_to_str(), ast_sip_get_device_state(), ast_sip_sorcery_object_to_ami(), ast_str_append(), and buf.

Referenced by format_ami_endpoint().

◆ sip_endpoints_aors_ami()

static int sip_endpoints_aors_ami ( void *  obj,
void *  arg,
int  flags 
)
static

Definition at line 1857 of file pjsip_configuration.c.

1858{
1859 struct ast_sip_aor *aor = obj;
1860 struct ast_str **buf = arg;
1861
1862 ast_str_append(buf, 0, "Contacts: ");
1864 ast_str_append(buf, 0, "\r\n");
1865
1866 return 0;
1867}
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.
Definition location.c:723
int ast_sip_contact_to_str(void *object, void *arg, int flags)
Handler used to convert a contact to a string.
Definition location.c:771
A SIP address of record.
Definition res_pjsip.h:478

References ast_sip_contact_to_str(), ast_sip_for_each_contact(), ast_str_append(), and buf.

Referenced by format_ami_endpoints().

◆ sip_nat_hook_alloc()

static void * sip_nat_hook_alloc ( const char *  name)
static

Definition at line 1475 of file pjsip_configuration.c.

1476{
1477 return ast_sorcery_generic_alloc(sizeof(struct ast_sip_nat_hook), NULL);
1478}
Structure for SIP nat hook information.
Definition res_pjsip.h:327

References ast_sorcery_generic_alloc(), and NULL.

Referenced by ast_res_pjsip_initialize_configuration().

◆ sip_sorcery_object_ami_set_type_name()

static void sip_sorcery_object_ami_set_type_name ( const void *  obj,
struct ast_str **  buf 
)
static

Definition at line 1829 of file pjsip_configuration.c.

1830{
1831 ast_str_append(buf, 0, "ObjectType: %s\r\n",
1833 ast_str_append(buf, 0, "ObjectName: %s\r\n",
1835}
const char * ast_sorcery_object_get_type(const void *object)
Get the type of a sorcery object.
Definition sorcery.c:2393

References ast_sorcery_object_get_id(), ast_sorcery_object_get_type(), ast_str_append(), and buf.

Referenced by ast_sip_sorcery_object_to_ami(), and format_ami_endpoints().

◆ stir_shaken_handler()

static int stir_shaken_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 894 of file pjsip_configuration.c.

895{
896 struct ast_sip_endpoint *endpoint = obj;
897
898 ast_log(LOG_WARNING, "Endpoint %s: Option 'stir_shaken' is no longer supported. Use 'stir_shaken_profile' instead.\n",
899 ast_sorcery_object_get_id(endpoint));
900 endpoint->stir_shaken = 0;
901
902 return 0;
903}
unsigned int stir_shaken
Definition res_pjsip.h:1162

References ast_log, ast_sorcery_object_get_id(), LOG_WARNING, and ast_sip_endpoint::stir_shaken.

Referenced by ast_res_pjsip_initialize_configuration().

◆ stir_shaken_to_str()

static int stir_shaken_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 905 of file pjsip_configuration.c.

906{
907 *buf = ast_strdup("no");
908
909 return 0;
910}

References ast_strdup, and buf.

Referenced by ast_res_pjsip_initialize_configuration().

◆ subscription_configuration_destroy()

static void subscription_configuration_destroy ( struct ast_sip_endpoint_subscription_configuration subscription)
static

◆ t38udptl_ec_handler()

static int t38udptl_ec_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1108 of file pjsip_configuration.c.

1110{
1111 struct ast_sip_endpoint *endpoint = obj;
1112
1113 if (!strcmp(var->value, "none")) {
1115 } else if (!strcmp(var->value, "fec")) {
1117 } else if (!strcmp(var->value, "redundancy")) {
1119 } else {
1120 return -1;
1121 }
1122
1123 return 0;
1124}
struct ast_sip_t38_configuration t38
Definition res_pjsip.h:1017
enum ast_t38_ec_modes error_correction
Definition res_pjsip.h:989
@ UDPTL_ERROR_CORRECTION_FEC
Definition udptl.h:39
@ UDPTL_ERROR_CORRECTION_NONE
Definition udptl.h:38
@ UDPTL_ERROR_CORRECTION_REDUNDANCY
Definition udptl.h:40

References ast_sip_t38_configuration::error_correction, ast_sip_endpoint::media, ast_sip_endpoint_media_configuration::t38, UDPTL_ERROR_CORRECTION_FEC, UDPTL_ERROR_CORRECTION_NONE, UDPTL_ERROR_CORRECTION_REDUNDANCY, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ t38udptl_ec_to_str()

static int t38udptl_ec_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

◆ timers_handler()

static int timers_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 220 of file pjsip_configuration.c.

221{
222 struct ast_sip_endpoint *endpoint = obj;
223
224 /* clear all */
225 endpoint->extensions.flags &= ~(PJSIP_INV_SUPPORT_TIMER | PJSIP_INV_REQUIRE_TIMER
226 | PJSIP_INV_ALWAYS_USE_TIMER);
227
228 /* set only the specified flag and let pjsip normalize if needed */
229 if (ast_true(var->value)) {
230 endpoint->extensions.flags |= PJSIP_INV_SUPPORT_TIMER;
231 } else if (!strcasecmp(var->value, "required")) {
232 endpoint->extensions.flags |= PJSIP_INV_REQUIRE_TIMER;
233 } else if (!strcasecmp(var->value, "always") || !strcasecmp(var->value, "forced")) {
234 endpoint->extensions.flags |= (PJSIP_INV_SUPPORT_TIMER | PJSIP_INV_ALWAYS_USE_TIMER);
235 } else if (!ast_false(var->value)) {
236 return -1;
237 }
238
239 return 0;
240}

References ast_false(), ast_true(), ast_sip_endpoint::extensions, ast_sip_endpoint_extensions::flags, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ timers_to_str()

static int timers_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 242 of file pjsip_configuration.c.

243{
244 const struct ast_sip_endpoint *endpoint = obj;
245
246 if (endpoint->extensions.flags & PJSIP_INV_ALWAYS_USE_TIMER) {
247 *buf = "always";
248 } else if (endpoint->extensions.flags & PJSIP_INV_REQUIRE_TIMER) {
249 *buf = "required";
250 } else if (endpoint->extensions.flags & PJSIP_INV_SUPPORT_TIMER) {
251 *buf = "yes";
252 } else {
253 *buf = "no";
254 }
255
256 *buf = ast_strdup(*buf);
257 return 0;
258}

References ast_strdup, buf, ast_sip_endpoint::extensions, and ast_sip_endpoint_extensions::flags.

Referenced by ast_res_pjsip_initialize_configuration().

◆ tos_audio_to_str()

static int tos_audio_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 1167 of file pjsip_configuration.c.

1168{
1169 const struct ast_sip_endpoint *endpoint = obj;
1170
1171 if (ast_asprintf(buf, "%u", endpoint->media.tos_audio) == -1) {
1172 return -1;
1173 }
1174 return 0;
1175}

References ast_asprintf, buf, ast_sip_endpoint::media, and ast_sip_endpoint_media_configuration::tos_audio.

Referenced by ast_res_pjsip_initialize_configuration().

◆ tos_handler()

static int tos_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

Definition at line 1142 of file pjsip_configuration.c.

1144{
1145 struct ast_sip_endpoint *endpoint = obj;
1146 unsigned int value;
1147
1148 if (ast_str2tos(var->value, &value)) {
1149 ast_log(LOG_ERROR, "Error configuring endpoint '%s' - Could not "
1150 "interpret '%s' value '%s'\n",
1151 ast_sorcery_object_get_id(endpoint), var->name, var->value);
1152 return -1;
1153 }
1154
1155 if (!strcmp(var->name, "tos_audio")) {
1156 endpoint->media.tos_audio = value;
1157 } else if (!strcmp(var->name, "tos_video")) {
1158 endpoint->media.tos_video = value;
1159 } else {
1160 /* If we reach this point, someone called the tos_handler when they shouldn't have. */
1161 ast_assert(0);
1162 return -1;
1163 }
1164 return 0;
1165}
int ast_str2tos(const char *value, unsigned int *tos)
Convert a string to the appropriate TOS value.
Definition acl.c:983

References ast_assert, ast_log, ast_sorcery_object_get_id(), ast_str2tos(), LOG_ERROR, ast_sip_endpoint::media, ast_sip_endpoint_media_configuration::tos_audio, ast_sip_endpoint_media_configuration::tos_video, value, and var.

Referenced by ast_res_pjsip_initialize_configuration().

◆ tos_video_to_str()

static int tos_video_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Definition at line 1177 of file pjsip_configuration.c.

1178{
1179 const struct ast_sip_endpoint *endpoint = obj;
1180
1181 if (ast_asprintf(buf, "%u", endpoint->media.tos_video) == -1) {
1182 return -1;
1183 }
1184 return 0;
1185}

References ast_asprintf, buf, ast_sip_endpoint::media, and ast_sip_endpoint_media_configuration::tos_video.

Referenced by ast_res_pjsip_initialize_configuration().

◆ voicemail_extension_handler()

static int voicemail_extension_handler ( const struct aco_option opt,
struct ast_variable var,
void *  obj 
)
static

◆ voicemail_extension_to_str()

static int voicemail_extension_to_str ( const void *  obj,
const intptr_t *  args,
char **  buf 
)
static

Variable Documentation

◆ acl_change_sub

struct stasis_subscription* acl_change_sub
static

◆ ast_rtp_dtls_fingerprint_map

const char* ast_rtp_dtls_fingerprint_map[]
static
Initial value:
= {
[AST_RTP_DTLS_HASH_SHA256] = "SHA-256",
}
@ AST_RTP_DTLS_HASH_SHA1
Definition rtp_engine.h:580
@ AST_RTP_DTLS_HASH_SHA256
Definition rtp_engine.h:579

Definition at line 1094 of file pjsip_configuration.c.

1094 {
1095 [AST_RTP_DTLS_HASH_SHA256] = "SHA-256",
1096 [AST_RTP_DTLS_HASH_SHA1] = "SHA-1",
1097};

Referenced by dtlsfingerprint_to_str().

◆ ast_rtp_dtls_setup_map

const char* ast_rtp_dtls_setup_map[]
static

Definition at line 1078 of file pjsip_configuration.c.

1078 {
1079 [AST_RTP_DTLS_SETUP_ACTIVE] = "active",
1080 [AST_RTP_DTLS_SETUP_PASSIVE] = "passive",
1081 [AST_RTP_DTLS_SETUP_ACTPASS] = "actpass",
1082 [AST_RTP_DTLS_SETUP_HOLDCONN] = "holdconn",
1083};
@ AST_RTP_DTLS_SETUP_PASSIVE
Definition rtp_engine.h:566
@ AST_RTP_DTLS_SETUP_HOLDCONN
Definition rtp_engine.h:568
@ AST_RTP_DTLS_SETUP_ACTIVE
Definition rtp_engine.h:565

Referenced by dtlssetup_to_str().

◆ ast_t38_ec_modes_map

const char* ast_t38_ec_modes_map[]
static
Initial value:

Definition at line 1126 of file pjsip_configuration.c.

1126 {
1127 [UDPTL_ERROR_CORRECTION_NONE] = "none",
1129 [UDPTL_ERROR_CORRECTION_REDUNDANCY] = "redundancy"
1130};

Referenced by t38udptl_ec_to_str().

◆ channel_formatter

struct ast_sip_cli_formatter_entry* channel_formatter

Definition at line 2180 of file pjsip_configuration.c.

◆ cli_commands

struct ast_cli_entry cli_commands[]
static

Definition at line 2163 of file pjsip_configuration.c.

2163 {
2164 AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "List PJSIP Endpoints",
2165 .command = "pjsip list endpoints",
2166 .usage = "Usage: pjsip list endpoints [ like <pattern> ]\n"
2167 " List the configured PJSIP endpoints\n"
2168 " Optional regular expression pattern is used to filter the list.\n"),
2169 AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "Show PJSIP Endpoints",
2170 .command = "pjsip show endpoints",
2171 .usage = "Usage: pjsip show endpoints [ like <pattern> ]\n"
2172 " List(detailed) the configured PJSIP endpoints\n"
2173 " Optional regular expression pattern is used to filter the list.\n"),
2174 AST_CLI_DEFINE(ast_sip_cli_traverse_objects, "Show PJSIP Endpoint",
2175 .command = "pjsip show endpoint",
2176 .usage = "Usage: pjsip show endpoint <id>\n"
2177 " Show the configured PJSIP endpoint\n"),
2178};
#define AST_CLI_DEFINE(fn, txt,...)
Definition cli.h:197
char * ast_sip_cli_traverse_objects(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Definition pjsip_cli.c:109
char * usage
Definition utils/frame.c:37

Referenced by ast_res_pjsip_destroy_configuration(), and ast_res_pjsip_initialize_configuration().

◆ direct_media_glare_mitigation_map

const char* direct_media_glare_mitigation_map[]
static

◆ endpoint_formatter

struct ast_sip_cli_formatter_entry* endpoint_formatter

◆ endpoint_observers

const struct ast_sorcery_observer endpoint_observers
static
Initial value:
= {
}
static void endpoint_deleted_observer(const void *object)

Definition at line 85 of file pjsip_configuration.c.

85 {
87};

Referenced by ast_res_pjsip_initialize_configuration().

◆ id_configuration_refresh_methods

const char* id_configuration_refresh_methods[]
static

◆ media_encryption_map

const char* media_encryption_map[]
static

Definition at line 877 of file pjsip_configuration.c.

877 {
882};
@ AST_SIP_MEDIA_TRANSPORT_INVALID
Definition res_pjsip.h:735

Referenced by media_encryption_to_str().

◆ persistent_endpoints

struct ao2_container* persistent_endpoints
static

◆ redirect_method_map

const char* redirect_method_map[]
static
Initial value:
= {
[AST_SIP_REDIRECT_URI_CORE] = "uri_core",
[AST_SIP_REDIRECT_URI_PJSIP] = "uri_pjsip",
}

Definition at line 589 of file pjsip_configuration.c.

589 {
590 [AST_SIP_REDIRECT_USER] = "user",
591 [AST_SIP_REDIRECT_URI_CORE] = "uri_core",
592 [AST_SIP_REDIRECT_URI_PJSIP] = "uri_pjsip",
593};

◆ redirect_method_mappings

const struct redirect_method_map redirect_method_mappings[]
static
Initial value:
= {
}
@ AST_SIP_REDIRECT_METHOD_MESSAGE
Definition res_pjsip.h:760

Definition at line 612 of file pjsip_configuration.c.

612 {
613 { "message", AST_SIP_REDIRECT_METHOD_MESSAGE },
614};

Referenced by follow_redirect_methods_handler(), and follow_redirect_methods_to_str().

◆ security_negotiation_map

const char* security_negotiation_map[]
static
Initial value:

Definition at line 274 of file pjsip_configuration.c.

274 {
276 [AST_SIP_SECURITY_NEG_MEDIASEC] = "mediasec",
277};

Referenced by security_negotiation_to_str().

◆ sip_sorcery

struct ast_sorcery* sip_sorcery
static