Asterisk - The Open Source Telephony Project
18.5.0
|
#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 | DEBUG_BUF_SIZE 256 |
#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 struct ast_sip_endpoint * | get_outbound_endpoint (const char *to, char **uri) |
static struct ast_sip_endpoint * | handle_atsign (const char *to, char *destination, char **uri, char *slash, char *atsign, char *scheme) |
static struct ast_sip_endpoint * | handle_single_token (const char *to, char *destination, char **uri) |
static struct ast_sip_endpoint * | handle_slash (const char *to, char *destination, char **uri, char *slash, char *atsign, char *scheme) |
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 | insert_user_in_contact_uri (const char *to, const char *endpoint_name, const char *aors, const char *user, char **uri) |
Find a contact and insert a "user@" into its URI. More... | |
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_from (pjsip_tx_data *tdata, char *from) |
static int | update_to_display_name (pjsip_tx_data *tdata, char *to) |
static int | update_to_uri (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 = "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, .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 DEBUG_BUF_SIZE 256 |
Referenced by update_to_uri().
#define MAX_BODY_SIZE 1024 |
Definition at line 137 of file res_pjsip_messaging.c.
Referenced by rx_data_to_ast_msg().
#define MAX_HDR_SIZE 512 |
Definition at line 136 of file res_pjsip_messaging.c.
Referenced by headers_to_vars().
#define MAX_USER_SIZE 128 |
Definition at line 138 of file res_pjsip_messaging.c.
|
static |
Definition at line 1611 of file res_pjsip_messaging.c.
|
static |
Definition at line 1611 of file res_pjsip_messaging.c.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 1611 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 617 of file res_pjsip_messaging.c.
References ast_debug, ast_malloc, ast_sip_default_outbound_endpoint(), ast_strdup, ast_strdupa, handle_atsign(), handle_single_token(), handle_slash(), NULL, and S_OR.
Referenced by msg_send().
|
static |
Definition at line 505 of file res_pjsip_messaging.c.
References ao2_cleanup, ast_sip_endpoint::aors, ast_debug, ast_log, ast_malloc, ast_sip_default_outbound_endpoint(), ast_sip_get_sorcery(), ast_sip_location_retrieve_contact_from_aor_list(), AST_SIP_USER_OPTIONS_TRUNCATE_CHECK, ast_sorcery_retrieve_by_id(), ast_strdup, ast_sip_contact::endpoint, LOG_WARNING, NULL, and ast_sip_contact::uri.
Referenced by get_outbound_endpoint().
|
static |
Definition at line 288 of file res_pjsip_messaging.c.
References ao2_cleanup, ast_sip_endpoint::aors, ast_debug, ast_log, ast_malloc, ast_sip_default_outbound_endpoint(), ast_sip_get_sorcery(), ast_sip_location_retrieve_contact_from_aor_list(), ast_sorcery_retrieve_by_id(), ast_strdup, ast_sip_contact::endpoint, LOG_WARNING, NULL, and ast_sip_contact::uri.
Referenced by get_outbound_endpoint().
|
static |
Definition at line 358 of file res_pjsip_messaging.c.
References ao2_cleanup, ast_sip_endpoint::aors, ast_begins_with(), ast_debug, ast_log, ast_malloc, ast_sip_get_sorcery(), ast_sip_location_retrieve_aor(), ast_sip_location_retrieve_first_aor_contact(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_id(), ast_strdup, insert_user_in_contact_uri(), LOG_WARNING, NULL, and ast_sip_contact::uri.
Referenced by get_outbound_endpoint().
|
static |
Definition at line 927 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, and name.
Referenced by rx_data_to_ast_msg().
|
static |
Definition at line 1457 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, ast_sip_session::channel, check_content_type_in_dialog(), ast_party_caller::id, ast_sip_session::inv_session, msg_data::msg, ast_party_id::name, send_response(), ast_party_name::str, ast_msg_data_attribute::type, ast_party_name::valid, msg_data::value, and ast_msg_data_attribute::value.
|
static |
Find a contact and insert a "user@" into its URI.
to | Original destination (for error messages only) |
endpoint_name | Endpoint name (for error messages only) |
aors | Command separated list of AORs |
user | The user to insert in the contact URI |
uri | Pointer to buffer in which to return the URI |
Definition at line 213 of file res_pjsip_messaging.c.
References ao2_cleanup, ast_debug, ast_log, ast_malloc, ast_sip_location_retrieve_contact_from_aor_list(), ast_strdupa, host, LOG_WARNING, NULL, and ast_sip_contact::uri.
Referenced by handle_slash().
|
static |
Definition at line 857 of file res_pjsip_messaging.c.
References ARRAY_LEN.
Referenced by vars_to_headers().
|
static |
Definition at line 1566 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(), messaging_module, NULL, and pjsip_message_method.
Referenced by unload_module().
|
static |
Definition at line 1407 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(), msg_data::msg, NULL, pjsip_message_method, rx_data_to_ast_msg(), and send_response().
|
static |
Definition at line 1139 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 1129 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 1221 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_send_request(), ast_sorcery_object_get_id(), ast_strdupa, ast_strlen_zero, ast_test_suite_event_notify, msg_data::destination, msg_data::from, get_outbound_endpoint(), LOG_ERROR, LOG_WARNING, msg_data::msg, NULL, RAII_VAR, ast_sip_body::type, update_content_type(), update_from(), update_to_display_name(), update_to_uri(), and vars_to_headers().
Referenced by sip_msg_send().
|
static |
Definition at line 964 of file res_pjsip_messaging.c.
Referenced by rx_data_to_ast_msg().
|
static |
Definition at line 1035 of file res_pjsip_messaging.c.
References ao2_cleanup, 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_USER_OPTIONS_TRUNCATE_CHECK, ast_sorcery_object_get_id(), buf, context, exten, headers_to_vars(), MAX_BODY_SIZE, NULL, print_body(), RAII_VAR, S_OR, and sip_to_pjsip().
Referenced by module_on_rx_request().
|
static |
Definition at line 1378 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 1352 of file res_pjsip_messaging.c.
References ao2_ref, ast_log, ast_sip_push_task_wait_serializer(), ast_strlen_zero, LOG_ERROR, msg_data_create(), and msg_send().
|
static |
Definition at line 994 of file res_pjsip_messaging.c.
References ast_log, buf, LOG_WARNING, and NULL.
Referenced by rx_data_to_ast_msg().
|
static |
Definition at line 1596 of file res_pjsip_messaging.c.
References AST_MODFLAG_LOAD_ORDER, AST_MODPRI_APP_DEPEND, AST_MODULE_INFO(), AST_MODULE_SUPPORT_CORE, ast_msg_tech_unregister(), ast_sip_session_unregister_supplement(), ast_sip_unregister_service(), ast_taskprocessor_unreference(), ASTERISK_GPL_KEY, load_module(), and messaging_module.
|
static |
Definition at line 1173 of file res_pjsip_messaging.c.
References ast_log, ast_msg_get_var(), ast_strdupa, LOG_WARNING, NULL, ast_sip_body::subtype, type, and ast_sip_body::type.
Referenced by msg_send().
|
static |
Definition at line 788 of file res_pjsip_messaging.c.
References ast_log, ast_strlen_zero, and LOG_WARNING.
Referenced by msg_send().
|
static |
|
static |
Definition at line 686 of file res_pjsip_messaging.c.
References ast_alloca, ast_debug, ast_log, buf, DEBUG_ATLEAST, DEBUG_BUF_SIZE, LOG_WARNING, and NULL.
Referenced by msg_send().
|
static |
Definition at line 892 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 1611 of file res_pjsip_messaging.c.
|
static |
Definition at line 1611 of file res_pjsip_messaging.c.
|
static |
Definition at line 140 of file res_pjsip_messaging.c.
|
static |
Definition at line 1559 of file res_pjsip_messaging.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 1554 of file res_pjsip_messaging.c.
|
static |
Definition at line 1373 of file res_pjsip_messaging.c.
Referenced by action_messagesend(), ast_msg_send(), and msg_send_exec().
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().