Browse code

Merge e62c27f3f5d65543b2aef60d7896d1fe7bb52a27 into 0d90412e5f6ecce601e21561142d0a19ad509f62

Stefan Mititelu authored on 25/11/2020 13:20:43 • GitHub committed on 25/11/2020 13:20:43
Showing 3 changed files
... ...
@@ -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>
... ...
@@ -2969,6 +2969,9 @@ select_rtpp_node_new(str callid, str viabranch, int do_test, struct rtpp_node **
2969 2969
 			}
2970 2970
 
2971 2971
 			break;
2972
+		case RTP_HASH_CRC32_CALLID:
2973
+			crc32_uint(&callid, &sum);
2974
+			goto retry;
2972 2975
 		default:
2973 2976
 			LM_ERR("unknown hashing algo %d\n", hash_algo);
2974 2977
 			return NULL;
... ...
@@ -2986,6 +2989,7 @@ select_rtpp_node_new(str callid, str viabranch, int do_test, struct rtpp_node **
2986 2989
 	}
2987 2990
 
2988 2991
 retry:
2992
+	LM_DBG("sum is = %u\n", sum);
2989 2993
 	weight_sum = 0;
2990 2994
 
2991 2995
 	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