55 if (!strcasecmp(
var->value,
"userpass")) {
57 }
else if (!strcasecmp(
var->value,
"md5")) {
59 }
else if (!strcasecmp(
var->value,
"google_oauth")) {
60#ifdef HAVE_PJSIP_OAUTH_AUTHENTICATION
63 ast_log(
LOG_WARNING,
"OAuth support is not available in the version of PJSIP in use\n");
104 switch (auth->
type) {
110 }
else if (strlen(auth->
md5_creds) != PJSIP_MD5STRLEN) {
111 ast_log(
LOG_ERROR,
"'md5' authentication requires digest of size '%d', but "
112 "digest is '%d' in size for auth '%s'\n", PJSIP_MD5STRLEN, (
int)strlen(auth->
md5_creds),
121 ast_log(
LOG_ERROR,
"'google_oauth' authentication specified but refresh_token,"
122 " oauth_clientid, or oauth_secret not specified for auth '%s'\n",
154 if (on_auth(auth, arg, 0)) {
204 ami->
arg = (
void *)endpoint;
320 "%*s: <AuthId/UserName%*.*s>\n", indent,
"I/OAuth", filler, filler,
334 snprintf(title,
sizeof(title),
"%sAuth",
342 || (
context->show_details_only_level_0 &&
context->indent_level == 0)) {
353 .
usage =
"Usage: pjsip list auths [ like <pattern> ]\n"
354 " List the configured PJSIP Auths\n"
355 " Optional regular expression pattern is used to filter the list.\n"),
358 .
usage =
"Usage: pjsip show auths [ like <pattern> ]\n"
359 " Show the configured PJSIP Auths\n"
360 " Optional regular expression pattern is used to filter the list.\n"),
363 .
usage =
"Usage: pjsip show auth <id>\n"
364 " Show the configured PJSIP Auth\n"),
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
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
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
int() ao2_callback_fn(void *obj, void *arg, int flags)
Type of a generic callback function.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a list container.
#define ao2_alloc(data_size, destructor_fn)
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static struct ast_cli_entry cli_commands[]
static int cli_print_header(void *obj, void *arg, int flags)
static int cli_iterator(void *container, ao2_callback_fn callback, void *args)
int ast_sip_format_auths_ami(const struct ast_sip_auth_vector *auths, struct ast_sip_ami *ami)
Format auth details for AMI.
static int sip_auth_to_ami(const struct ast_sip_auth *auth, struct ast_str **buf)
static const char * auth_types_map[]
static int format_ami_authlist_handler(void *obj, void *arg, int flags)
static struct ast_sip_endpoint_formatter endpoint_auth_formatter
static void * auth_alloc(const char *name)
static struct ao2_container * cli_get_auths(void)
static int format_ami_auth_handler(void *obj, void *arg, int flags)
static void * cli_retrieve_by_id(const char *id)
static int auth_type_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
static int auth_apply(const struct ast_sorcery *sorcery, void *obj)
static struct ao2_container * cli_get_container(const char *regex)
static int format_ami_endpoint_auth(const struct ast_sip_endpoint *endpoint, struct ast_sip_ami *ami)
static int cli_print_body(void *obj, void *arg, int flags)
static int ami_show_auths(struct mansession *s, const struct message *m)
int ast_sip_for_each_auth(const struct ast_sip_auth_vector *vector, ao2_callback_fn on_auth, void *arg)
For every auth in the array call the given 'on_auth' handler.
static int auth_type_to_str(const void *obj, const intptr_t *args, char **buf)
int ast_sip_destroy_sorcery_auth(void)
const char * ast_sip_auth_type_to_str(enum ast_sip_auth_type type)
Converts the given auth type to a string.
static struct ast_sip_cli_formatter_entry * cli_formatter
int ast_sip_initialize_sorcery_auth(void)
Initialize sorcery with auth support.
static void auth_destroy(void *obj)
#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.
@ OPT_UINT_T
Type for default option handler for unsigned integers.
@ OPT_NOOP_T
Type for a default handler that should do nothing.
@ OPT_STRINGFIELD_T
Type for default option handler for stringfields.
static int regex(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
void astman_send_listack(struct mansession *s, const struct message *m, char *msg, char *listflag)
Send ack in manager transaction to begin a list.
void astman_send_error(struct mansession *s, const struct message *m, char *error)
Send error in manager transaction.
void astman_send_list_complete_start(struct mansession *s, const struct message *m, const char *event_name, int count)
Start the list complete event.
const char * astman_get_header(const struct message *m, char *var)
Get header from manager transaction.
void astman_send_list_complete_end(struct mansession *s)
End the list complete event.
void astman_append(struct mansession *s, const char *fmt,...)
int ast_manager_unregister(const char *action)
Unregister a registered manager command.
Support for logging to various files, console and syslog Configuration in file logger....
#define EVENT_FLAG_SYSTEM
#define ast_manager_register_xml(action, authority, func)
Register a manager callback using XML documentation to describe the manager.
struct ao2_container * container
void ast_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
Register an endpoint formatter.
void ast_sip_unregister_endpoint_formatter(struct ast_sip_endpoint_formatter *obj)
Unregister an endpoint formatter.
int ast_sip_sorcery_object_to_ami(const void *obj, struct ast_str **buf)
Converts a sorcery object to a string of object properties.
ast_sip_auth_type
Methods of storing SIP digest authentication credentials.
@ AST_SIP_AUTH_TYPE_GOOGLE_OAUTH
@ AST_SIP_AUTH_TYPE_ARTIFICIAL
@ AST_SIP_AUTH_TYPE_USER_PASS
#define SIP_SORCERY_AUTH_TYPE
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.
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
int ast_sip_unregister_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Unregisters a CLI formatter.
#define CLI_HEADER_FILLER
int ast_sip_cli_print_sorcery_objectset(void *obj, void *arg, int flags)
Prints a sorcery object's ast_variable list.
char * ast_sip_cli_traverse_objects(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define CLI_INDENT_TO_SPACES(x)
int ast_sip_register_cli_formatter(struct ast_sip_cli_formatter_entry *formatter)
Registers a CLI formatter.
static struct ast_sorcery * sorcery
Sorcery Data Access Layer API.
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
@ AST_RETRIEVE_FLAG_MULTIPLE
Return all matching objects.
@ AST_RETRIEVE_FLAG_ALL
Perform no matching, return all objects.
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
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.
#define ast_sorcery_object_field_register_custom(sorcery, type, name, default_val, config_handler, sorcery_handler, multiple_handler, flags,...)
Register a field within an object with custom handlers.
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
int ast_sorcery_object_id_compare(void *obj, void *arg, int flags)
ao2 object comparator based on sorcery id.
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
int ast_sorcery_object_id_sort(const void *obj, const void *arg, int flags)
ao2 object sorter based on sorcery id.
#define ast_sorcery_apply_default(sorcery, type, name, data)
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.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
descriptor for a cli entry.
const ast_string_field oauth_clientid
const ast_string_field oauth_secret
const ast_string_field md5_creds
const ast_string_field auth_user
const ast_string_field refresh_token
enum ast_sip_auth_type type
CLI Formatter Context passed to all formatters.
CLI Formatter Registry Entry.
int(* iterate)(void *container, ao2_callback_fn callback, void *args)
ao2_callback_fn * print_header
void *(* retrieve_by_id)(const char *id)
const char *(* get_id)(const void *obj)
ao2_callback_fn * print_body
struct ao2_container *(* get_container)(const char *regex)
An entity with which Asterisk communicates.
struct ast_sip_auth_vector outbound_auths
struct ast_sip_auth_vector inbound_auths
Full structure for sorcery.
Support for dynamic strings.
Structure for variables, used for configurations and for channel variables.
In case you didn't read that giant block of text above the mansession_session struct,...
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ARRAY_IN_BOUNDS(v, a)
Checks to see if value is within the bounds of the given array.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.