Merge pull request #1183 in FS/freeswitch from ~SAFAROV/freeswitch2:FS-10009 to master
* commit '6c12f69e0c893646eda0bb010873583040aa136b': FS-10009: mod_fail2ban - Added logging of network_ip for abandoned calls
This commit is contained in:
commit
e8f6ed3d93
|
@ -620,6 +620,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||||
if (cause == SWITCH_CAUSE_WRONG_CALL_STATE) {
|
if (cause == SWITCH_CAUSE_WRONG_CALL_STATE) {
|
||||||
switch_event_t *s_event;
|
switch_event_t *s_event;
|
||||||
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_WRONG_CALL_STATE) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_WRONG_CALL_STATE) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "from_user", tech_pvt->from_user);
|
||||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "network_ip", tech_pvt->mparams.remote_ip);
|
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "network_ip", tech_pvt->mparams.remote_ip);
|
||||||
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "network_port", "%d", tech_pvt->mparams.remote_port);
|
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "network_port", "%d", tech_pvt->mparams.remote_port);
|
||||||
switch_event_fire(&s_event);
|
switch_event_fire(&s_event);
|
||||||
|
|
|
@ -797,6 +797,7 @@ struct private_object {
|
||||||
sofia_profile_t *profile;
|
sofia_profile_t *profile;
|
||||||
char *reply_contact;
|
char *reply_contact;
|
||||||
char *from_uri;
|
char *from_uri;
|
||||||
|
char *from_user;
|
||||||
char *to_uri;
|
char *to_uri;
|
||||||
char *callid;
|
char *callid;
|
||||||
char *contact_url;
|
char *contact_url;
|
||||||
|
|
|
@ -10224,6 +10224,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tech_pvt->from_user = switch_core_session_strdup(session, sip->sip_from->a_url->url_user);
|
||||||
tech_pvt->mparams.remote_ip = switch_core_session_strdup(session, network_ip);
|
tech_pvt->mparams.remote_ip = switch_core_session_strdup(session, network_ip);
|
||||||
tech_pvt->mparams.remote_port = network_port;
|
tech_pvt->mparams.remote_port = network_port;
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,8 @@ static void fail2ban_event_handler(switch_event_t *event)
|
||||||
fail2ban_logger("A registration was attempted", switch_event_get_header(event, "to-user"), switch_event_get_header(event, "network-ip"));
|
fail2ban_logger("A registration was attempted", switch_event_get_header(event, "to-user"), switch_event_get_header(event, "network-ip"));
|
||||||
} else if (strncmp(event->subclass_name, "sofia::register_failure",23) == 0) {
|
} else if (strncmp(event->subclass_name, "sofia::register_failure",23) == 0) {
|
||||||
fail2ban_logger("A registration failed", switch_event_get_header(event, "to-user"), switch_event_get_header(event, "network-ip"));
|
fail2ban_logger("A registration failed", switch_event_get_header(event, "to-user"), switch_event_get_header(event, "network-ip"));
|
||||||
|
} else if (strncmp(event->subclass_name, "sofia::wrong_call_state",23) == 0) {
|
||||||
|
fail2ban_logger("Abandoned call from ", switch_event_get_header(event, "from_user"), switch_event_get_header(event, "network_ip"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue