Remove ignore configuration directive.

Ignore directive is not well coded. In order to work properly it
requires message attributes to exists for checking their values.
This forces payload parsing of each SIP messages with extra overload
and memory usage.

Not sure about the impact of removing this feature, but we must think
other way to implement it.
This commit is contained in:
Kaian 2015-09-24 20:04:58 +02:00
parent a28d30a374
commit dbea0d8d15
5 changed files with 0 additions and 94 deletions

View File

@ -100,16 +100,3 @@
##-----------------------------------------------------------------------------
## Uncomment to display dialogs that does not start with a request method
# set sip.ignoreincomplete off
##-----------------------------------------------------------------------------
## You can ignore some calls with any of the previous attributes with a given
## value with ignore directive.
##
## ignore {field} {value}
##
## Examples:
# ignore method OPTIONS
# ignore method REGISTER
# ignore method BYE
# ignore srchost 192.168.1.1
# ignore transport TCP

View File

@ -114,8 +114,6 @@ read_options(const char *fname)
} else {
set_option_value(option, value);
}
} else if (!strcasecmp(type, "ignore")) {
set_ignore_value(option, value);
} else if (!strcasecmp(type, "alias")) {
set_alias_value(option, value);
} else if (!strcasecmp(type, "bind")) {
@ -173,29 +171,6 @@ set_option_value(const char *opt, const char *value)
}
}
void
set_ignore_value(const char *opt, const char *value)
{
options[optscnt].type = IGNORE;
options[optscnt].opt = strdup(opt);
options[optscnt].value = strdup(value);
optscnt++;
}
int
is_ignored_value(const char *field, const char *fvalue)
{
int i;
for (i = 0; i < optscnt; i++) {
if (options[i].type != IGNORE)
continue;
if (!strcasecmp(options[i].opt, field) && !strcasecmp(options[i].value, fvalue)) {
return 1;
}
}
return 0;
}
void
set_alias_value(const char *address, const char *alias)
{

View File

@ -48,7 +48,6 @@ typedef struct config_option option_opt_t;
//! Option types
enum option_type {
COLUMN = 0,
IGNORE,
ALIAS
};
@ -138,30 +137,6 @@ get_option_int_value(const char *opt);
void
set_option_value(const char *opt, const char *value);
/**
* @brief Sets a ignore option value
*
* Basic setter for 'ignore' directive attributes
*
* @param opt Name of configuration option
* @param value Value of configuration option
*/
void
set_ignore_value(const char *opt, const char *value);
/**
* @brief Check if a exits an ignore directive for the given field and value
*
* Like is_option_enabled, this check if there is a match in configuration
* options that match the given field and value
*
* @param field Name of configuration option
* @param fvalue Value to check if it has an ignore directive
* @return 1 if value for field exists
*/
int
is_ignored_value(const char *field, const char *fvalue);
/**
* @brief Sets an alias for a given address
*

View File

@ -268,10 +268,6 @@ sip_load_message(capture_packet_t *packet, const char *src, u_short sport, const
if (calls.ignore_incomplete && msg->reqresp > SIP_METHOD_MESSAGE)
goto skip_message;
// Check if this message is ignored by configuration directive
if (sip_check_msg_ignore(msg))
goto skip_message;
// Create the call if not found
if (!(call = call_create(callid)))
goto skip_message;
@ -627,24 +623,6 @@ sip_check_match_expression(const char *payload)
#endif
}
int
sip_check_msg_ignore(sip_msg_t *msg)
{
int i;
sip_attr_hdr_t *header;
char value[512];
// Check if an ignore option exists
for (i = 0; i < SIP_ATTR_COUNT; i++) {
header = sip_attr_get_header(i);
if (is_ignored_value(header->name, call_get_attribute(msg->call, header->id, value))) {
return 1;
}
}
return 0;
}
const char *
sip_method_str(int method)
{

View File

@ -296,15 +296,6 @@ sip_set_match_expression(const char *expr, int insensitive, int invert);
int
sip_check_match_expression(const char *payload);
/**
* @brief Check if this msg is affected by filters
*
* @param call Message to check
* @return 1 if msg is filtered, 0 otherwise
*/
int
sip_check_msg_ignore(struct sip_msg *msg);
/**
* @brief Get String value for a Method
*