Skip to content

Commit

Permalink
sca: add onhold_bflag module parameter
Browse files Browse the repository at this point in the history
* disable by default (-1)
* will skip parsing the sdp for on hold discovery and it will
  use the value of the bflag

Fix #773
  • Loading branch information
linuxmaniac committed Sep 8, 2016
1 parent a051bd9 commit e683b61
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
22 changes: 22 additions & 0 deletions modules/sca/doc/sca_admin.xml
Expand Up @@ -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>
Expand Down
7 changes: 7 additions & 0 deletions modules/sca/sca.c
Expand Up @@ -125,6 +125,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},
Expand All @@ -136,6 +137,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},
};

Expand Down Expand Up @@ -265,6 +267,11 @@ static int 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);
}
Expand Down
1 change: 1 addition & 0 deletions modules/sca/sca.h
Expand Up @@ -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;

Expand Down
8 changes: 6 additions & 2 deletions modules/sca/sca_util.c
Expand Up @@ -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 sca_get_msg_method(sip_msg_t *msg)
Expand Down Expand Up @@ -419,6 +419,10 @@ int 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\n");
Expand Down

0 comments on commit e683b61

Please sign in to comment.