| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
#include "asterisk.h"#include <pjsip.h>#include <pjsip_ua.h>#include "asterisk/res_pjsip.h"#include "asterisk/res_pjsip_session.h"#include "asterisk/callerid.h"#include "asterisk/channel.h"#include "asterisk/module.h"#include "asterisk/strings.h"
Go to the source code of this file.
| Data Structures | |
| struct | reasons | 
| Diversion header reasons.  More... | |
| Enumerations | |
| enum | pjsip_diversion_send_update { PJSIP_DIVERSION_NOSEND_UPDATE = 0 , PJSIP_DIVERSION_SEND_UPDATE = 1 } | 
| Functions | |
| static void | __reg_module (void) | 
| static void | __unreg_module (void) | 
| static void | add_diversion_header (pjsip_tx_data *tdata, struct ast_party_redirecting *data) | 
| static void | add_history_info_header (pjsip_tx_data *tdata, struct ast_party_redirecting *data) | 
| static int | add_supported (pjsip_tx_data *tdata) | 
| struct ast_module * | AST_MODULE_SELF_SYM (void) | 
| static enum AST_REDIRECTING_REASON | cause_to_reason (const unsigned long cause) | 
| static void | copy_redirecting_id (struct ast_party_id *dst, const struct ast_party_id *src, struct ast_set_party_id *update) | 
| static int | diversion_incoming_request (struct ast_sip_session *session, pjsip_rx_data *rdata) | 
| static void | diversion_incoming_response (struct ast_sip_session *session, pjsip_rx_data *rdata, pjsip_diversion_send_update send_update) | 
| static void | diversion_incoming_response_media (struct ast_sip_session *session, pjsip_rx_data *rdata) | 
| static void | diversion_incoming_response_redirecting (struct ast_sip_session *session, pjsip_rx_data *rdata) | 
| static void | diversion_outgoing_request (struct ast_sip_session *session, pjsip_tx_data *tdata) | 
| static void | diversion_outgoing_response (struct ast_sip_session *session, pjsip_tx_data *tdata) | 
| static pjsip_fromto_hdr * | get_diversion_header (pjsip_rx_data *rdata) | 
| static pjsip_fromto_hdr * | get_history_info_header (pjsip_rx_data *rdata, const unsigned int first) | 
| static void | get_redirecting_add_diversion (struct ast_sip_session *session, pjsip_tx_data *tdata) | 
| static int | load_module (void) | 
| static const unsigned int | reason_code_to_cause (const struct ast_party_redirecting_reason *reason) | 
| static const char * | reason_code_to_str (const struct ast_party_redirecting_reason *reason) | 
| static void | set_redirecting (struct ast_sip_session *session, pjsip_fromto_hdr *from_info, pjsip_name_addr *to_info, pjsip_diversion_send_update send_update) | 
| static void | set_redirecting_id (pjsip_name_addr *name_addr, struct ast_party_id *data, struct ast_set_party_id *update) | 
| static void | set_redirecting_reason (pjsip_fromto_hdr *from_info, pjsip_name_addr *to_info, struct ast_party_redirecting_reason *data) | 
| static void | set_redirecting_reason_by_cause (pjsip_name_addr *name_addr, struct ast_party_redirecting_reason *data) | 
| static void | set_redirecting_value (char **dst, const pj_str_t *src) | 
| static int | sip_is_token (const char *str) | 
| static int | unload_module (void) | 
| Variables | |
| static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "PJSIP Add Diversion Header 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 const pj_str_t | diversion_name = { "Diversion", 9 } | 
| static struct ast_sip_session_supplement | diversion_supplement_media | 
| static struct ast_sip_session_supplement | diversion_supplement_redirecting | 
| static pj_str_t | HISTINFO_SUPPORTED_NAME = { "histinfo", 8 } | 
| static const pj_str_t | history_info_name = { "History-Info", 12 } | 
| static const struct reasons | reason_table [] | 
| Enumerator | |
|---|---|
| PJSIP_DIVERSION_NOSEND_UPDATE | |
| PJSIP_DIVERSION_SEND_UPDATE | |
Definition at line 45 of file res_pjsip_diversion.c.
| 
 | static | 
