153 ast_log(
LOG_ERROR,
"Unable to allocate memory for phoneprov structure %s\n",
229 const char *auth_name;
247 if (endpoint->id.self.number.valid && !
ast_strlen_zero(endpoint->id.self.number.str)) {
249 endpoint->id.self.number.str, vars);
252 if (endpoint->id.self.name.valid && !
ast_strlen_zero(endpoint->id.self.name.str)) {
255 endpoint->id.self.name.str, vars);
259 endpoint->transport);
261 ast_log(
LOG_ERROR,
"Endpoint %s contained invalid transport %s.\n", endpoint_name,
262 endpoint->transport);
265 snprintf(port_string, 6,
"%d", pj_sockaddr_get_port(&transport->host));
274 ast_log(
LOG_ERROR,
"phoneprov %s contained invalid auth %s.\n",
id, auth_name);
292 const char *endpoint_name;
374 "pjsip.conf,criteria=type=phoneprov");
419 .
requires =
"res_pjsip,res_phoneprov",
Asterisk main include file. File version handling, generic pbx functions.
#define ao2_iterator_next(iter)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
void ast_var_list_destroy(struct varshead *head)
char * ast_var_find(const struct varshead *head, const char *name)
static void AST_VAR_LIST_INSERT_TAIL(struct varshead *head, struct ast_var_t *var)
#define AST_VAR_LIST_TRAVERSE(head, var)
#define ast_var_assign(name, value)
struct varshead * ast_var_list_create(void)
@ OPT_NOOP_T
Type for a default handler that should do nothing.
#define ast_variable_new(name, value, filename)
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_EXTENDED
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
void ast_phoneprov_provider_unregister(char *provider_name)
Unegisters a config provider from phoneprov and frees its resources.
const char * ast_phoneprov_std_variable_lookup(enum ast_phoneprov_std_variables var)
Returns the string respresentation of a phoneprov standard variable.
int ast_phoneprov_add_extension(char *provider_name, struct varshead *vars)
Adds an extension.
@ AST_PHONEPROV_STD_SERVER_PORT
@ AST_PHONEPROV_STD_CALLERID
@ AST_PHONEPROV_STD_USERNAME
@ AST_PHONEPROV_STD_LABEL
@ AST_PHONEPROV_STD_PROFILE
@ AST_PHONEPROV_STD_DISPLAY_NAME
@ AST_PHONEPROV_STD_SECRET
void ast_phoneprov_delete_extension(char *provider_name, char *macaddress)
Deletes an extension.
int ast_phoneprov_provider_register(char *provider_name, ast_phoneprov_load_users_cb load_users)
Registers a config provider to phoneprov.
struct ao2_container * users
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
static void users_apply_handler(struct phoneprov *pp)
Callback that validates the phoneprov object.
static int load_endpoint(const char *id, const char *endpoint_name, struct varshead *vars, char *port_string)
static int aco_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Adds a config name/value pair to the phoneprov object.
static int reload_module(void)
static struct ast_sorcery * sorcery
static void phoneprov_destroy(void *obj)
Destructor function for phoneprov.
static int load_module(void)
static int assign_and_insert(const char *name, const char *value, struct varshead *vars)
Helper that creates an ast_var_t and inserts it into the list.
static int load_users(void)
Callback that loads the users from phoneprov sections.
static int unload_module(void)
static void * phoneprov_alloc(const char *name)
Allocator for phoneprov.
static int fields_handler(const void *obj, struct ast_variable **fields)
Converts the phoneprov varlist to an ast_variable list.
Sorcery Data Access Layer API.
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
int ast_sorcery_object_fields_register(struct ast_sorcery *sorcery, const char *type, const char *regex, aco_option_handler config_handler, sorcery_fields_handler sorcery_handler)
Register a regex for multiple fields within an 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.
void ast_sorcery_load_object(const struct ast_sorcery *sorcery, const char *type)
Inform any wizards of a specific object type to load persistent objects.
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
#define ast_sorcery_apply_config(sorcery, name)
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
#define ast_sorcery_apply_default(sorcery, type, name, data)
void ast_sorcery_reload_object(const struct ast_sorcery *sorcery, const char *type)
Inform any wizards of a specific object type to reload persistent objects.
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 S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
const ast_string_field auth_user
const ast_string_field auth_pass
An entity with which Asterisk communicates.
Full structure for sorcery.
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
Structure for a phoneprov object.
list of users found in the config file
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#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.