|
|
|
@ -27222,12 +27222,11 @@ static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask
|
|
|
|
|
}
|
|
|
|
|
} else if (!strcasecmp(v->name, "nat")) {
|
|
|
|
|
ast_set_flag(&mask[0], SIP_NAT_FORCE_RPORT);
|
|
|
|
|
ast_set_flag(&flags[0], SIP_NAT_FORCE_RPORT); /* Default to "force_rport" */
|
|
|
|
|
if (!strcasecmp(v->value, "no")) {
|
|
|
|
|
ast_clear_flag(&flags[0], SIP_NAT_FORCE_RPORT);
|
|
|
|
|
} else if (!strcasecmp(v->value, "force_rport")) {
|
|
|
|
|
ast_set_flag(&flags[0], SIP_NAT_FORCE_RPORT);
|
|
|
|
|
} else if (!strcasecmp(v->value, "yes")) {
|
|
|
|
|
ast_set_flag(&flags[0], SIP_NAT_FORCE_RPORT);
|
|
|
|
|
/* We've already defaulted to force_rport */
|
|
|
|
|
ast_set_flag(&mask[1], SIP_PAGE2_SYMMETRICRTP);
|
|
|
|
|
ast_set_flag(&flags[1], SIP_PAGE2_SYMMETRICRTP);
|
|
|
|
|
} else if (!strcasecmp(v->value, "comedia")) {
|
|
|
|
@ -28381,6 +28380,18 @@ static void sip_set_default_format_capabilities(struct ast_format_cap *cap)
|
|
|
|
|
ast_format_cap_add(cap, ast_format_set(&tmp_fmt, AST_FORMAT_H263, 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void display_nat_warning(const char *cat, int reason, struct ast_flags *flags) {
|
|
|
|
|
int global_nat, specific_nat;
|
|
|
|
|
|
|
|
|
|
if (reason == CHANNEL_MODULE_LOAD && (specific_nat = ast_test_flag(&flags[0], SIP_NAT_FORCE_RPORT)) != (global_nat = ast_test_flag(&global_flags[0], SIP_NAT_FORCE_RPORT))) {
|
|
|
|
|
ast_log(LOG_WARNING, "!!! PLEASE NOTE: Setting 'nat' for a peer/user that differs from the global setting can make\n");
|
|
|
|
|
ast_log(LOG_WARNING, "!!! the name of that peer/user discoverable by an attacker. Replies for non-existent peers/users\n");
|
|
|
|
|
ast_log(LOG_WARNING, "!!! will be sent to a different port than replies for an existing peer/user. If at all possible,\n");
|
|
|
|
|
ast_log(LOG_WARNING, "!!! use the global 'nat' setting and do not set 'nat' per peer/user.\n");
|
|
|
|
|
ast_log(LOG_WARNING, "!!! (config category='%s' global force_rport='%s' peer/user force_rport='%s')\n", cat, AST_CLI_YESNO(global_nat), AST_CLI_YESNO(specific_nat));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*! \brief Re-read SIP.conf config file
|
|
|
|
|
\note This function reloads all config data, except for
|
|
|
|
|
active peers (with registrations). They will only
|
|
|
|
@ -28608,8 +28619,9 @@ static int reload_config(enum channelreloadreason reason)
|
|
|
|
|
ast_copy_string(default_mohinterpret, DEFAULT_MOHINTERPRET, sizeof(default_mohinterpret));
|
|
|
|
|
ast_copy_string(default_mohsuggest, DEFAULT_MOHSUGGEST, sizeof(default_mohsuggest));
|
|
|
|
|
ast_copy_string(default_vmexten, DEFAULT_VMEXTEN, sizeof(default_vmexten));
|
|
|
|
|
ast_set_flag(&global_flags[0], SIP_DTMF_RFC2833); /*!< Default DTMF setting: RFC2833 */
|
|
|
|
|
ast_set_flag(&global_flags[0], SIP_DIRECT_MEDIA); /*!< Allow re-invites */
|
|
|
|
|
ast_set_flag(&global_flags[0], SIP_DTMF_RFC2833); /*!< Default DTMF setting: RFC2833 */
|
|
|
|
|
ast_set_flag(&global_flags[0], SIP_DIRECT_MEDIA); /*!< Allow re-invites */
|
|
|
|
|
ast_set_flag(&global_flags[0], SIP_NAT_FORCE_RPORT); /*!< Default to nat=force_rport */
|
|
|
|
|
ast_copy_string(default_engine, DEFAULT_ENGINE, sizeof(default_engine));
|
|
|
|
|
ast_copy_string(default_parkinglot, DEFAULT_PARKINGLOT, sizeof(default_parkinglot));
|
|
|
|
|
|
|
|
|
@ -29394,6 +29406,7 @@ static int reload_config(enum channelreloadreason reason)
|
|
|
|
|
}
|
|
|
|
|
peer = build_peer(cat, ast_variable_browse(cfg, cat), NULL, 0, 0);
|
|
|
|
|
if (peer) {
|
|
|
|
|
display_nat_warning(cat, reason, &peer->flags[0]);
|
|
|
|
|
ao2_t_link(peers, peer, "link peer into peers table");
|
|
|
|
|
if ((peer->type & SIP_TYPE_PEER) && !ast_sockaddr_isnull(&peer->addr)) {
|
|
|
|
|
ao2_t_link(peers_by_ip, peer, "link peer into peers_by_ip table");
|
|
|
|
|