Definition at line 762 of file res_pjsip_diversion.c.
| 
 | static | 
Definition at line 762 of file res_pjsip_diversion.c.
| 
 | static | 
Definition at line 527 of file res_pjsip_diversion.c.
References ast_sip_pjsip_uri_get_username(), ast_strlen_zero(), diversion_name, ast_party_redirecting::from, id, NULL, ast_party_redirecting::reason, reason_code_to_str(), sip_is_token(), and ast_party_redirecting::to.
Referenced by get_redirecting_add_diversion().
| 
 | static | 
Definition at line 593 of file res_pjsip_diversion.c.
References ast_strlen_zero(), ast_party_redirecting::from, history_info_name, ast_party_id::name, NULL, ast_party_id::number, ast_party_redirecting::reason, reason_code_to_cause(), ast_party_name::str, ast_party_number::str, ast_party_redirecting::to, and ast_party_number::valid.
Referenced by get_redirecting_add_diversion().
| 
 | static | 
Definition at line 128 of file res_pjsip_diversion.c.
References HISTINFO_SUPPORTED_NAME, and NULL.
Referenced by get_redirecting_add_diversion().
| struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) | 
Definition at line 762 of file res_pjsip_diversion.c.
| 
 | static | 
Definition at line 110 of file res_pjsip_diversion.c.
References AST_REDIRECTING_REASON_DEFLECTION, AST_REDIRECTING_REASON_NO_ANSWER, AST_REDIRECTING_REASON_UNAVAILABLE, AST_REDIRECTING_REASON_UNCONDITIONAL, AST_REDIRECTING_REASON_UNKNOWN, and AST_REDIRECTING_REASON_USER_BUSY.
Referenced by set_redirecting_reason_by_cause().
| 
 | static | 
Definition at line 320 of file res_pjsip_diversion.c.
References ast_party_id_copy(), ast_party_id::name, ast_party_id::number, update(), ast_party_name::valid, and ast_party_number::valid.
Referenced by set_redirecting().
| 
 | static | 
Definition at line 436 of file res_pjsip_diversion.c.
References get_diversion_header(), get_history_info_header(), PJSIP_DIVERSION_SEND_UPDATE, session, and set_redirecting().
| 
 | static | 
Definition at line 459 of file res_pjsip_diversion.c.
References get_diversion_header(), get_history_info_header(), NULL, session, set_redirecting(), and status.
Referenced by diversion_incoming_response_media(), and diversion_incoming_response_redirecting().
| 
 | static | 
Definition at line 505 of file res_pjsip_diversion.c.
References diversion_incoming_response(), PJSIP_DIVERSION_SEND_UPDATE, and session.
| 
 | static | 
Definition at line 512 of file res_pjsip_diversion.c.
References diversion_incoming_response(), PJSIP_DIVERSION_NOSEND_UPDATE, and session.
| 
 | static | 
Definition at line 696 of file res_pjsip_diversion.c.
References get_redirecting_add_diversion(), and session.
| 
 | static | 
Definition at line 708 of file res_pjsip_diversion.c.
References get_redirecting_add_diversion(), session, and status.
| 
 | static | 
Definition at line 198 of file res_pjsip_diversion.c.
References diversion_name, NULL, and value.
Referenced by diversion_incoming_request(), and diversion_incoming_response().
| 
 | static | 
Definition at line 223 of file res_pjsip_diversion.c.
References first, history_info_name, NULL, and value.
Referenced by diversion_incoming_request(), and diversion_incoming_response().
| 
 | static | 
Definition at line 672 of file res_pjsip_diversion.c.
References add_diversion_header(), add_history_info_header(), add_supported(), ast_channel_redirecting(), and session.
Referenced by diversion_outgoing_request(), and diversion_outgoing_response().
| 
 | static | 
