From 118a317ca5215db3bba59e5c31a25daafa2d89a0 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Wed, 30 Apr 2008 13:49:42 +0000 Subject: [PATCH] sipctrl option to accept FR without To-Tag git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@919 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- core/plug-in/sipctrl/SipCtrlInterface.cpp | 12 ++++++++++++ core/plug-in/sipctrl/SipCtrlInterface.h | 2 ++ core/plug-in/sipctrl/etc/sipctrl.conf | 8 ++++++++ core/plug-in/sipctrl/trans_layer.cpp | 3 ++- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 core/plug-in/sipctrl/etc/sipctrl.conf diff --git a/core/plug-in/sipctrl/SipCtrlInterface.cpp b/core/plug-in/sipctrl/SipCtrlInterface.cpp index 409424ad..990c9454 100644 --- a/core/plug-in/sipctrl/SipCtrlInterface.cpp +++ b/core/plug-in/sipctrl/SipCtrlInterface.cpp @@ -36,6 +36,7 @@ EXPORT_CONTROL_INTERFACE_FACTORY(SipCtrlInterfaceFactory,MOD_NAME); string SipCtrlInterfaceFactory::outbound_host = ""; unsigned int SipCtrlInterfaceFactory::outbound_port = 0; +bool SipCtrlInterfaceFactory::accept_fr_without_totag = false; AmCtrlInterface* SipCtrlInterfaceFactory::instance() { @@ -67,6 +68,17 @@ int SipCtrlInterfaceFactory::onLoad() } } + AmConfigReader cfg; + string cfgfile = AmConfig::ModConfigPath + string(MOD_NAME ".conf"); + if (file_exists(cfgfile) && cfg.loadFile(cfgfile)) { + if (cfg.hasParameter("accept_fr_without_totag")) { + accept_fr_without_totag = + cfg.getParameter("accept_fr_without_totag") == "yes"; + } + } else { + DBG("assuming SIP default settings.\n"); + } + return 0; } diff --git a/core/plug-in/sipctrl/SipCtrlInterface.h b/core/plug-in/sipctrl/SipCtrlInterface.h index bd29298d..ae33dec8 100644 --- a/core/plug-in/sipctrl/SipCtrlInterface.h +++ b/core/plug-in/sipctrl/SipCtrlInterface.h @@ -31,6 +31,8 @@ public: static string outbound_host; static unsigned int outbound_port; + static bool accept_fr_without_totag; + SipCtrlInterfaceFactory(const string& name): AmCtrlInterfaceFactory(name) {} ~SipCtrlInterfaceFactory() {} diff --git a/core/plug-in/sipctrl/etc/sipctrl.conf b/core/plug-in/sipctrl/etc/sipctrl.conf new file mode 100644 index 00000000..03631eac --- /dev/null +++ b/core/plug-in/sipctrl/etc/sipctrl.conf @@ -0,0 +1,8 @@ +# +# Some finer grained SIP stack settings. +# + +# +# Accept final replies without To-tag? [yes|no] +# +#accept_fr_without_totag=yes diff --git a/core/plug-in/sipctrl/trans_layer.cpp b/core/plug-in/sipctrl/trans_layer.cpp index 5f9cefa2..2a6bc877 100644 --- a/core/plug-in/sipctrl/trans_layer.cpp +++ b/core/plug-in/sipctrl/trans_layer.cpp @@ -857,7 +857,8 @@ int trans_layer::update_uac_trans(trans_bucket* bucket, sip_trans* t, sip_msg* m to_tag = ((sip_from_to*)msg->to->p)->tag; if((t->msg->u.request->method != sip_request::CANCEL) && !to_tag.len){ DBG("To-tag missing in final reply\n"); - return -1; + if (!SipCtrlInterfaceFactory::accept_fr_without_totag) + return -1; } if(t->msg->u.request->method == sip_request::INVITE){