29 #include "asterisk/res_pjsip.h"
39 static pj_status_t sips_contact_on_tx_request(pjsip_tx_data *tdata)
41 pjsip_contact_hdr *contact;
42 pjsip_route_hdr *route;
43 pjsip_sip_uri *contact_uri;
45 contact = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL);
50 contact_uri = pjsip_uri_get_uri(contact->uri);
51 if (PJSIP_URI_SCHEME_IS_SIPS(contact_uri)) {
56 if (PJSIP_URI_SCHEME_IS_SIPS(tdata->msg->line.req.uri)) {
57 ast_debug(1,
"Upgrading contact URI on outgoing SIP request to SIPS due to SIPS Request URI\n");
58 pjsip_sip_uri_set_secure(contact_uri, PJ_TRUE);
62 route = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_ROUTE, NULL);
67 if (!PJSIP_URI_SCHEME_IS_SIPS(&route->name_addr)) {
72 ast_debug(1,
"Upgrading contact URI on outgoing SIP request to SIPS due to SIPS Route header\n");
73 pjsip_sip_uri_set_secure(contact_uri, PJ_TRUE);
78 static pjsip_module sips_contact_module = {
79 .name = {
"SIPS Contact", 12 },
81 .priority = PJSIP_MOD_PRIORITY_TSX_LAYER - 2,
82 .on_tx_request = sips_contact_on_tx_request,
85 static int unload_module(
void)
87 ast_sip_unregister_service(&sips_contact_module);
91 static int load_module(
void)
93 if (ast_sip_register_service(&sips_contact_module)) {
100 AST_MODULE_INFO(
ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER,
"UAC SIPS Contact support",
101 .support_level = AST_MODULE_SUPPORT_CORE,
103 .unload = unload_module,
105 .requires =
"res_pjsip",
Asterisk main include file. File version handling, generic pbx functions.
#define ast_debug(level,...)
Log a DEBUG message.
Module has failed to load, may be in an inconsistent state.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.