Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
#include "asterisk.h"
#include <pjsip.h>
#include <pjsip_ua.h>
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_session.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include "asterisk/module.h"
#include "asterisk/utils.h"
Go to the source code of this file.
Data Structures | |
struct | hdr_list |
struct | hdr_list_entry |
Linked list for accumulating headers. More... | |
struct | header_data |
Data structure used for ast_sip_push_task_wait_serializer More... | |
struct | param_data |
Macros | |
#define | param_add(pool, list, pname, pvalue) |
Enumerations | |
enum | param_type { PARAMETER_HEADER , PARAMETER_URI } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | add_header (void *obj) |
static int | add_param (void *obj) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static pjsip_hdr * | find_header (struct hdr_list *list, const char *header_name, int header_number) |
static int | func_read_header (struct ast_channel *chan, const char *function, char *data, char *buf, size_t len) |
Implements PJSIP_HEADER function 'read' callback. More... | |
static int | func_read_headers (struct ast_channel *chan, const char *function, char *data, char *buf, size_t len) |
Read list of unique SIP headers. More... | |
static int | func_read_param (struct ast_channel *chan, const char *function, char *data, char *buf, size_t len) |
static int | func_response_read_header (struct ast_channel *chan, const char *function, char *data, char *buf, size_t len) |
Implements PJSIP_RESPONSE_HEADER function 'read' callback. More... | |
static int | func_response_read_headers (struct ast_channel *chan, const char *function, char *data, char *buf, size_t len) |
Read list of unique SIP response headers. More... | |
static int | func_write_header (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
Implements PJSIP_HEADER function 'write' callback. More... | |
static int | func_write_param (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
static int | incoming_request (struct ast_sip_session *session, pjsip_rx_data *rdata) |
static void | incoming_response (struct ast_sip_session *session, pjsip_rx_data *rdata) |
static int | insert_headers (pj_pool_t *pool, struct hdr_list *list, pjsip_msg *msg) |
static int | load_module (void) |
static void | outgoing_request (struct ast_sip_session *session, pjsip_tx_data *tdata) |
static int | read_header (void *obj) |
static int | read_headers (void *obj) |
static int | read_param (void *obj) |
static int | remove_header (void *obj) |
static int | unload_module (void) |
static int | update_header (void *obj) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "PJSIP Header Functions" , .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_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_APP_DEPEND, .requires = "res_pjsip,res_pjsip_session", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static const struct ast_datastore_info | header_datastore |
Datastore for saving headers. More... | |
static struct ast_sip_session_supplement | header_funcs_supplement |
static struct ast_custom_function | pjsip_header_function |
static struct ast_custom_function | pjsip_header_param_function |
static struct ast_custom_function | pjsip_headers_function |
static struct ast_custom_function | pjsip_response_header_function |
static struct ast_custom_function | pjsip_response_headers_function |
static const struct ast_datastore_info | response_header_datastore |
Datastore for saving response headers. More... | |
#define param_add | ( | pool, | |
list, | |||
pname, | |||
pvalue | |||
) |
enum param_type |
Enumerator | |
---|---|
PARAMETER_HEADER | |
PARAMETER_URI |
Definition at line 1047 of file res_pjsip_header_funcs.c.
|
static |
Definition at line 1295 of file res_pjsip_header_funcs.c.
|
static |
Definition at line 1295 of file res_pjsip_header_funcs.c.
|
static |
Definition at line 627 of file res_pjsip_header_funcs.c.
References ao2_cleanup, ast_debug, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_INSERT_TAIL, ast_log, AST_LOG_ERROR, ast_sip_session_add_datastore(), ast_sip_session_alloc_datastore(), ast_sip_session_get_datastore(), header_data::channel, hdr_list_entry::hdr, header_data::header_datastore, header_data::header_name, header_data::header_value, RAII_VAR, ast_sip_channel_pvt::session, session, and ast_datastore_info::type.
Referenced by func_write_header().
|
static |
Definition at line 1115 of file res_pjsip_header_funcs.c.
References ast_debug, ast_log, param_data::channel, LOG_WARNING, param_add, param_data::param_name, param_data::param_value, PARAMETER_URI, param_data::paramtype, S_OR, ast_sip_channel_pvt::session, and session.
Referenced by func_write_param().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 1295 of file res_pjsip_header_funcs.c.
|
static |
Definition at line 422 of file res_pjsip_header_funcs.c.
References AST_LIST_TRAVERSE, ast_strlen_zero(), hdr_list_entry::hdr, hdr_list_entry::nextptr, and NULL.
Referenced by update_header().
|
static |
Implements PJSIP_HEADER function 'read' callback.
Valid actions are 'read' and 'remove'.
Definition at line 816 of file res_pjsip_header_funcs.c.
References args, AST_APP_ARG, ast_channel_name(), ast_channel_tech_pvt(), AST_DECLARE_APP_ARGS, ast_log, AST_LOG_ERROR, ast_sip_push_task_wait_serializer(), AST_STANDARD_APP_ARGS, ast_strlen_zero(), buf, header_data::buf, header_data::channel, header_datastore, header_data::header_datastore, header_data::header_name, header_data::header_number, header_data::header_value, len(), header_data::len, LOG_ERROR, NULL, read_header(), remove_header(), ast_sip_session::serializer, and ast_sip_channel_pvt::session.
|
static |
Read list of unique SIP headers.
Definition at line 753 of file res_pjsip_header_funcs.c.
References args, AST_APP_ARG, ast_channel_name(), ast_channel_tech_pvt(), AST_DECLARE_APP_ARGS, ast_log, ast_sip_push_task_wait_serializer(), AST_STANDARD_APP_ARGS, buf, header_data::buf, header_data::channel, header_datastore, header_data::header_datastore, header_data::header_name, header_data::header_value, len(), header_data::len, LOG_ERROR, NULL, read_headers(), ast_sip_session::serializer, and ast_sip_channel_pvt::session.
|
static |
Definition at line 1163 of file res_pjsip_header_funcs.c.
References args, AST_APP_ARG, ast_channel_name(), ast_channel_tech_pvt(), AST_DECLARE_APP_ARGS, ast_log, AST_LOG_ERROR, ast_sip_push_task_wait_serializer(), AST_STANDARD_APP_ARGS, ast_strlen_zero(), buf, param_data::buf, param_data::channel, param_data::header_name, len(), param_data::len, LOG_ERROR, LOG_WARNING, NULL, param_data::param_name, PARAMETER_HEADER, PARAMETER_URI, param_data::paramtype, read_param(), ast_sip_session::serializer, and ast_sip_channel_pvt::session.
|
static |
Implements PJSIP_RESPONSE_HEADER function 'read' callback.
Valid actions are 'read'
Definition at line 874 of file res_pjsip_header_funcs.c.
References args, AST_APP_ARG, ast_channel_name(), ast_channel_tech_pvt(), AST_DECLARE_APP_ARGS, ast_log, AST_LOG_ERROR, ast_sip_push_task_wait_serializer(), AST_STANDARD_APP_ARGS, ast_strlen_zero(), buf, header_data::buf, header_data::channel, header_data::header_datastore, header_data::header_name, header_data::header_number, header_data::header_value, len(), header_data::len, LOG_ERROR, NULL, read_header(), response_header_datastore, ast_sip_session::serializer, and ast_sip_channel_pvt::session.
|
static |
Read list of unique SIP response headers.
Definition at line 781 of file res_pjsip_header_funcs.c.
References args, AST_APP_ARG, ast_channel_name(), ast_channel_tech_pvt(), AST_DECLARE_APP_ARGS, ast_log, AST_LOG_ERROR, ast_sip_push_task_wait_serializer(), AST_STANDARD_APP_ARGS, ast_strlen_zero(), buf, header_data::buf, header_data::channel, header_data::header_datastore, header_data::header_name, header_data::header_value, len(), header_data::len, LOG_ERROR, NULL, read_headers(), response_header_datastore, ast_sip_session::serializer, and ast_sip_channel_pvt::session.
|
static |
Implements PJSIP_HEADER function 'write' callback.
Valid actions are 'add', 'update' and 'remove'.
Definition at line 929 of file res_pjsip_header_funcs.c.
References add_header(), args, AST_APP_ARG, ast_channel_name(), ast_channel_tech_pvt(), AST_DECLARE_APP_ARGS, ast_log, AST_LOG_ERROR, ast_sip_push_task_wait_serializer(), AST_STANDARD_APP_ARGS, ast_strlen_zero(), header_data::buf, header_data::channel, header_datastore, header_data::header_datastore, header_data::header_name, header_data::header_number, header_data::header_value, header_data::len, LOG_ERROR, NULL, remove_header(), ast_sip_session::serializer, ast_sip_channel_pvt::session, update_header(), and value.
|
static |
Definition at line 1213 of file res_pjsip_header_funcs.c.
References add_param(), args, AST_APP_ARG, ast_channel_name(), ast_channel_tech_pvt(), AST_DECLARE_APP_ARGS, ast_log, AST_LOG_ERROR, ast_sip_push_task_wait_serializer(), AST_STANDARD_APP_ARGS, ast_strlen_zero(), param_data::channel, param_data::header_name, LOG_ERROR, LOG_WARNING, NULL, param_data::param_name, param_data::param_value, PARAMETER_HEADER, PARAMETER_URI, param_data::paramtype, ast_sip_session::serializer, ast_sip_channel_pvt::session, and value.
|
static |
Definition at line 360 of file res_pjsip_header_funcs.c.
References ao2_cleanup, AST_LIST_HEAD_INIT_NOLOCK, ast_log, AST_LOG_ERROR, ast_sip_session_add_datastore(), ast_sip_session_alloc_datastore(), ast_sip_session_get_datastore(), header_datastore, insert_headers(), RAII_VAR, session, and ast_datastore_info::type.
|
static |
Definition at line 390 of file res_pjsip_header_funcs.c.
References ao2_cleanup, AST_LIST_HEAD_INIT_NOLOCK, ast_log, AST_LOG_ERROR, ast_sip_session_add_datastore(), ast_sip_session_alloc_datastore(), ast_sip_session_get_datastore(), insert_headers(), RAII_VAR, response_header_datastore, session, status, and ast_datastore_info::type.
|
static |
Definition at line 337 of file res_pjsip_header_funcs.c.
References AST_LIST_INSERT_TAIL, hdr_list_entry::hdr, and hdr_list_entry::nextptr.
Referenced by incoming_request(), and incoming_response().
|
static |
Definition at line 1266 of file res_pjsip_header_funcs.c.
References ast_custom_function_register, AST_MODULE_LOAD_SUCCESS, ast_sip_session_register_supplement, header_funcs_supplement, pjsip_header_function, pjsip_header_param_function, pjsip_headers_function, pjsip_response_header_function, and pjsip_response_headers_function.
|
static |
Definition at line 1020 of file res_pjsip_header_funcs.c.
References ao2_cleanup, AST_LIST_TRAVERSE, ast_sip_session_get_datastore(), ast_sip_session_remove_datastore(), hdr_list_entry::hdr, header_datastore, hdr_list_entry::nextptr, RAII_VAR, session, and ast_datastore_info::type.
|
static |
Definition at line 544 of file res_pjsip_header_funcs.c.
References ao2_cleanup, ast_alloca, ast_copy_string(), ast_debug, AST_LIST_TRAVERSE, ast_log, AST_LOG_ERROR, ast_sip_session_get_datastore(), ast_strip(), header_data::buf, header_data::channel, hdr_list_entry::hdr, header_data::header_datastore, header_data::header_name, header_data::header_number, len(), header_data::len, NULL, RAII_VAR, ast_sip_channel_pvt::session, and ast_datastore_info::type.
Referenced by func_read_header(), and func_response_read_header().
|
static |
Definition at line 453 of file res_pjsip_header_funcs.c.
References ao2_cleanup, ast_alloca, ast_copy_string(), ast_debug, AST_LIST_TRAVERSE, ast_log, AST_LOG_ERROR, AST_LOG_WARNING, ast_sip_session_get_datastore(), ast_strip(), ast_strlen_zero(), header_data::buf, header_data::channel, hdr_list_entry::hdr, header_data::header_datastore, header_data::header_name, len(), header_data::len, NULL, RAII_VAR, ast_sip_channel_pvt::session, and ast_datastore_info::type.
Referenced by func_read_headers(), and func_response_read_headers().
|
static |
Definition at line 1063 of file res_pjsip_header_funcs.c.
References ast_copy_string(), ast_debug, ast_log, param_data::buf, param_data::channel, param_data::len, LOG_ERROR, param_data::param_name, PARAMETER_URI, param_data::paramtype, ast_sip_channel_pvt::session, and session.
Referenced by func_read_param().
|
static |
Definition at line 711 of file res_pjsip_header_funcs.c.
References ao2_cleanup, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_log, AST_LOG_ERROR, ast_sip_session_get_datastore(), header_data::buf, header_data::channel, hdr_list_entry::hdr, header_data::header_datastore, header_data::header_name, len(), header_data::len, hdr_list_entry::nextptr, RAII_VAR, ast_sip_channel_pvt::session, and ast_datastore_info::type.
Referenced by func_read_header(), and func_write_header().
|
static |
Definition at line 1278 of file res_pjsip_header_funcs.c.
References ast_custom_function_unregister(), ast_sip_session_unregister_supplement(), header_funcs_supplement, pjsip_header_function, pjsip_header_param_function, pjsip_headers_function, pjsip_response_header_function, and pjsip_response_headers_function.
|
static |
Definition at line 676 of file res_pjsip_header_funcs.c.
References ao2_cleanup, ast_log, AST_LOG_ERROR, ast_sip_session_get_datastore(), header_data::channel, find_header(), header_data::header_datastore, header_data::header_name, header_data::header_number, header_data::header_value, ast_sip_session::inv_session, NULL, RAII_VAR, ast_sip_channel_pvt::session, and ast_datastore_info::type.
Referenced by func_write_header().
|
static |
Definition at line 1295 of file res_pjsip_header_funcs.c.
|
static |
Definition at line 1295 of file res_pjsip_header_funcs.c.
|
static |
Datastore for saving headers.
Definition at line 311 of file res_pjsip_header_funcs.c.
Referenced by func_read_header(), func_read_headers(), func_write_header(), incoming_request(), and outgoing_request().
|
static |
Definition at line 1039 of file res_pjsip_header_funcs.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 987 of file res_pjsip_header_funcs.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 1260 of file res_pjsip_header_funcs.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 993 of file res_pjsip_header_funcs.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 998 of file res_pjsip_header_funcs.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 1003 of file res_pjsip_header_funcs.c.
Referenced by load_module(), and unload_module().
|
static |
Datastore for saving response headers.
Definition at line 315 of file res_pjsip_header_funcs.c.
Referenced by func_response_read_header(), func_response_read_headers(), and incoming_response().