Add an option to ignore incomplete dialogs

Some power users don't want to open sngrep and see calls starting
with a response message. Meh.
This commit is contained in:
Kaian 2014-03-14 14:14:45 +01:00
parent 51ef5b677e
commit a0a8b8b697
3 changed files with 28 additions and 0 deletions

View File

@ -50,6 +50,15 @@
# set cl.column5 starting
# set cl.column5.width 15
##-----------------------------------------------------------------------------
## Default minimun size from Message info in Call Flow panel
# set cf.rawminwidth 100
##-----------------------------------------------------------------------------
## Ignore dialogs that does not start with a request method
# set sip.ignoreincomplete 1
##-----------------------------------------------------------------------------
## You can ignore some calls with any of the previous attributes with a given
## value with ignore directive.

View File

@ -65,14 +65,19 @@ init_options()
// Set Autoscroll in call list
set_option_value("cl.autoscroll", "on");
set_option_value("cl.scrollstep", "10");
set_option_value("cl.defexitbutton", "1");
// Raw options for Call flow screen
set_option_value("cf.forceraw", "on");
set_option_value("cf.rawminwidth", "100");
set_option_value("cf.splitcallid", "off");
// Allow dialogs to be incomplete
set_option_value("sip.ignoreincomlete", "0");
// Read options from configuration files
read_options("/etc/sngreprc");
read_options("/usr/local/etc/sngreprc");
read_options("/root/.sngreprc");
return 0;

View File

@ -188,6 +188,20 @@ sip_load_message(const char *header, const char *payload)
// Find the call for this msg
if (!(call = call_find_by_callid(callid))) {
// Only create a new call if the first msg
// is a request message in the following gorup
if (get_option_int_value("sip.ignoreincomplete")) {
const char *method = msg_get_attribute(msg, SIP_ATTR_METHOD);
if (method && strcasecmp(method, "INVITE")
&& strcasecmp(method, "REGISTER") && strcasecmp(method, "SUBSCRIBE")
&& strcasecmp(method, "OPTIONS") && strcasecmp(method, "PUBLISH")
&& strcasecmp(method, "MESSAGE") && strcasecmp(method, "NOTIFY")){
//@todo sip_msg_destroy();
return NULL;
}
}
// Create the call if not found
if (!(call = sip_call_create(callid))) {
//@todo sip_msg_destroy();