Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Phone provisioning application for the asterisk internal http server. More...
#include "asterisk.h"
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
#include "asterisk/channel.h"
#include "asterisk/file.h"
#include "asterisk/paths.h"
#include "asterisk/pbx.h"
#include "asterisk/cli.h"
#include "asterisk/module.h"
#include "asterisk/http.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
#include "asterisk/strings.h"
#include "asterisk/stringfields.h"
#include "asterisk/options.h"
#include "asterisk/config.h"
#include "asterisk/acl.h"
#include "asterisk/astobj2.h"
#include "asterisk/ast_version.h"
#include "asterisk/phoneprov.h"
Go to the source code of this file.
Data Structures | |
struct | extension |
structure to hold extensions More... | |
struct | http_route |
structure to hold http routes (valid URIs, and the files they link to) More... | |
struct | phone_profile |
structure to hold phone profiles read from phoneprov.conf More... | |
struct | phoneprov_file |
structure to hold file data More... | |
struct | phoneprov_provider |
structure to hold config providers More... | |
struct | user |
structure to hold users read from users.conf More... | |
Macros | |
#define | AST_API_MODULE |
#define | FORMATD "%-20.20s %-20.20s %-40.40s %-30.30s\n" |
#define | FORMATS "%-20.20s %-40.40s %-30.30s\n" |
#define | MAX_PROFILE_BUCKETS 17 |
#define | MAX_PROVIDER_BUCKETS 17 |
#define | MAX_ROUTE_BUCKETS 563 |
#define | MAX_USER_BUCKETS 563 |
#define | SIMPLE_CMP_FN(fname, stype, field) |
Creates a compare function for a structure string field. More... | |
#define | SIMPLE_HASH_FN(fname, stype, field) |
Creates a hash function for a structure string field. More... | |
#define | SIPUSERS_PROVIDER_NAME "sipusers" |
#define | VAR_BUF_SIZE 4096 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | add_user_extension (struct user *user, struct extension *exten) |
Add an extension to a user ordered by index/linenumber. More... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
int | ast_phoneprov_add_extension (char *provider_name, struct varshead *vars) |
Adds an extension. More... | |
void | ast_phoneprov_delete_extension (char *provider_name, char *macaddress) |
Deletes an extension. More... | |
void | ast_phoneprov_delete_extensions (char *provider_name) |
Deletes all extensions for this provider. More... | |
int | ast_phoneprov_provider_register (char *provider_name, ast_phoneprov_load_users_cb load_users) |
Registers a config provider to phoneprov. More... | |
void | ast_phoneprov_provider_unregister (char *provider_name) |
Unegisters a config provider from phoneprov and frees its resources. More... | |
const char * | ast_phoneprov_std_variable_lookup (enum ast_phoneprov_std_variables var) |
Returns the string respresentation of a phoneprov standard variable. More... | |
static struct extension * | build_extension (const char *name, struct varshead *vars) |
static void | build_profile (const char *name, struct ast_variable *v) |
Build a phone profile and add it to the list of phone profiles. More... | |
static void | build_route (struct phoneprov_file *pp_file, struct phone_profile *profile, struct user *user, char *uri) |
Build a route structure and add it to the list of available http routes. More... | |
static struct user * | build_user (const char *mac, struct phone_profile *profile, char *provider_name) |
Build and return a user structure based on gathered config data. More... | |
static int | build_user_routes (struct user *user) |
Add an http route for dynamic files attached to the profile of the user. More... | |
static struct extension * | delete_extension (struct extension *exten) |
static void | delete_file (struct phoneprov_file *file) |
static void | delete_profiles (void) |
Delete all phone profiles, freeing their memory. More... | |
static void | delete_providers (void) |
Delete all providers. More... | |
static void | delete_routes (void) |
Delete all http routes, freeing their memory. More... | |
static void | delete_users (void) |
Delete all users. More... | |
static int | extension_delete_cb (void *obj, void *arg, void *data, int flags) |
static int | extensions_delete_cb (void *obj, void *arg, int flags) |
static struct phone_profile * | find_profile (const char *name) |
Return a phone profile looked up by name. More... | |
static struct phoneprov_provider * | find_provider (char *name) |
static struct user * | find_user (const char *macaddress) |
Return a user looked up by name. More... | |
static struct varshead * | get_defaults (void) |
static char * | handle_show_routes (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command to list static and dynamic routes. More... | |
static int | load_common (void) |
static int | load_file (const char *filename, char **ret) |
Read a TEXT file into a string and return the length. More... | |
static int | load_module (void) |
Load the module. More... | |
static int | load_users (void) |
static int | lookup_iface (const char *iface, struct in_addr *address) |
static int | phoneprov_callback (struct ast_tcptls_session_instance *ser, const struct ast_http_uri *urih, const char *uri, enum ast_http_method method, struct ast_variable *get_vars, struct ast_variable *headers) |
Callback that is executed everytime an http request is received by this module. More... | |
static int | pp_each_extension_helper (struct ast_channel *chan, const char *cmd, char *data, char *buf, struct ast_str **bufstr, int len) |
A dialplan function that can be used to output a template for each extension attached to a user. More... | |
static int | pp_each_extension_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
static int | pp_each_extension_read2 (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
static int | pp_each_user_helper (struct ast_channel *chan, char *data, char *buf, struct ast_str **bufstr, int len) |
A dialplan function that can be used to print a string for each phoneprov user. More... | |
static int | pp_each_user_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
static int | pp_each_user_read2 (struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len) |
static void | profile_destructor (void *obj) |
static void | provider_destructor (void *obj) |
static int | reload (void) |
static void | route_destructor (void *obj) |
static int | route_list_cb (void *obj, void *arg, void *data, int flags) |
static int | routes_delete_cb (void *obj, void *arg, int flags) |
static void | set_timezone_variables (struct varshead *headp, const char *zone) |
Set all timezone-related variables based on a zone (i.e. America/New_York) More... | |
static int | unload_module (void) |
static struct phone_profile * | unref_profile (struct phone_profile *prof) |
static struct http_route * | unref_route (struct http_route *route) |
static struct user * | unref_user (struct user *user) |
static void | user_destructor (void *obj) |
Free all memory associated with a user. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "HTTP Phone Provisioning" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CHANNEL_DEPEND, .requires = "http", } |
static struct in_addr | __ourip = { .s_addr = 0x00000000, } |
for use in lookup_iface More... | |
static const struct ast_module_info * | ast_module_info = &__mod_info |
struct ao2_container * | http_routes |
static struct ast_http_uri | phoneprovuri |
static struct ast_cli_entry | pp_cli [] |
static struct ast_custom_function | pp_each_extension_function |
static struct ast_custom_function | pp_each_user_function |
static const char * | pp_general_lookup [] |
static const char * | pp_user_lookup [] |
struct ao2_container * | profiles |
struct ao2_container * | providers |
struct ao2_container * | users |
static const char * | variable_lookup [] |
Phone provisioning application for the asterisk internal http server.
Definition in file res_phoneprov.c.
#define AST_API_MODULE |
Definition at line 45 of file res_phoneprov.c.
#define FORMATD "%-20.20s %-20.20s %-40.40s %-30.30s\n" |
Definition at line 1156 of file res_phoneprov.c.
#define FORMATS "%-20.20s %-40.40s %-30.30s\n" |
Definition at line 1155 of file res_phoneprov.c.
#define MAX_PROFILE_BUCKETS 17 |
Definition at line 81 of file res_phoneprov.c.
#define MAX_PROVIDER_BUCKETS 17 |
Definition at line 80 of file res_phoneprov.c.
#define MAX_ROUTE_BUCKETS 563 |
Definition at line 82 of file res_phoneprov.c.
#define MAX_USER_BUCKETS 563 |
Definition at line 83 of file res_phoneprov.c.
#define SIMPLE_CMP_FN | ( | fname, | |
stype, | |||
field | |||
) |
Creates a compare function for a structure string field.
fname | The name to use for the function |
stype | The structure type |
field | The field in the structure to compare |
SIMPLE_CMP_FN(mystruct, myfield) will produce a function named mystruct_cmp_fn which compares mystruct->myfield.
Definition at line 157 of file res_phoneprov.c.
#define SIMPLE_HASH_FN | ( | fname, | |
stype, | |||
field | |||
) |
Creates a hash function for a structure string field.
fname | The name to use for the function |
stype | The structure type |
field | The field in the structure to hash |
SIMPLE_HASH_FN(mystruct, myfield) will produce a function named mystruct_hash_fn which hashes mystruct->myfield.
Definition at line 128 of file res_phoneprov.c.
#define SIPUSERS_PROVIDER_NAME "sipusers" |
Definition at line 338 of file res_phoneprov.c.
#define VAR_BUF_SIZE 4096 |
Definition at line 86 of file res_phoneprov.c.
|
static |
Definition at line 1520 of file res_phoneprov.c.
|
static |
Definition at line 1520 of file res_phoneprov.c.
Add an extension to a user ordered by index/linenumber.
Definition at line 806 of file res_phoneprov.c.
References ast_free, AST_LIST_EMPTY, AST_LIST_INSERT_BEFORE_CURRENT, AST_LIST_INSERT_HEAD, AST_LIST_INSERT_TAIL, AST_LIST_NEXT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_log, ast_str_buffer(), ast_str_create, ast_str_substitute_variables_varshead(), ast_var_assign, ast_var_find(), AST_VAR_LIST_INSERT_TAIL(), AST_VAR_LIST_TRAVERSE, user::extensions, extension::headp, phone_profile::headp, extension::index, LOG_WARNING, user::macaddress, ast_var_t::name, user::profile, str, and ast_var_t::value.
Referenced by ast_phoneprov_add_extension().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 1520 of file res_phoneprov.c.
int ast_phoneprov_add_extension | ( | char * | provider_name, |
struct varshead * | vars | ||
) |
Adds an extension.
provider_name | The name of the provider |
vars | An ast_vat_t linked list of the extension's variables. The list is automatically cloned and it must contain at least MACADDRESS and USERNAME entries. |
0 | if successful |
non-zero | if failure |
Definition at line 1633 of file res_phoneprov.c.
References add_user_extension(), ao2_cleanup, ao2_link, ast_log, AST_PHONEPROV_STD_MAC, AST_PHONEPROV_STD_PROFILE, AST_PHONEPROV_STD_USERNAME, ast_strlen_zero(), ast_var_find(), build_extension(), build_user(), build_user_routes(), delete_extension(), find_profile(), find_provider(), find_user(), LOG_ERROR, LOG_WARNING, user::macaddress, extension::name, NULL, user::profile, provider, user::provider_name, RAII_VAR, and variable_lookup.
Referenced by load_users(), and users_apply_handler().
void ast_phoneprov_delete_extension | ( | char * | provider_name, |
char * | macaddress | ||
) |
Deletes an extension.
provider_name | The name of the provider |
macaddress | The mac address of the extension |
Definition at line 1604 of file res_phoneprov.c.
References ao2_callback_data, extension_delete_cb(), user::macaddress, OBJ_MULTIPLE, OBJ_NODATA, OBJ_SEARCH_KEY, OBJ_UNLINK, and user::provider_name.
Referenced by phoneprov_destroy().
void ast_phoneprov_delete_extensions | ( | char * | provider_name | ) |
Deletes all extensions for this provider.
provider_name | The name of the provider |
Definition at line 1614 of file res_phoneprov.c.
References ao2_callback, extensions_delete_cb(), OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, and user::provider_name.
Referenced by ast_phoneprov_provider_unregister().
int ast_phoneprov_provider_register | ( | char * | provider_name, |
ast_phoneprov_load_users_cb | load_users | ||
) |
Registers a config provider to phoneprov.
provider_name | The name of the provider |
load_users | Callback that gathers user variables then loads them by calling ast_phoneprov_add_extension once for each extension. |
0 | if successful |
non-zero | if failure |
Definition at line 1533 of file res_phoneprov.c.
References ao2_alloc, ao2_link, ao2_ref, ast_log, ast_phoneprov_provider_unregister(), ast_string_field_init, ast_string_field_set, ast_strlen_zero(), find_provider(), load_users(), LOG_ERROR, LOG_WARNING, provider, provider_destructor(), phoneprov_provider::provider_name, and providers.
Referenced by load_module(), and reload_module().
void ast_phoneprov_provider_unregister | ( | char * | provider_name | ) |
Unegisters a config provider from phoneprov and frees its resources.
provider_name | The name of the provider |
Definition at line 1623 of file res_phoneprov.c.
References ao2_find, ast_phoneprov_delete_extensions(), OBJ_NODATA, OBJ_SEARCH_KEY, OBJ_UNLINK, user::provider_name, and providers.
Referenced by ast_phoneprov_provider_register(), reload_module(), and unload_module().
const char * ast_phoneprov_std_variable_lookup | ( | enum ast_phoneprov_std_variables | var | ) |
Returns the string respresentation of a phoneprov standard variable.
var | One of enum ast_phoneprov_std_variables |
Definition at line 1524 of file res_phoneprov.c.
References AST_PHONEPROV_STD_VAR_LIST_LENGTH, NULL, var, and variable_lookup.
Referenced by load_endpoint(), and users_apply_handler().
Definition at line 689 of file res_phoneprov.c.
References ast_calloc_with_stringfields, ast_log, AST_PHONEPROV_STD_LINEKEYS, AST_PHONEPROV_STD_LINENUMBER, AST_PHONEPROV_STD_TIMEZONE, ast_string_field_set, ast_var_assign, ast_var_find(), ast_var_list_clone(), AST_VAR_LIST_INSERT_TAIL(), delete_extension(), extension::headp, extension::index, LOG_ERROR, name, NULL, set_timezone_variables(), tmp(), and variable_lookup.
Referenced by ast_phoneprov_add_extension().
|
static |
Build a phone profile and add it to the list of phone profiles.
name | the name of the profile |
v | ast_variable from parsing phoneprov.conf |
Definition at line 585 of file res_phoneprov.c.
References ao2_alloc, ao2_link, args, AST_APP_ARG, ast_calloc_with_stringfields, AST_DECLARE_APP_ARGS, ast_http_ftype2mtype(), AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_INSERT_TAIL, AST_NONSTANDARD_APP_ARGS, AST_STANDARD_APP_ARGS, ast_string_field_build, ast_string_field_init, ast_string_field_set, ast_strip(), ast_strlen_zero(), ast_var_assign, ast_var_list_create(), AST_VAR_LIST_INSERT_TAIL(), build_route(), phone_profile::default_mime_type, phone_profile::dynamic_files, phoneprov_file::format, phone_profile::headp, phoneprov_file::mime_type, name, ast_variable::name, ast_variable::next, NULL, profile_destructor(), profiles, S_OR, phone_profile::static_files, phone_profile::staticdir, unref_profile(), and ast_variable::value.
Referenced by load_common().
|
static |
Build a route structure and add it to the list of available http routes.
pp_file | File to link to the route |
profile | |
user | User to link to the route (NULL means static route) |
uri | URI of the route |
Definition at line 512 of file res_phoneprov.c.
References ao2_alloc, ao2_link, ast_log, ast_string_field_init, ast_string_field_set, http_route::file, phoneprov_file::format, http_routes, LOG_ERROR, http_route::profile, route_destructor(), S_OR, unref_route(), http_route::uri, user, and http_route::user.
Referenced by build_profile(), and build_user_routes().
|
static |
Build and return a user structure based on gathered config data.
Definition at line 784 of file res_phoneprov.c.
References ao2_alloc, ao2_ref, ast_string_field_init, ast_string_field_set, user::macaddress, NULL, user::profile, user::provider_name, unref_user(), user, and user_destructor().
Referenced by ast_phoneprov_add_extension().
|
static |
Add an http route for dynamic files attached to the profile of the user.
Definition at line 851 of file res_phoneprov.c.
References ast_free, AST_LIST_FIRST, AST_LIST_TRAVERSE, ast_str_buffer(), ast_str_create, ast_str_substitute_variables_varshead(), build_route(), phone_profile::dynamic_files, user::extensions, phoneprov_file::format, user::profile, and str.
Referenced by ast_phoneprov_add_extension().
Definition at line 680 of file res_phoneprov.c.
References ast_free, ast_string_field_free_memory, ast_var_list_destroy(), extension::headp, and NULL.
Referenced by ast_phoneprov_add_extension(), build_extension(), and user_destructor().
|
static |
Definition at line 392 of file res_phoneprov.c.
References ast_free, ast_string_field_free_memory, and make_ari_stubs::file.
Referenced by profile_destructor().
|
static |
Delete all phone profiles, freeing their memory.
Definition at line 572 of file res_phoneprov.c.
References ao2_callback, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, and profiles.
Referenced by reload(), and unload_module().
|
static |
Delete all providers.
Definition at line 377 of file res_phoneprov.c.
References ao2_callback, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, and providers.
Referenced by unload_module().
|
static |
Delete all http routes, freeing their memory.
Definition at line 497 of file res_phoneprov.c.
References ao2_callback, http_routes, NULL, OBJ_MULTIPLE, OBJ_NODATA, and OBJ_UNLINK.
Referenced by reload(), and unload_module().
|
static |
Delete all users.
Definition at line 774 of file res_phoneprov.c.
References ao2_callback, NULL, OBJ_MULTIPLE, OBJ_NODATA, and OBJ_UNLINK.
Referenced by reload(), and unload_module().
|
static |
Definition at line 1592 of file res_phoneprov.c.
References CMP_MATCH, user::macaddress, and user::provider_name.
Referenced by ast_phoneprov_delete_extension().
|
static |
Definition at line 1582 of file res_phoneprov.c.
References CMP_MATCH, phoneprov_provider::provider_name, and user::provider_name.
Referenced by ast_phoneprov_delete_extensions().
|
static |
Return a phone profile looked up by name.
Definition at line 544 of file res_phoneprov.c.
References ao2_find, name, OBJ_SEARCH_KEY, and profiles.
Referenced by ast_phoneprov_add_extension().
|
static |
Definition at line 371 of file res_phoneprov.c.
References ao2_find, name, OBJ_SEARCH_KEY, and providers.
Referenced by ast_phoneprov_add_extension(), and ast_phoneprov_provider_register().
|
static |
Return a user looked up by name.
Definition at line 735 of file res_phoneprov.c.
References ao2_find, user::macaddress, and OBJ_SEARCH_KEY.
Referenced by ast_phoneprov_add_extension(), and pp_each_extension_helper().
|
static |
Definition at line 1215 of file res_phoneprov.c.
References ast_config_destroy(), ast_config_load, ast_inet_ntoa(), ast_log, AST_PHONEPROV_STD_EXTENSION_LENGTH, AST_PHONEPROV_STD_PROFILE, AST_PHONEPROV_STD_SERVER, AST_PHONEPROV_STD_SERVER_IFACE, AST_PHONEPROV_STD_SERVER_PORT, AST_PHONEPROV_STD_VOICEMAIL_EXTEN, ast_var_assign, ast_var_list_create(), ast_var_list_destroy(), AST_VAR_LIST_INSERT_TAIL(), ast_variable_browse(), ast_variable_retrieve(), CONFIG_STATUS_FILEINVALID, LOG_ERROR, LOG_WARNING, lookup_iface(), ast_variable::name, ast_variable::next, NULL, pp_general_lookup, pp_user_lookup, S_OR, ast_variable::value, value, var, and variable_lookup.
Referenced by load_users().
|
static |
CLI command to list static and dynamic routes.
Definition at line 1173 of file res_phoneprov.c.
References a, ao2_callback_data, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, FORMATD, FORMATS, http_routes, NULL, OBJ_MULTIPLE, OBJ_NODATA, route_list_cb(), and ast_cli_entry::usage.
|
static |
Definition at line 1362 of file res_phoneprov.c.
References ao2_container_count(), ast_category_browse(), ast_config_destroy(), ast_config_load, ast_log, ast_variable_browse(), build_profile(), CONFIG_STATUS_FILEINVALID, LOG_ERROR, NULL, and profiles.
Referenced by load_module(), and reload().
|
static |
Read a TEXT file into a string and return the length.
Definition at line 399 of file res_phoneprov.c.
References ast_free, ast_malloc, len(), and NULL.
Referenced by make_ari_stubs::main(), phoneprov_callback(), and pp_each_extension_helper().
|
static |
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 1428 of file res_phoneprov.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ARRAY_LEN, ast_cli_register_multiple, ast_custom_function_register, ast_http_uri_link(), ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_phoneprov_provider_register(), error(), http_routes, load_common(), load_users(), LOG_ERROR, LOG_WARNING, MAX_PROFILE_BUCKETS, MAX_PROVIDER_BUCKETS, MAX_ROUTE_BUCKETS, MAX_USER_BUCKETS, NULL, phoneprovuri, pp_cli, pp_each_extension_function, pp_each_user_function, profiles, providers, SIPUSERS_PROVIDER_NAME, and unload_module().
|
static |
Definition at line 1292 of file res_phoneprov.c.
References ast_category_browse(), ast_config_destroy(), ast_config_load, ast_log, ast_phoneprov_add_extension(), AST_PHONEPROV_STD_MAC, AST_PHONEPROV_STD_VAR_LIST_LENGTH, ast_true(), ast_var_assign, ast_var_find(), ast_var_list_create(), ast_var_list_destroy(), AST_VAR_LIST_INSERT_TAIL(), AST_VAR_LIST_TRAVERSE, ast_variable_retrieve(), CONFIG_STATUS_FILEINVALID, get_defaults(), LOG_WARNING, ast_var_t::name, NULL, pp_user_lookup, SIPUSERS_PROVIDER_NAME, tmp(), ast_var_t::value, value, and variable_lookup.
Referenced by ast_phoneprov_provider_register(), and load_module().
|
static |
Definition at line 341 of file res_phoneprov.c.
References __ourip, ast_copy_string(), ast_log, errno, LOG_ERROR, and LOG_WARNING.
Referenced by get_defaults().
|
static |
Callback that is executed everytime an http request is received by this module.
Definition at line 870 of file res_phoneprov.c.
References ao2_find, ast_config_AST_DATA_DIR, ast_free, ast_http_error(), AST_HTTP_GET, AST_HTTP_HEAD, ast_http_send(), ast_inet_ntoa(), ast_iostream_get_fd(), AST_LIST_FIRST, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_log, AST_PHONEPROV_STD_SERVER, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_set(), ast_str_substitute_variables_varshead(), ast_strdupa, ast_var_assign, ast_var_delete(), ast_var_find(), AST_VAR_LIST_INSERT_TAIL(), ast_var_name(), ast_var_t::entries, user::extensions, http_route::file, make_ari_stubs::file, extension::headp, http_routes, len(), load_file(), LOG_ERROR, LOG_WARNING, method, phoneprov_file::mime_type, name, NULL, OBJ_SEARCH_KEY, PATH_MAX, result, ast_tcptls_session_instance::stream, phoneprov_file::template, tmp(), unref_route(), http_route::user, and variable_lookup.
|
static |
A dialplan function that can be used to output a template for each extension attached to a user.
Definition at line 1078 of file res_phoneprov.c.
References args, AST_APP_ARG, ast_build_string(), ast_config_AST_DATA_DIR, AST_DECLARE_APP_ARGS, ast_free, AST_LIST_TRAVERSE, ast_log, AST_STANDARD_APP_ARGS, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_substitute_variables_varshead(), ast_strlen_zero(), buf, user::extensions, make_ari_stubs::file, find_user(), extension::headp, len(), load_file(), LOG_WARNING, PATH_MAX, str, unref_user(), and user.
Referenced by pp_each_extension_read(), and pp_each_extension_read2().
|
static |
Definition at line 1139 of file res_phoneprov.c.
References buf, len(), NULL, and pp_each_extension_helper().
|
static |
Definition at line 1144 of file res_phoneprov.c.
References buf, len(), NULL, and pp_each_extension_helper().
|
static |
A dialplan function that can be used to print a string for each phoneprov user.
Definition at line 1021 of file res_phoneprov.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, args, AST_APP_ARG, ast_build_string(), AST_DECLARE_APP_ARGS, ast_free, AST_LIST_FIRST, AST_STANDARD_APP_ARGS, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_substitute_variables_varshead(), ast_strlen_zero(), buf, user::extensions, len(), user::macaddress, str, tmp(), unref_user(), and user.
Referenced by pp_each_user_read(), and pp_each_user_read2().
|
static |
Definition at line 1061 of file res_phoneprov.c.
References buf, len(), NULL, and pp_each_user_helper().
|
static |
Definition at line 1066 of file res_phoneprov.c.
References buf, len(), NULL, and pp_each_user_helper().
|
static |
Definition at line 549 of file res_phoneprov.c.
References ast_free, AST_LIST_REMOVE_HEAD, ast_string_field_free_memory, ast_var_delete(), delete_file(), phone_profile::dynamic_files, ast_var_t::entries, make_ari_stubs::file, phone_profile::headp, phone_profile::static_files, and var.
Referenced by build_profile().
|
static |
Definition at line 386 of file res_phoneprov.c.
References ast_string_field_free_memory, and provider.
Referenced by ast_phoneprov_provider_register().
|
static |
Definition at line 1481 of file res_phoneprov.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_lock, ao2_ref, ao2_unlock, ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, delete_profiles(), delete_routes(), delete_users(), load_common(), LOG_ERROR, provider, providers, and unload_module().
|
static |
Definition at line 489 of file res_phoneprov.c.
References ast_string_field_free_memory.
Referenced by build_route().
|
static |
Definition at line 1157 of file res_phoneprov.c.
References ast_cli(), CMP_MATCH, http_route::file, FORMATD, FORMATS, phone_profile::name, http_route::profile, user::provider_name, phoneprov_file::template, http_route::uri, and http_route::user.
Referenced by handle_show_routes().
|
static |
Definition at line 740 of file res_phoneprov.c.
References CMP_MATCH, user::macaddress, and http_route::user.
Referenced by user_destructor().
|
static |
Set all timezone-related variables based on a zone (i.e. America/New_York)
headp | pointer to list of user variables |
zone | A time zone. NULL sets variables based on timezone of the machine |
Definition at line 435 of file res_phoneprov.c.
References ast_get_dst_info(), ast_localtime(), ast_var_assign, AST_VAR_LIST_INSERT_TAIL(), ast_tm::tm_hour, ast_tm::tm_mday, and ast_tm::tm_mon.
Referenced by build_extension().
|
static |
Definition at line 1391 of file res_phoneprov.c.
References ao2_cleanup, ARRAY_LEN, ast_cli_unregister_multiple(), ast_custom_function_unregister(), ast_http_uri_unlink(), ast_phoneprov_provider_unregister(), delete_profiles(), delete_providers(), delete_routes(), delete_users(), http_routes, NULL, phoneprovuri, pp_cli, pp_each_extension_function, pp_each_user_function, profiles, providers, and SIPUSERS_PROVIDER_NAME.
Referenced by load_module(), and reload().
|
static |
Definition at line 536 of file res_phoneprov.c.
References ao2_cleanup, and NULL.
Referenced by build_profile(), and user_destructor().
|
static |
Definition at line 482 of file res_phoneprov.c.
References ao2_cleanup, and NULL.
Referenced by build_route(), and phoneprov_callback().
Definition at line 727 of file res_phoneprov.c.
References ao2_cleanup, and NULL.
Referenced by build_user(), pp_each_extension_helper(), and pp_each_user_helper().
|
static |
Free all memory associated with a user.
Definition at line 753 of file res_phoneprov.c.
References ao2_callback, AST_LIST_REMOVE_HEAD, ast_string_field_free_memory, delete_extension(), user::extensions, http_routes, user::macaddress, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, user::profile, routes_delete_cb(), and unref_profile().
Referenced by build_user().
|
static |
Definition at line 1520 of file res_phoneprov.c.
|
static |
for use in lookup_iface
Definition at line 263 of file res_phoneprov.c.
Referenced by lookup_iface().
|
static |
Definition at line 1520 of file res_phoneprov.c.
struct ao2_container* http_routes |
Definition at line 334 of file res_phoneprov.c.
Referenced by build_route(), delete_routes(), handle_show_routes(), load_module(), phoneprov_callback(), unload_module(), and user_destructor().
|
static |
Definition at line 1206 of file res_phoneprov.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 1202 of file res_phoneprov.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 1149 of file res_phoneprov.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 1071 of file res_phoneprov.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 236 of file res_phoneprov.c.
Referenced by get_defaults().
|
static |
Definition at line 209 of file res_phoneprov.c.
Referenced by get_defaults(), and load_users().
struct ao2_container* profiles |
Definition at line 307 of file res_phoneprov.c.
Referenced by build_profile(), delete_profiles(), find_profile(), load_common(), load_module(), and unload_module().
struct ao2_container* providers |
Definition at line 272 of file res_phoneprov.c.
Referenced by ast_phoneprov_provider_register(), ast_phoneprov_provider_unregister(), delete_providers(), find_provider(), load_module(), reload(), and unload_module().
struct ao2_container* users |
Definition at line 320 of file res_phoneprov.c.
Referenced by load_users().
|
static |
Definition at line 182 of file res_phoneprov.c.
Referenced by ast_phoneprov_add_extension(), ast_phoneprov_std_variable_lookup(), build_extension(), get_defaults(), load_users(), and phoneprov_callback().