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",
struct ast_variable * next
Asterisk main include file. File version handling, generic pbx functions.
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
static int load_endpoint(const char *id, const char *endpoint_name, struct varshead *vars, char *port_string)
Structure for variables, used for configurations and for channel variables.
Perform no matching, return all objects.
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.
Full structure for sorcery.
Type for a default handler that should do nothing.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ast_sorcery_apply_config(sorcery, name)
Return all matching objects.
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.
#define ast_strlen_zero(foo)
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
int ast_phoneprov_provider_register(char *provider_name, ast_phoneprov_load_users_cb load_users)
Registers a config provider to phoneprov.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
void ast_phoneprov_provider_unregister(char *provider_name)
Unegisters a config provider from phoneprov and frees its resources.
#define ao2_ref(o, delta)
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
#define ast_variable_new(name, value, filename)
static void phoneprov_destroy(void *obj)
Destructor function for phoneprov.
An entity with which Asterisk communicates.
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
static int unload_module(void)
#define ast_sorcery_apply_default(sorcery, type, name, data)
#define ao2_iterator_next(iter)
struct ao2_container * users
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.
char * ast_var_find(const struct varshead *head, const char *name)
#define ast_var_assign(name, value)
const ast_string_field auth_pass
static void users_apply_handler(struct phoneprov *pp)
Callback that validates the phoneprov object.
Module has failed to load, may be in an inconsistent state.
Structure for a phoneprov object.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
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_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
static void * phoneprov_alloc(const char *name)
Allocator for phoneprov.
struct varshead * ast_var_list_create(void)
int ast_phoneprov_add_extension(char *provider_name, struct varshead *vars)
Adds an extension.
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
static struct ast_sorcery * sorcery
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
static int load_users(void)
Callback that loads the users from phoneprov sections.
const char * ast_phoneprov_std_variable_lookup(enum ast_phoneprov_std_variables var)
Returns the string respresentation of a phoneprov standard variable.
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 fields_handler(const void *obj, struct ast_variable **fields)
Converts the phoneprov varlist to an ast_variable list.
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
#define AST_VAR_LIST_TRAVERSE(head, var)
#define ASTERISK_GPL_KEY
The text the key() function should return.
void ast_phoneprov_delete_extension(char *provider_name, char *macaddress)
Deletes an extension.
Asterisk module definitions.
void ast_var_list_destroy(struct varshead *head)
static int reload_module(void)
static void AST_VAR_LIST_INSERT_TAIL(struct varshead *head, struct ast_var_t *var)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
const ast_string_field auth_user
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
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.
Sorcery Data Access Layer API.
static int load_module(void)