profile->ib_calls = 0;
profile->ob_calls = 0;
profile->ib_failed_calls = 0;
- profile->ob_failed_calls = 0;
+ profile->ob_failed_calls = 0;
if (xprofiledomain) {
profile->domain_name = switch_core_strdup(profile->pool, xprofiledomain);
profile->user_agent = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "auto-restart")) {
profile->auto_restart = switch_true(val);
+ } else if (!strcasecmp(var, "log-auth-failures")) {
+ profile->log_auth_failures = switch_true(val);
} else if (!strcasecmp(var, "dtmf-type")) {
if (!strcasecmp(val, "rfc2833")) {
profile->dtmf_type = DTMF_2833;
sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER);
sofia_set_pflag(profile, PFLAG_SQL_IN_TRANS);
+ profile->log_auth_failures = 0;
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
profile->user_agent = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "auto-restart")) {
profile->auto_restart = switch_true(val);
+ } else if (!strcasecmp(var, "log-auth-failures")) {
+ profile->log_auth_failures = switch_true(val);
} else if (!strcasecmp(var, "dtmf-type")) {
if (!strcasecmp(val, "rfc2833")) {
profile->dtmf_type = DTMF_2833;
event = "check-sync;reboot=true";
} else if (switch_stristr("linksys", user_agent)) {
event = "reboot_now";
+ } else if (switch_stristr("aastra", user_agent)) {
+ event = "aastra-check-cfg";
+ } else if (switch_stristr("polycom", user_agent)) {
+ event = "polycom-reboot";
}
sofia_glue_send_notify(profile, user, host, event, contenttype, body, contact, network_ip);
-
}
int sofia_sla_dialog_del_callback(void *pArg, int argc, char **argv, char **columnNames)
if (*received_data && sofia_test_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
switch_snprintf(received_data, sizeof(received_data), ";received=%s:%d", url_ip, network_port);
}
-
if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") ||
!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-tls-connectile-dysfunction")) {
}
if (auth_res == AUTH_FORBIDDEN) {
nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
+
+ /* Log line added to support Fail2Ban */
+ if ( profile->log_auth_failures ) {
+ if (regtype == REG_REGISTER) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth failure (REGISTER) on sofia profile '%s' "
+ "for [%s@%s] from ip %s\n", profile->name, to_user, to_host, network_ip);
+ } else if (regtype == REG_INVITE) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth failure (INVITE) on sofia profile '%s' "
+ "for [%s@%s] from ip %s\n", profile->name, to_user, to_host, network_ip);
+ }
+ }
} else {
nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END());
}