Module: kamailio
Branch: master
Commit: 1416cfb1a2359bc170811e3607cf583f47309441
URL:
https://github.com/kamailio/kamailio/commit/1416cfb1a2359bc170811e3607cf583…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: GitHub <noreply(a)github.com>
Date: 2021-03-09T13:37:53+01:00
Merge pull request #2647 from hexla/features/uac_redirect/default_q
uac_redirect: Make default q-value configurable
---
Modified: src/modules/uac_redirect/doc/uac_redirect_admin.xml
Modified: src/modules/uac_redirect/rd_funcs.c
Modified: src/modules/uac_redirect/uac_redirect.c
---
Diff:
https://github.com/kamailio/kamailio/commit/1416cfb1a2359bc170811e3607cf583…
Patch:
https://github.com/kamailio/kamailio/commit/1416cfb1a2359bc170811e3607cf583…
---
diff --git a/src/modules/uac_redirect/doc/uac_redirect_admin.xml
b/src/modules/uac_redirect/doc/uac_redirect_admin.xml
index b044d38c25..97cb6414ad 100644
--- a/src/modules/uac_redirect/doc/uac_redirect_admin.xml
+++ b/src/modules/uac_redirect/doc/uac_redirect_admin.xml
@@ -337,6 +337,28 @@ branch_route[1] {
<programlisting format="linespecific">
...
modparam("uac_redirect","flags_hdr_mode",2)
+...
+ </programlisting>
+ </example>
+ </section>
+ <section>
+ <title><varname>default_q_value</varname> (int)</title>
+ <para>
+ Specifies the q-value to asign to contacts without one. Because
+ Kamailio doesn't support float parameter types, the value in the
+ parameter is divided by 1000 and stored as float. For example, if
+ you want default_q_value to be 0.38, use value 380 here.
+ </para>
+ <para>
+ <emphasis>
+ The default value is 10 (0.01).
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>default_q_value</varname>
parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("uac_redirect","default_q_value",0)
...
</programlisting>
</example>
diff --git a/src/modules/uac_redirect/rd_funcs.c b/src/modules/uac_redirect/rd_funcs.c
index 5b105d1011..5ce2644ec2 100644
--- a/src/modules/uac_redirect/rd_funcs.c
+++ b/src/modules/uac_redirect/rd_funcs.c
@@ -33,9 +33,9 @@
extern sruid_t _redirect_sruid;
+extern int default_q_value;
#define MAX_CONTACTS_PER_REPLY 16
-#define DEFAULT_Q_VALUE 10
static int shmcontact2dset(struct sip_msg *req, struct sip_msg *shrpl,
long max, struct acc_param *reason, unsigned int bflags);
@@ -147,7 +147,7 @@ static int sort_contacts(hdr_field_t *chdr, contact_t **ct_array,
/* does the contact has a q val? */
q_para = ct_list->q;
if (q_para==0 || q_para->body.len==0) {
- q = DEFAULT_Q_VALUE;
+ q = default_q_value;
} else {
if (str2q( &q, q_para->body.s, q_para->body.len)!=0) {
LM_ERR("invalid q param\n");
diff --git a/src/modules/uac_redirect/uac_redirect.c
b/src/modules/uac_redirect/uac_redirect.c
index 57ec038b39..6968f0b7ec 100644
--- a/src/modules/uac_redirect/uac_redirect.c
+++ b/src/modules/uac_redirect/uac_redirect.c
@@ -52,6 +52,9 @@ int flags_hdr_mode = 0;
#define ACCEPT_RULE_STR "accept"
#define DENY_RULE_STR "deny"
+#define DEFAULT_Q_VALUE 10
+
+int default_q_value = DEFAULT_Q_VALUE;
/* sruid to get internal uid */
sruid_t _redirect_sruid;
@@ -88,6 +91,7 @@ static param_export_t params[] = {
{"acc_db_table", PARAM_STRING, &acc_db_table },
{"bflags", INT_PARAM, &bflags },
{"flags_hdr_mode", INT_PARAM, &flags_hdr_mode },
+ {"default_q_value", INT_PARAM, &default_q_value },
{0, 0, 0}
};