Definition at line 739 of file res_pjsip_diversion.c.
References AST_MODULE_LOAD_SUCCESS, ast_module_shutdown_ref, ast_sip_session_register_supplement, diversion_supplement_media, diversion_supplement_redirecting, and ast_module_info::self.
| 
 | static | 
Definition at line 183 of file res_pjsip_diversion.c.
References ARRAY_LEN, reasons::cause, ast_party_redirecting_reason::code, and reason_table.
Referenced by add_history_info_header().
| 
 | static | 
Definition at line 163 of file res_pjsip_diversion.c.
References ARRAY_LEN, ast_strlen_zero(), ast_party_redirecting_reason::code, reason_table, ast_party_redirecting_reason::str, and reasons::text.
Referenced by add_diversion_header().
| 
 | static | 
Definition at line 394 of file res_pjsip_diversion.c.
References ast_channel_queue_redirecting_update(), ast_channel_set_redirecting(), ast_party_redirecting_free(), ast_party_redirecting_init(), AST_REDIRECTING_REASON_UNKNOWN, ast_set_party_id_all(), ast_party_redirecting_reason::code, copy_redirecting_id(), ast_party_redirecting::count, ast_party_redirecting::from, ast_party_redirecting::reason, session, set_redirecting_id(), set_redirecting_reason(), ast_party_redirecting::to, and update().
Referenced by diversion_incoming_request(), and diversion_incoming_response().
| 
 | static | 
Definition at line 281 of file res_pjsip_diversion.c.
References ast_party_id::name, ast_party_id::number, set_redirecting_value(), ast_party_name::str, ast_party_number::str, update(), ast_party_name::valid, and ast_party_number::valid.
Referenced by set_redirecting().
| 
 | static | 
Definition at line 359 of file res_pjsip_diversion.c.
References ast_free, ast_redirecting_reason_parse(), AST_REDIRECTING_REASON_UNKNOWN, ast_strdup, ast_strdupa, ast_strip_quoted(), ast_party_redirecting_reason::code, set_redirecting_reason_by_cause(), set_redirecting_value(), and ast_party_redirecting_reason::str.
Referenced by set_redirecting().
| 
 | static | 
Definition at line 334 of file res_pjsip_diversion.c.
References ast_free, ast_sip_is_allowed_uri(), ast_sip_pjsip_uri_get_other_param(), ast_strdup, cause_to_reason(), ast_party_redirecting_reason::code, NULL, and ast_party_redirecting_reason::str.
Referenced by set_redirecting_reason().
| 
 | static | 
Definition at line 272 of file res_pjsip_diversion.c.
References ast_copy_pj_str(), ast_free, and ast_malloc.
Referenced by set_redirecting_id(), and set_redirecting_reason().
| 
 | static | 
Definition at line 61 of file res_pjsip_diversion.c.
References ast_strlen_zero(), and str.
Referenced by add_diversion_header().
| 
 | static | 
Definition at line 749 of file res_pjsip_diversion.c.
References ast_sip_session_unregister_supplement(), diversion_supplement_media, and diversion_supplement_redirecting.
| 
 | static | 
Definition at line 762 of file res_pjsip_diversion.c.
| 
 | static | 
Definition at line 762 of file res_pjsip_diversion.c.
| 
 | static | 
Definition at line 38 of file res_pjsip_diversion.c.
Referenced by add_diversion_header(), and get_diversion_header().
| 
 | static | 
Definition at line 718 of file res_pjsip_diversion.c.
Referenced by load_module(), and unload_module().
| 
 | static | 
Definition at line 727 of file res_pjsip_diversion.c.
Referenced by load_module(), and unload_module().
| 
 | static | 
Definition at line 40 of file res_pjsip_diversion.c.
Referenced by add_supported().
| 
 | static | 
Definition at line 39 of file res_pjsip_diversion.c.
Referenced by add_history_info_header(), and get_history_info_header().
| 
 | static | 
Referenced by reason_code_to_cause(), and reason_code_to_str().