Asterisk - The Open Source Telephony Project
18.5.0
|
#include "asterisk.h"
#include <pjsip.h>
#include <pjsip_ua.h>
#include "asterisk/cli.h"
#include "asterisk/config.h"
#include "asterisk/manager.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_session.h"
#include "asterisk/sorcery.h"
Go to the source code of this file.
Data Structures | |
struct | notify_cfg |
struct | notify_channel_data |
struct | notify_data |
struct | notify_option |
struct | notify_option_item |
struct | notify_uri_data |
Macros | |
#define | CONTENT_SIZE 512 |
#define | CONTENT_TYPE_SIZE 64 |
Typedefs | |
typedef struct notify_channel_data *(* | task_channel_data_create) (struct ast_sip_session *session, void *info) |
typedef struct notify_data *(* | task_data_create) (struct ast_sip_endpoint *, void *info) |
typedef struct notify_uri_data *(* | task_uri_data_create) (const char *uri, void *info) |
Enumerations | |
enum | notify_result { SUCCESS, INVALID_ENDPOINT, INVALID_CHANNEL, ALLOC_ERROR, TASK_PUSH_ERROR } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
AO2_GLOBAL_OBJ_STATIC (globals) | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | build_ami_notify (pjsip_tx_data *tdata, void *info) |
static void | build_cli_notify (pjsip_tx_data *tdata, void *info) |
static void | build_notify (pjsip_tx_data *tdata, const char *name, const char *value, struct ast_str **content_type, struct ast_str **content) |
static void | build_notify_body (pjsip_tx_data *tdata, struct ast_str *content_type, struct ast_str *content) |
static char * | cli_complete_endpoint (const char *word) |
static char * | cli_complete_notify (const char *line, const char *word, int pos, int state, int using_uri) |
static char * | cli_notify (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CONFIG_INFO_STANDARD (notify_cfg, globals, notify_cfg_alloc,.files=ACO_FILES(&module_conf)) | |
static int | load_module (void) |
static int | manager_notify (struct mansession *s, const struct message *m) |
static void | manager_notify_channel (struct mansession *s, const struct message *m, const char *channel) |
static void | manager_notify_endpoint (struct mansession *s, const struct message *m, const char *endpoint_name) |
Completes SIPNotify AMI command in Endpoint mode. More... | |
static void | manager_notify_uri (struct mansession *s, const struct message *m, const char *uri) |
static int | multiple_headers_allowed (const char *name) |
static int | not_allowed (const char *name) |
static struct notify_channel_data * | notify_ami_channel_data_create (struct ast_sip_session *session, void *info) |
static void | notify_ami_channel_data_destroy (void *obj) |
static struct notify_data * | notify_ami_data_create (struct ast_sip_endpoint *endpoint, void *info) |
static void | notify_ami_data_destroy (void *obj) |
static struct notify_uri_data * | notify_ami_uri_data_create (const char *uri, void *info) |
static void | notify_ami_uri_data_destroy (void *obj) |
static void * | notify_cfg_alloc (void) |
static void | notify_cfg_destroy (void *obj) |
static int | notify_channel (void *obj) |
static struct notify_data * | notify_cli_data_create (struct ast_sip_endpoint *endpoint, void *info) |
static void | notify_cli_data_destroy (void *obj) |
static struct notify_uri_data * | notify_cli_uri_data_create (const char *uri, void *info) |
static void | notify_cli_uri_data_destroy (void *obj) |
static int | notify_contact (void *obj, void *arg, int flags) |
static int | notify_endpoint (void *obj) |
static void * | notify_option_alloc (const char *category) |
static int | notify_option_cmp (void *obj, void *arg, int flags) |
static void | notify_option_destroy (void *obj) |
static void * | notify_option_find (struct ao2_container *container, const char *category) |
static int | notify_option_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | notify_option_hash (const void *obj, int flags) |
static int | notify_uri (void *obj) |
static enum notify_result | push_notify (const char *endpoint_name, void *info, task_data_create data_create) |
static enum notify_result | push_notify_channel (const char *channel_name, void *info, task_channel_data_create data_create) |
static enum notify_result | push_notify_uri (const char *uri, void *info, task_uri_data_create data_create) |
static int | reload_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "CLI/AMI PJSIP NOTIFY Support" , .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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .reload = reload_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, .requires = "res_pjsip", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_cli_entry | cli_options [] |
static struct aco_file | module_conf |
static const char | notify_config [] = "pjsip_notify.conf" |
static struct aco_type | notify_option |
static struct aco_type * | notify_options [] = ACO_TYPES(¬ify_option) |
#define CONTENT_SIZE 512 |
Definition at line 116 of file res_pjsip_notify.c.
Referenced by build_notify().
#define CONTENT_TYPE_SIZE 64 |
Definition at line 115 of file res_pjsip_notify.c.
Referenced by build_notify().
typedef struct notify_channel_data*(* task_channel_data_create) (struct ast_sip_session *session, void *info) |
Definition at line 796 of file res_pjsip_notify.c.
typedef struct notify_data*(* task_data_create) (struct ast_sip_endpoint *, void *info) |
Definition at line 790 of file res_pjsip_notify.c.
typedef struct notify_uri_data*(* task_uri_data_create) (const char *uri, void *info) |
Definition at line 793 of file res_pjsip_notify.c.
enum notify_result |
Enumerator | |
---|---|
SUCCESS | |
INVALID_ENDPOINT | |
INVALID_CHANNEL | |
ALLOC_ERROR | |
TASK_PUSH_ERROR |
Definition at line 782 of file res_pjsip_notify.c.
|
static |
Definition at line 1264 of file res_pjsip_notify.c.
|
static |
Definition at line 1264 of file res_pjsip_notify.c.
AO2_GLOBAL_OBJ_STATIC | ( | globals | ) |
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 1264 of file res_pjsip_notify.c.
|
static |
Definition at line 622 of file res_pjsip_notify.c.
References ast_free, ast_log, build_notify(), build_notify_body(), sip_to_pjsip::info(), LOG_NOTICE, ast_variable::name, ast_variable::next, NULL, RAII_VAR, and ast_variable::value.
Referenced by notify_ami_channel_data_create(), notify_ami_channel_data_destroy(), notify_ami_data_create(), and notify_ami_uri_data_create().
|
static |
Definition at line 598 of file res_pjsip_notify.c.
References ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ast_free, build_notify(), build_notify_body(), sip_to_pjsip::info(), item, notify_option::items, notify_option_item::name, NULL, RAII_VAR, and notify_option_item::value.
Referenced by notify_cli_data_create(), notify_cli_uri_data_create(), and notify_cli_uri_data_destroy().
|
static |
Definition at line 553 of file res_pjsip_notify.c.
References ast_log, ast_sip_add_header(), ast_str_append(), ast_str_create, ast_str_set(), ast_str_strlen(), CONTENT_SIZE, CONTENT_TYPE_SIZE, LOG_ERROR, LOG_WARNING, multiple_headers_allowed(), not_allowed(), and NULL.
Referenced by build_ami_notify(), and build_cli_notify().
|
static |
Definition at line 529 of file res_pjsip_notify.c.
References ast_sip_add_body(), ast_str_buffer(), ast_sip_body::body_text, ast_sip_body::subtype, and ast_sip_body::type.
Referenced by build_ami_notify(), and build_cli_notify().
|
static |
Definition at line 913 of file res_pjsip_notify.c.
References ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_cli_completion_add(), ast_sip_get_sorcery(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_prefix(), ast_strdup, endpoints, and NULL.
Referenced by cli_complete_notify().
|
static |
Definition at line 943 of file res_pjsip_notify.c.
References ao2_cleanup, ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ast_strdup, ast_strlen_zero, c, cli_complete_endpoint(), globals, notify_option::name, NULL, and RAII_VAR.
Referenced by cli_notify().
|
static |
Definition at line 1003 of file res_pjsip_notify.c.
References ALLOC_ERROR, ao2_cleanup, ao2_global_obj_ref, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), cli_complete_notify(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, globals, INVALID_ENDPOINT, ast_cli_args::line, ast_cli_args::n, notify_cli_data_create(), notify_cli_uri_data_create(), notify_option_find(), NULL, ast_cli_args::pos, push_notify(), push_notify_uri(), RAII_VAR, TASK_PUSH_ERROR, ast_cli_entry::usage, and ast_cli_args::word.
CONFIG_INFO_STANDARD | ( | notify_cfg | , |
globals | , | ||
notify_cfg_alloc | , | ||
. | files = ACO_FILES(&module_conf) |
||
) |
|
static |
Definition at line 1218 of file res_pjsip_notify.c.
References aco_info_destroy(), aco_info_init(), aco_option_register_custom, ACO_PREFIX, aco_process_config(), ARRAY_LEN, ast_cli_register_multiple, ast_manager_register_xml, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, EVENT_FLAG_SYSTEM, manager_notify(), and notify_option_handler().
Referenced by unload_module().
|
static |
Definition at line 1183 of file res_pjsip_notify.c.
References ast_strlen_zero, astman_get_header(), astman_send_error(), manager_notify_channel(), manager_notify_endpoint(), and manager_notify_uri().
Referenced by load_module().
|
static |
Definition at line 1151 of file res_pjsip_notify.c.
References ALLOC_ERROR, ast_assert, ast_variables_destroy(), astman_get_variables_order(), astman_send_ack(), astman_send_error(), INVALID_CHANNEL, INVALID_ENDPOINT, notify_ami_channel_data_create(), ORDER_NATURAL, push_notify_channel(), SUCCESS, and TASK_PUSH_ERROR.
Referenced by manager_notify().
|
static |
Completes SIPNotify AMI command in Endpoint mode.
Definition at line 1078 of file res_pjsip_notify.c.
References ALLOC_ERROR, ast_assert, ast_variables_destroy(), astman_get_variables_order(), astman_send_ack(), astman_send_error(), astman_send_error_va(), INVALID_CHANNEL, INVALID_ENDPOINT, notify_ami_data_create(), ORDER_NATURAL, push_notify(), SUCCESS, and TASK_PUSH_ERROR.
Referenced by manager_notify().
|
static |
Definition at line 1119 of file res_pjsip_notify.c.
References ALLOC_ERROR, ast_assert, ast_variables_destroy(), astman_get_variables_order(), astman_send_ack(), astman_send_error(), INVALID_CHANNEL, INVALID_ENDPOINT, notify_ami_uri_data_create(), ORDER_NATURAL, push_notify_uri(), SUCCESS, and TASK_PUSH_ERROR.
Referenced by manager_notify().
|
static |
|
static |
Definition at line 491 of file res_pjsip_notify.c.
References ARRAY_LEN.
Referenced by build_notify().
|
static |
Definition at line 465 of file res_pjsip_notify.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, build_ami_notify(), notify_channel_data::build_notify, notify_channel_data::info, sip_to_pjsip::info(), notify_ami_channel_data_destroy(), NULL, session, and notify_channel_data::session.
Referenced by manager_notify_channel().
|
static |
Definition at line 403 of file res_pjsip_notify.c.
References ao2_cleanup, ast_variables_destroy(), build_ami_notify(), notify_channel_data::info, sip_to_pjsip::info(), and notify_channel_data::session.
Referenced by notify_ami_channel_data_create().
|
static |
Definition at line 418 of file res_pjsip_notify.c.
References ao2_alloc, ao2_ref, build_ami_notify(), notify_data::build_notify, notify_data::endpoint, notify_data::info, sip_to_pjsip::info(), notify_ami_data_destroy(), and NULL.
Referenced by manager_notify_endpoint().
|
static |
Definition at line 377 of file res_pjsip_notify.c.
References ao2_cleanup, ast_variables_destroy(), notify_data::endpoint, notify_data::info, and sip_to_pjsip::info().
Referenced by notify_ami_data_create().
|
static |
Definition at line 440 of file res_pjsip_notify.c.
References ao2_alloc, ao2_ref, ast_strdup, build_ami_notify(), notify_uri_data::build_notify, notify_uri_data::info, sip_to_pjsip::info(), notify_ami_uri_data_destroy(), NULL, and notify_uri_data::uri.
Referenced by manager_notify_uri().
|
static |
Definition at line 390 of file res_pjsip_notify.c.
References ast_free, ast_variables_destroy(), notify_uri_data::info, sip_to_pjsip::info(), and notify_uri_data::uri.
Referenced by notify_ami_uri_data_create().
|
static |
Definition at line 221 of file res_pjsip_notify.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_hash, notify_cfg_destroy(), notify_option_cmp(), notify_option_hash(), notify_cfg::notify_options, and NULL.
|
static |
Definition at line 215 of file res_pjsip_notify.c.
References ao2_cleanup, and notify_cfg::notify_options.
Referenced by notify_cfg_alloc().
|
static |
Definition at line 751 of file res_pjsip_notify.c.
References ao2_cleanup, ast_channel_name(), ast_debug, ast_sip_add_header(), ast_sip_create_request(), ast_sip_send_request(), NULL, and RAII_VAR.
Referenced by build_calendar(), and push_notify_channel().
|
static |
Definition at line 325 of file res_pjsip_notify.c.
References ao2_alloc, ao2_ref, build_cli_notify(), notify_data::build_notify, notify_data::endpoint, notify_data::info, sip_to_pjsip::info(), notify_cli_data_destroy(), and NULL.
Referenced by cli_notify().
|
static |
Definition at line 279 of file res_pjsip_notify.c.
References ao2_cleanup, notify_data::endpoint, and notify_data::info.
Referenced by notify_cli_data_create().
|
static |
Definition at line 349 of file res_pjsip_notify.c.
References ao2_alloc, ao2_ref, ast_strdup, build_cli_notify(), notify_uri_data::build_notify, notify_uri_data::info, sip_to_pjsip::info(), notify_cli_uri_data_destroy(), NULL, and notify_uri_data::uri.
Referenced by cli_notify().
|
static |
Definition at line 307 of file res_pjsip_notify.c.
References ao2_cleanup, ast_free, build_cli_notify(), notify_uri_data::info, sip_to_pjsip::info(), and notify_uri_data::uri.
Referenced by notify_cli_uri_data_create().
|
static |
Definition at line 645 of file res_pjsip_notify.c.
References ast_log, ast_sip_add_header(), ast_sip_create_request(), ast_sip_send_request(), notify_data::build_notify, notify_data::endpoint, notify_data::info, LOG_ERROR, LOG_WARNING, NULL, and ast_sip_contact::uri.
Referenced by notify_endpoint().
|
static |
Definition at line 677 of file res_pjsip_notify.c.
References ao2_callback, ao2_cleanup, ast_log, ast_sip_location_retrieve_aor(), ast_sip_location_retrieve_aor_contacts(), ast_strdupa, ast_strip(), ast_strlen_zero, LOG_WARNING, notify_contact(), NULL, OBJ_NODATA, RAII_VAR, and strsep().
Referenced by push_notify().
|
static |
Definition at line 158 of file res_pjsip_notify.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_list, AO2_CONTAINER_ALLOC_OPT_DUPS_ALLOW, ast_copy_string(), notify_option::items, notify_option::name, notify_option_destroy(), and NULL.
|
static |
Definition at line 143 of file res_pjsip_notify.c.
References CMP_MATCH, notify_option::name, and OBJ_KEY.
Referenced by notify_cfg_alloc().
|
static |
Definition at line 152 of file res_pjsip_notify.c.
References ao2_cleanup, and notify_option::items.
Referenced by notify_option_alloc().
|
static |
Definition at line 181 of file res_pjsip_notify.c.
References ao2_find, and OBJ_KEY.
Referenced by cli_notify().
|
static |
Definition at line 186 of file res_pjsip_notify.c.
References ao2_alloc, ao2_cleanup, ao2_link, ast_copy_string(), item, notify_option::items, ast_variable::name, aco_type::name, NULL, RAII_VAR, and ast_variable::value.
Referenced by load_module().
|
static |
Definition at line 137 of file res_pjsip_notify.c.
References ast_str_case_hash(), notify_option::name, and OBJ_KEY.
Referenced by notify_cfg_alloc().
|
static |
Definition at line 709 of file res_pjsip_notify.c.
References ao2_cleanup, ast_log, ast_sip_add_header(), ast_sip_create_request(), ast_sip_default_outbound_endpoint(), ast_sip_send_request(), ast_strlen_zero, notify_data::endpoint, LOG_ERROR, LOG_WARNING, NULL, and RAII_VAR.
Referenced by handle_cc_notify(), and push_notify_uri().
|
static |
Definition at line 803 of file res_pjsip_notify.c.
References ALLOC_ERROR, ao2_cleanup, ast_sip_get_sorcery(), ast_sip_push_task(), ast_sorcery_retrieve_by_id(), ast_sip_session::endpoint, notify_data::endpoint, INVALID_ENDPOINT, notify_endpoint(), NULL, RAII_VAR, SUCCESS, and TASK_PUSH_ERROR.
Referenced by cli_notify(), and manager_notify_endpoint().
|
static |
Definition at line 851 of file res_pjsip_notify.c.
References ALLOC_ERROR, ao2_ref, ast_channel_get_by_name(), ast_channel_lock, ast_channel_tech(), ast_channel_tech_pvt(), ast_channel_unlock, ast_channel_unref, ast_debug, ast_log, ast_sip_push_task(), ast_sip_session::inv_session, INVALID_CHANNEL, LOG_WARNING, notify_channel(), ast_sip_session::serializer, session, ast_sip_channel_pvt::session, SUCCESS, TASK_PUSH_ERROR, and type.
Referenced by manager_notify_channel().
|
static |
Definition at line 830 of file res_pjsip_notify.c.
References ALLOC_ERROR, ao2_cleanup, ast_sip_push_task(), notify_uri(), NULL, SUCCESS, and TASK_PUSH_ERROR.
Referenced by cli_notify(), and manager_notify_uri().
|
static |
Definition at line 1238 of file res_pjsip_notify.c.
References aco_process_config(), ACO_PROCESS_ERROR, and AST_MODULE_LOAD_DECLINE.
Referenced by unload_module().
|
static |
Definition at line 1247 of file res_pjsip_notify.c.
References aco_info_destroy(), ao2_global_obj_release, ARRAY_LEN, ast_cli_unregister_multiple(), ast_manager_unregister(), AST_MODFLAG_LOAD_ORDER, AST_MODPRI_APP_DEPEND, AST_MODULE_INFO(), AST_MODULE_SUPPORT_CORE, ASTERISK_GPL_KEY, globals, load_module(), reload(), and reload_module().
|
static |
Definition at line 1264 of file res_pjsip_notify.c.
|
static |
Definition at line 1264 of file res_pjsip_notify.c.
|
static |
Definition at line 1070 of file res_pjsip_notify.c.
|
static |
Definition at line 251 of file res_pjsip_notify.c.
|
static |
Definition at line 122 of file res_pjsip_notify.c.
|
static |
Definition at line 239 of file res_pjsip_notify.c.
|
static |
Definition at line 249 of file res_pjsip_notify.c.