(cherry picked from commit 10349080490faabffaf1ab7cc5d591678b8c94dd)
... | ... |
@@ -2022,13 +2022,14 @@ modparam("rtpengine", "control_cmd_tos", 144) |
2022 | 2022 |
<title><varname>hash_algo</varname> (integer)</title> |
2023 | 2023 |
<para> |
2024 | 2024 |
Hashing algorithm to be used in node selection algorithm. Now there are 2 possibilities: legacy |
2025 |
- algorithm - 0(very basic hash over callid) or SHA1 - 1(apply sha1 over the callid and calculate hash). |
|
2025 |
+ algorithm - 0(very basic hash over callid), SHA1 - 1(apply sha1 over the callid and calculate hash) or |
|
2026 |
+ CRC32 - 2(calculate crc32 sum over the callid). |
|
2026 | 2027 |
</para> |
2027 | 2028 |
<para> |
2028 | 2029 |
Default value is 0, legacy algorithm. |
2029 | 2030 |
</para> |
2030 | 2031 |
<para> |
2031 |
- The values not falling into the range <quote>0-1</quote> are ignored. |
|
2032 |
+ The values not falling into the range <quote>0-2</quote> are ignored. |
|
2032 | 2033 |
</para> |
2033 | 2034 |
<example> |
2034 | 2035 |
<title>Set <varname>control_cmd_tos</varname> parameter</title> |
... | ... |
@@ -2036,6 +2037,9 @@ modparam("rtpengine", "control_cmd_tos", 144) |
2036 | 2037 |
... |
2037 | 2038 |
### use SHA1 instead of legacy algorithm |
2038 | 2039 |
modparam("rtpengine", "hash_algo", 1) |
2040 |
+ |
|
2041 |
+### use CRC32 instead of legacy algorithm |
|
2042 |
+modparam("rtpengine", "hash_algo", 2) |
|
2039 | 2043 |
... |
2040 | 2044 |
</programlisting> |
2041 | 2045 |
</example> |
... | ... |
@@ -2974,6 +2974,9 @@ select_rtpp_node_new(str callid, str viabranch, int do_test, struct rtpp_node ** |
2974 | 2974 |
} |
2975 | 2975 |
|
2976 | 2976 |
break; |
2977 |
+ case RTP_HASH_CRC32_CALLID: |
|
2978 |
+ crc32_uint(&callid, &sum); |
|
2979 |
+ goto retry; |
|
2977 | 2980 |
default: |
2978 | 2981 |
LM_ERR("unknown hashing algo %d\n", hash_algo); |
2979 | 2982 |
return NULL; |
... | ... |
@@ -2991,6 +2994,7 @@ select_rtpp_node_new(str callid, str viabranch, int do_test, struct rtpp_node ** |
2991 | 2994 |
} |
2992 | 2995 |
|
2993 | 2996 |
retry: |
2997 |
+ LM_DBG("sum is = %u\n", sum); |
|
2994 | 2998 |
weight_sum = 0; |
2995 | 2999 |
|
2996 | 3000 |
lock_get(active_rtpp_set->rset_lock); |
... | ... |
@@ -103,6 +103,6 @@ extern str rtpp_url_col; |
103 | 103 |
extern str rtpp_weight_col; |
104 | 104 |
extern str rtpp_disabled_col; |
105 | 105 |
|
106 |
-enum hash_algo_t { RTP_HASH_CALLID, RTP_HASH_SHA1_CALLID}; |
|
106 |
+enum hash_algo_t { RTP_HASH_CALLID, RTP_HASH_SHA1_CALLID, RTP_HASH_CRC32_CALLID }; |
|
107 | 107 |
|
108 | 108 |
#endif |