Asterisk - The Open Source Telephony Project GIT-master-b023714
|
#include "asterisk.h"
#include <pjsip.h>
#include <pjsip_ua.h>
#include "asterisk/message.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_session.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/test.h"
#include "asterisk/uri.h"
Go to the source code of this file.
Data Structures | |
struct | msg_data |
Macros | |
#define | MAX_BODY_SIZE 1024 |
#define | MAX_HDR_SIZE 512 |
#define | MAX_USER_SIZE 128 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static enum pjsip_status_code | check_content_type (const pjsip_rx_data *rdata) |
static enum pjsip_status_code | check_content_type_in_dialog (const pjsip_rx_data *rdata) |
static int | headers_to_vars (const pjsip_rx_data *rdata, struct ast_msg *msg) |
static int | incoming_in_dialog_request (struct ast_sip_session *session, struct pjsip_rx_data *rdata) |
static int | is_msg_var_blocked (const char *name) |
static int | load_module (void) |
static pj_bool_t | module_on_rx_request (pjsip_rx_data *rdata) |
static struct msg_data * | msg_data_create (const struct ast_msg *msg, const char *destination, const char *from) |
static void | msg_data_destroy (void *obj) |
static int | msg_send (void *data) |
static int | print_body (pjsip_rx_data *rdata, char *buf, int len) |
static enum pjsip_status_code | rx_data_to_ast_msg (pjsip_rx_data *rdata, struct ast_msg *msg) |
static pj_status_t | send_response (pjsip_rx_data *rdata, enum pjsip_status_code code, pjsip_dialog *dlg, pjsip_transaction *tsx) |
static int | sip_msg_send (const struct ast_msg *msg, const char *destination, const char *from) |
static char * | sip_to_pjsip (char *buf, int size, int capacity) |
static int | unload_module (void) |
static void | update_content_type (pjsip_tx_data *tdata, struct ast_msg *msg, struct ast_sip_body *body) |
static int | update_to_display_name (pjsip_tx_data *tdata, char *to) |
static enum pjsip_status_code | vars_to_headers (const struct ast_msg *msg, pjsip_tx_data *tdata) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "PJSIP Messaging Support" , .key = ASTERISK_GPL_KEY , .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 struct ast_taskprocessor * | message_serializer |
static pjsip_module | messaging_module |
static struct ast_sip_session_supplement | messaging_supplement |
static const struct ast_msg_tech | msg_tech |
const pjsip_method | pjsip_message_method = {PJSIP_OTHER_METHOD, {"MESSAGE", 7} } |
#define MAX_BODY_SIZE 1024 |
Definition at line 137 of file res_pjsip_messaging.c.
#define MAX_HDR_SIZE 512 |
Definition at line 136 of file res_pjsip_messaging.c.
#define MAX_USER_SIZE 128 |
Definition at line 138 of file res_pjsip_messaging.c.
|
static |
Definition at line 1021 of file res_pjsip_messaging.c.
|
static |
Definition at line 1021 of file res_pjsip_messaging.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 1021 of file res_pjsip_messaging.c.
|
static |
Definition at line 151 of file res_pjsip_messaging.c.
References ast_sip_is_content_type().
Referenced by module_on_rx_request().
|
static |
Definition at line 175 of file res_pjsip_messaging.c.
References text.
Referenced by incoming_in_dialog_request().
|
static |
Definition at line 310 of file res_pjsip_messaging.c.
References ast_copy_pj_str(), ast_copy_string(), ast_msg_set_var(), ast_skip_blanks(), buf, c, end, MAX_HDR_SIZE, name, and test_val::next.
Referenced by rx_data_to_ast_msg().
|
static |
Definition at line 867 of file res_pjsip_messaging.c.
References ast_alloca, ast_channel_caller(), ast_channel_name(), ast_copy_pj_str(), ast_copy_string(), ast_debug, ast_free, ast_malloc, ast_msg_data_alloc(), AST_MSG_DATA_ATTR_BODY, AST_MSG_DATA_ATTR_CONTENT_TYPE, AST_MSG_DATA_ATTR_FROM, AST_MSG_DATA_ATTR_TO, ast_msg_data_get_attribute(), ast_msg_data_queue_frame(), AST_MSG_DATA_SOURCE_TYPE_IN_DIALOG, ast_strlen_zero(), check_content_type_in_dialog(), ast_party_caller::id, ast_party_id::name, send_response(), session, ast_party_name::str, ast_msg_data_attribute::type, ast_party_name::valid, ast_msg_data_attribute::value, and value.
|
static |
Definition at line 240 of file res_pjsip_messaging.c.
References ARRAY_LEN, and name.
Referenced by vars_to_headers().
|
static |
Definition at line 976 of file res_pjsip_messaging.c.
References AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_msg_tech_register(), ast_msg_tech_unregister(), ast_sip_create_serializer(), ast_sip_get_pjsip_endpoint(), ast_sip_register_service(), ast_sip_session_register_supplement, ast_sip_unregister_service(), message_serializer, messaging_module, messaging_supplement, msg_tech, NULL, and pjsip_message_method.
|
static |
Definition at line 817 of file res_pjsip_messaging.c.
References ast_debug, ast_msg_alloc(), ast_msg_destroy(), ast_msg_has_destination(), ast_msg_queue(), check_content_type(), NULL, pjsip_message_method, rx_data_to_ast_msg(), and send_response().
|
static |
Definition at line 559 of file res_pjsip_messaging.c.
References ao2_alloc, ao2_ref, ast_msg_ref(), ast_strdup, msg_data::destination, msg_data::from, msg_data::msg, msg_data_destroy(), and NULL.
Referenced by sip_msg_send().
|
static |
Definition at line 549 of file res_pjsip_messaging.c.
References ast_free, ast_msg_destroy(), msg_data::destination, msg_data::from, and msg_data::msg.
Referenced by msg_data_create().
|
static |
Definition at line 631 of file res_pjsip_messaging.c.
References ao2_cleanup, ast_begins_with(), ast_debug, ast_free, ast_log, ast_msg_get_body(), ast_msg_get_from(), ast_msg_get_to(), ast_sip_add_body(), ast_sip_create_request(), ast_sip_get_endpoint(), ast_sip_send_request(), ast_sip_update_from(), ast_sip_update_to_uri(), ast_sorcery_object_get_id(), ast_strdupa, ast_strlen_zero(), ast_test_suite_event_notify, msg_data::destination, msg_data::from, LOG_ERROR, LOG_WARNING, msg_data::msg, NULL, RAII_VAR, ast_sip_body::type, update_content_type(), update_to_display_name(), and vars_to_headers().
Referenced by sip_msg_send().
|
static |
Definition at line 347 of file res_pjsip_messaging.c.
Referenced by rx_data_to_ast_msg().
|
static |
Definition at line 418 of file res_pjsip_messaging.c.
References ao2_cleanup, ast_alloca, ast_assert, ast_copy_pj_str(), AST_MAX_EXTENSION, ast_msg_set_body(), ast_msg_set_context(), ast_msg_set_endpoint(), ast_msg_set_exten(), ast_msg_set_from(), ast_msg_set_tech(), ast_msg_set_to(), ast_msg_set_var(), ast_pjsip_rdata_get_endpoint(), ast_sip_is_allowed_uri(), ast_sip_pjsip_uri_get_hostname(), ast_sip_pjsip_uri_get_username(), AST_SIP_USER_OPTIONS_TRUNCATE_CHECK, ast_sorcery_object_get_id(), buf, headers_to_vars(), MAX_BODY_SIZE, NULL, PJSTR_PRINTF_SPEC, PJSTR_PRINTF_VAR, print_body(), RAII_VAR, and S_OR.
Referenced by module_on_rx_request().
|
static |
Definition at line 788 of file res_pjsip_messaging.c.
References ao2_cleanup, ast_log, ast_pjsip_rdata_get_endpoint(), ast_sip_create_response(), ast_sip_send_stateful_response(), LOG_ERROR, NULL, and status.
Referenced by incoming_in_dialog_request(), and module_on_rx_request().
|
static |
Definition at line 762 of file res_pjsip_messaging.c.
References ao2_ref, ast_log, ast_sip_push_task_wait_serializer(), ast_strlen_zero(), msg_data::destination, msg_data::from, LOG_ERROR, message_serializer, msg_data::msg, msg_data_create(), and msg_send().
|
static |
Definition at line 377 of file res_pjsip_messaging.c.
References ast_log, buf, LOG_WARNING, and NULL.
|
static |
Definition at line 1006 of file res_pjsip_messaging.c.
References ast_msg_tech_unregister(), ast_sip_session_unregister_supplement(), ast_sip_unregister_service(), ast_taskprocessor_unreference(), message_serializer, messaging_module, messaging_supplement, and msg_tech.
|
static |
Definition at line 583 of file res_pjsip_messaging.c.
References ast_log, ast_msg_get_var(), ast_strdupa, LOG_WARNING, msg_data::msg, NULL, ast_sip_body::subtype, type, and ast_sip_body::type.
Referenced by msg_send().
|
static |
Definition at line 207 of file res_pjsip_messaging.c.
Referenced by msg_send().
|
static |
Definition at line 275 of file res_pjsip_messaging.c.
References ast_log, ast_msg_var_iterator_destroy(), ast_msg_var_iterator_init(), ast_msg_var_iterator_next(), ast_msg_var_unref_current(), ast_sip_add_header(), is_msg_var_blocked(), ast_msg_var_iterator::iter, LOG_NOTICE, name, and value.
Referenced by msg_send().
|
static |
Definition at line 1021 of file res_pjsip_messaging.c.
|
static |
Definition at line 1021 of file res_pjsip_messaging.c.
|
static |
Definition at line 140 of file res_pjsip_messaging.c.
Referenced by load_module(), sip_msg_send(), and unload_module().
|
static |
Definition at line 969 of file res_pjsip_messaging.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 964 of file res_pjsip_messaging.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 783 of file res_pjsip_messaging.c.
Referenced by action_messagesend(), ast_msg_send(), load_module(), msg_send_exec(), and unload_module().
const pjsip_method pjsip_message_method = {PJSIP_OTHER_METHOD, {"MESSAGE", 7} } |
Definition at line 134 of file res_pjsip_messaging.c.
Referenced by load_module(), and module_on_rx_request().