TT#2388 sca: onhold_bflag

Change-Id: I5ff97e0f726e53a60221116242ec4854529a9f9b
changes/05/8105/2
Victor Seva 9 years ago
parent d22c14c08b
commit 4bca15e83f

@ -21,3 +21,6 @@ sipwise/usrloc_dbro.patch
sipwise/0001-kex-add-extended-core-stats.patch
##
sipwise/rtpengine_next_branch_parm.patch
# sca improvements
sipwise/sca_add_onhold_bflag.patch
##

@ -0,0 +1,122 @@
From: Victor Seva <linuxmaniac@torreviejawireless.org>
Date: Thu, 8 Sep 2016 12:38:49 +0200
Subject: sca: add onhold_bflag module parameter
* disable by default (-1)
* will skip parsing the sdp for on hold discovery and it will
use the value of the bflag
Change-Id: I5180804f189316b48be9cbd1410376d6601666ba
---
modules/sca/doc/sca_admin.xml | 22 ++++++++++++++++++++++
modules/sca/sca.c | 7 +++++++
modules/sca/sca.h | 1 +
modules/sca/sca_util.c | 8 ++++++--
4 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/modules/sca/doc/sca_admin.xml b/modules/sca/doc/sca_admin.xml
index 85911ce..a4b5210 100644
--- a/modules/sca/doc/sca_admin.xml
+++ b/modules/sca/doc/sca_admin.xml
@@ -262,6 +262,28 @@ modparam( "sca", "db_update_interval", 120 )
</programlisting>
</example>
</section>
+
+ <section id="sca.p.onhold_bflag">
+ <title><varname>onhold_bflag</varname> (integer)</title>
+ <para>
+ <para>
+ Which branch flag should be used by the module to identify if the call
+ is on-hold instead of parsing the sdp.
+ </para>
+ <para>
+ <emphasis>
+ Default value is -1 (disabled).
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>onhold_bflag</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("sca", "onhold_bflag", 15)
+...
+</programlisting>
+ </example>
+ </section>
</section>
<section>
diff --git a/modules/sca/sca.c b/modules/sca/sca.c
index 4c73c0f..6b9f0e9 100644
--- a/modules/sca/sca.c
+++ b/modules/sca/sca.c
@@ -99,6 +99,7 @@ int hash_table_size = -1;
int call_info_max_expires = 3600;
int line_seize_max_expires = 15;
int purge_expired_interval = 120;
+int onhold_bflag = -1;
static param_export_t params[] = {
{ "outbound_proxy", PARAM_STR, &outbound_proxy },
@@ -110,6 +111,7 @@ static param_export_t params[] = {
{ "call_info_max_expires", INT_PARAM, &call_info_max_expires },
{ "line_seize_max_expires", INT_PARAM, &line_seize_max_expires },
{ "purge_expired_interval", INT_PARAM, &purge_expired_interval },
+ {"onhold_bflag", INT_PARAM, &onhold_bflag},
{ NULL, 0, NULL },
};
@@ -242,6 +244,11 @@ sca_set_config( sca_mod *scam )
scam->cfg->call_info_max_expires = call_info_max_expires;
scam->cfg->line_seize_max_expires = line_seize_max_expires;
scam->cfg->purge_expired_interval = purge_expired_interval;
+ if(onhold_bflag > 31) {
+ LM_ERR("sca_set_config: onhold_bflag value > 31\n");
+ return (-1);
+ }
+ scam->cfg->onhold_bflag = onhold_bflag;
return( 0 );
}
diff --git a/modules/sca/sca.h b/modules/sca/sca.h
index 83a1c08..f5dd225 100644
--- a/modules/sca/sca.h
+++ b/modules/sca/sca.h
@@ -37,6 +37,7 @@ struct _sca_config {
int call_info_max_expires;
int line_seize_max_expires;
int purge_expired_interval;
+ int onhold_bflag;
};
typedef struct _sca_config sca_config;
diff --git a/modules/sca/sca_util.c b/modules/sca/sca_util.c
index 1a5643e..ce422ba 100644
--- a/modules/sca/sca_util.c
+++ b/modules/sca/sca_util.c
@@ -18,11 +18,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "sca_common.h"
-
+#include "sca.h"
#include <assert.h>
#include "sca_util.h"
-
+#include "../../dset.h"
#include "../../parser/sdp/sdp.h"
int
@@ -431,6 +431,10 @@ sca_call_is_held( sip_msg_t *msg )
int is_held = 0;
int rc;
+ if(sca->cfg->onhold_bflag >= 0) {
+ LM_DBG("sca_call_is_held: skip parse_sdp and use onhold_bflag\n");
+ return isbflagset(0, (flag_t)sca->cfg->onhold_bflag);
+ }
rc = parse_sdp( msg );
if ( rc < 0 ) {
LM_ERR( "sca_call_is_held: parse_sdp body failed" );
Loading…
Cancel
Save