瀏覽代碼

cr: remove obselete cr_prime_route function, use cr_nofallback_route instead

Henning Westerholt 15 年之前
父節點
當前提交
7b898cecea

+ 16 - 80
modules/carrierroute/README

@@ -47,13 +47,10 @@ Henning Westerholt
               4.2. cr_route(carrier, domain, prefix_matching,
               4.2. cr_route(carrier, domain, prefix_matching,
                       rewrite_user, hash_source, descavp)
                       rewrite_user, hash_source, descavp)
 
 
-              4.3. cr_prime_route(carrier, domain, prefix_matching,
+              4.3. cr_nofallback_route(carrier, domain, prefix_matching,
                       rewrite_user, hash_source, descavp)
                       rewrite_user, hash_source, descavp)
 
 
-              4.4. cr_nofallback_route(carrier, domain, prefix_matching,
-                      rewrite_user, hash_source, descavp)
-
-              4.5. cr_next_domain(carrier, domain, prefix_matching, host,
+              4.4. cr_next_domain(carrier, domain, prefix_matching, host,
                       reply_code, dstavp)
                       reply_code, dstavp)
 
 
         5. MI Commands
         5. MI Commands
@@ -196,13 +193,10 @@ Chapter 1. Admin Guide
         4.2. cr_route(carrier, domain, prefix_matching, rewrite_user,
         4.2. cr_route(carrier, domain, prefix_matching, rewrite_user,
                 hash_source, descavp)
                 hash_source, descavp)
 
 
-        4.3. cr_prime_route(carrier, domain, prefix_matching,
-                rewrite_user, hash_source, descavp)
-
-        4.4. cr_nofallback_route(carrier, domain, prefix_matching,
+        4.3. cr_nofallback_route(carrier, domain, prefix_matching,
                 rewrite_user, hash_source, descavp)
                 rewrite_user, hash_source, descavp)
 
 
-        4.5. cr_next_domain(carrier, domain, prefix_matching, host,
+        4.4. cr_next_domain(carrier, domain, prefix_matching, host,
                 reply_code, dstavp)
                 reply_code, dstavp)
 
 
    5. MI Commands
    5. MI Commands
@@ -463,13 +457,10 @@ modparam("carrierroute", "match_mode", 10)
    4.2. cr_route(carrier, domain, prefix_matching, rewrite_user,
    4.2. cr_route(carrier, domain, prefix_matching, rewrite_user,
           hash_source, descavp)
           hash_source, descavp)
 
 
-   4.3. cr_prime_route(carrier, domain, prefix_matching, rewrite_user,
-          hash_source, descavp)
-
-   4.4. cr_nofallback_route(carrier, domain, prefix_matching,
+   4.3. cr_nofallback_route(carrier, domain, prefix_matching,
           rewrite_user, hash_source, descavp)
           rewrite_user, hash_source, descavp)
 
 
-   4.5. cr_next_domain(carrier, domain, prefix_matching, host, reply_code,
+   4.4. cr_next_domain(carrier, domain, prefix_matching, host, reply_code,
           dstavp)
           dstavp)
 
 
    Previous versions of carrierroute had some more function. All the old
    Previous versions of carrierroute had some more function. All the old
@@ -477,21 +468,12 @@ modparam("carrierroute", "match_mode", 10)
 cr_rewrite_uri(domain, hash_source)
 cr_rewrite_uri(domain, hash_source)
 -> cr_route("default", domain, "$rU", "$rU", hash_source)
 -> cr_route("default", domain, "$rU", "$rU", hash_source)
 
 
-cr_prime_balance_uri(domain, hash_source)
--> cr_prime_route("default", domain, "$rU", "$rU", hash_source)
-
 cr_rewrite_by_to(domain, hash_source)
 cr_rewrite_by_to(domain, hash_source)
 -> cr_route("default", domain, "$tU", "$rU", hash_source)
 -> cr_route("default", domain, "$tU", "$rU", hash_source)
 
 
-cr_prime_balance_by_to(domain, hash_source)
--> cr_prime_route("default", domain, "$tU", "$rU", hash_source)
-
 cr_rewrite_by_from(domain, hash_source)
 cr_rewrite_by_from(domain, hash_source)
 -> cr_route("default", domain, "$fU", "$rU", hash_source)
 -> cr_route("default", domain, "$fU", "$rU", hash_source)
 
 
-cr_prime_balance_by_from(domain, hash_source)
--> cr_prime_route("default", domain, "$fU", "$rU", hash_source)
-
 cr_user_rewrite_uri(uri, domain)
 cr_user_rewrite_uri(uri, domain)
 -> cr_user_carrier(user, domain, "$avp(tree_avp)")
 -> cr_user_carrier(user, domain, "$avp(tree_avp)")
 -> cr_route("$avp(tree_avp)", domain, "$rU", "$rU", "call_id")
 -> cr_route("$avp(tree_avp)", domain, "$rU", "$rU", "call_id")
@@ -499,7 +481,7 @@ cr_user_rewrite_uri(uri, domain)
 cr_tree_rewrite_uri(tree, domain)
 cr_tree_rewrite_uri(tree, domain)
 -> cr_route(tree, domain, "$rU", "$rU", "call_id")
 -> cr_route(tree, domain, "$rU", "$rU", "call_id")
 
 
-4.1. cr_user_carrier(user, domain, dstavp)
+4.1.  cr_user_carrier(user, domain, dstavp)
 
 
    This function loads the carrier and stores it in an AVP. It cannot be
    This function loads the carrier and stores it in an AVP. It cannot be
    used in the config file mode, as it needs a mapping of the given user
    used in the config file mode, as it needs a mapping of the given user
@@ -516,7 +498,7 @@ cr_tree_rewrite_uri(tree, domain)
        string any pseudo-variable could be used as input.
        string any pseudo-variable could be used as input.
      * dstavp - Name of the AVP where to store the carrier id.
      * dstavp - Name of the AVP where to store the carrier id.
 
 
-4.2. cr_route(carrier, domain, prefix_matching, rewrite_user, hash_source,
+4.2.  cr_route(carrier, domain, prefix_matching, rewrite_user, hash_source,
 descavp)
 descavp)
 
 
    This function searches for the longest match for the user given in
    This function searches for the longest match for the user given in
@@ -558,53 +540,7 @@ descavp)
      * decsavp - Name of the AVP where to store the description. This
      * decsavp - Name of the AVP where to store the description. This
        parameter is optional.
        parameter is optional.
 
 
-4.3. cr_prime_route(carrier, domain, prefix_matching, rewrite_user,
-hash_source, descavp)
-
-   This function searches for the longest match for the user given in
-   prefix_matching at the given domain in the given carrier tree. The
-   Request URI is rewritten using rewrite_user and the given hash source
-   and algorithm. Returns -1 if there is no data found or an empty rewrite
-   host on the longest match is found. On success also the description is
-   stored in the given AVP (if obmitted, nothing is stored in an AVP).
-   This is useful if you need some additional informations that belongs to
-   each gw, like the destination or the number of channels. This function
-   is only usable with rewrite_user and prefix_matching containing a valid
-   string. This string needs to be numerical if the match_mode parameter
-   is set to 10.
-
-   It uses the prime hash algorithm to calculate the hash values. This
-   means that the fuction behaves different then the normal routing
-   function. If you don't know what this prime functionality is, you
-   should just use the cr_route function. The prime routing algorithm not
-   use the configured probabilities in order to route requests, it just
-   uses a fixed hash distribution. If one of the hash targets is not
-   available, and no backup rule is configured, the function will return
-   -1.
-
-   Please not that this function is deprecated and will be removed in the
-   next stable release. Please consider using the cr_nofallback_route
-   function instead.
-
-   Meaning of the parameters is as follows:
-     * carrier - The routing tree to be used. Additional to a string any
-       pseudo-variable could be used as input.
-     * domain - Name of the routing domain to be used. Additional to a
-       string any pseudo-variable could be used as input.
-     * prefix_matching - User name to be used for prefix matching in the
-       routing tree. Additional to a string any pseudo-variable could be
-       used as input.
-     * rewrite_user - The user name to be used for applying the rewriting
-       rule. Usually this is the user part of the request URI. Additional
-       to a string any pseudo-variable could be used as input.
-     * hash_source - The hash values of the destination set must be a
-       contiguous range starting at 1, limited by the configuration
-       parameter max_targets. Possible values for hash_source are:
-       call_id, from_uri, from_user, to_uri to_user and rand
-     * descavp - Name of the AVP where to store the description. This
-       parameter is optional.
-
-4.4. cr_nofallback_route(carrier, domain, prefix_matching, rewrite_user,
+4.3.  cr_nofallback_route(carrier, domain, prefix_matching, rewrite_user,
 hash_source, descavp)
 hash_source, descavp)
 
 
    This function searches for the longest match for the user given in
    This function searches for the longest match for the user given in
@@ -620,12 +556,12 @@ hash_source, descavp)
    is set to 10.
    is set to 10.
 
 
    It uses the standard CRC32 algorithm to calculate the hash values. In
    It uses the standard CRC32 algorithm to calculate the hash values. In
-   contrast to the normal cr_route function the backup rules of
-   cr_prime_route is used. This means not the configured probabilities
-   will be used, only a fixed hash distribution. This makes sense to
-   distribute incoming register requests e.g. to a bunch of registrar
-   servers. If one of the hash targets is not available and backup rule is
-   configured, the function will return -1.
+   contrast to the normal cr_route function the backup rules of (now
+   obselete) cr_prime_route is used. This means not the configured
+   probabilities will be used, only a fixed hash distribution. This makes
+   sense to distribute incoming register requests e.g. to a bunch of
+   registrar servers. If one of the hash targets is not available and
+   backup rule is configured, the function will return -1.
 
 
    Meaning of the parameters is as follows:
    Meaning of the parameters is as follows:
      * carrier - The routing tree to be used. Additional to a string any
      * carrier - The routing tree to be used. Additional to a string any
@@ -645,7 +581,7 @@ hash_source, descavp)
      * descavp - Name of the AVP where to store the description. This
      * descavp - Name of the AVP where to store the description. This
        parameter is optional.
        parameter is optional.
 
 
-4.5. cr_next_domain(carrier, domain, prefix_matching, host, reply_code,
+4.4.  cr_next_domain(carrier, domain, prefix_matching, host, reply_code,
 dstavp)
 dstavp)
 
 
    This function searches for the longest match for the user given in
    This function searches for the longest match for the user given in

+ 0 - 2
modules/carrierroute/carrierroute.c

@@ -89,8 +89,6 @@ static cmd_export_t cmds[]={
 	{"cr_user_carrier",  (cmd_function)cr_load_user_carrier,  3, cr_load_user_carrier_fixup, 0, REQUEST_ROUTE | FAILURE_ROUTE },
 	{"cr_user_carrier",  (cmd_function)cr_load_user_carrier,  3, cr_load_user_carrier_fixup, 0, REQUEST_ROUTE | FAILURE_ROUTE },
 	{"cr_route",         (cmd_function)cr_route5,              5, cr_route_fixup,             0, REQUEST_ROUTE | FAILURE_ROUTE },
 	{"cr_route",         (cmd_function)cr_route5,              5, cr_route_fixup,             0, REQUEST_ROUTE | FAILURE_ROUTE },
 	{"cr_route",         (cmd_function)cr_route,              6, cr_route_fixup,             0, REQUEST_ROUTE | FAILURE_ROUTE },
 	{"cr_route",         (cmd_function)cr_route,              6, cr_route_fixup,             0, REQUEST_ROUTE | FAILURE_ROUTE },
-	{"cr_prime_route",   (cmd_function)cr_prime_route5,        5, cr_route_fixup,             0, REQUEST_ROUTE | FAILURE_ROUTE },
-	{"cr_prime_route",   (cmd_function)cr_prime_route,        6, cr_route_fixup,             0, REQUEST_ROUTE | FAILURE_ROUTE },
 	{"cr_nofallback_route",(cmd_function)cr_nofallback_route5,     5, cr_route_fixup,             0, REQUEST_ROUTE | FAILURE_ROUTE },
 	{"cr_nofallback_route",(cmd_function)cr_nofallback_route5,     5, cr_route_fixup,             0, REQUEST_ROUTE | FAILURE_ROUTE },
 	{"cr_nofallback_route",(cmd_function)cr_nofallback_route,     6, cr_route_fixup,             0, REQUEST_ROUTE | FAILURE_ROUTE },
 	{"cr_nofallback_route",(cmd_function)cr_nofallback_route,     6, cr_route_fixup,             0, REQUEST_ROUTE | FAILURE_ROUTE },
 	{"cr_next_domain",   (cmd_function)cr_load_next_domain,   6, cr_load_next_domain_fixup,  0, REQUEST_ROUTE | FAILURE_ROUTE },
 	{"cr_next_domain",   (cmd_function)cr_load_next_domain,   6, cr_load_next_domain_fixup,  0, REQUEST_ROUTE | FAILURE_ROUTE },

+ 1 - 42
modules/carrierroute/cr_func.c

@@ -51,7 +51,6 @@
 
 
 enum hash_algorithm {
 enum hash_algorithm {
 	alg_crc32 = 1, /*!< hashing algorithm is CRC32 */
 	alg_crc32 = 1, /*!< hashing algorithm is CRC32 */
-	alg_prime, /*!< hashing algorithm is (right 18 digits of hash_source % prime_number) % max_targets + 1 */
 	alg_crc32_nofallback, /*!< same algorithm as alg_crc32, with only a backup rule, but no fallback tree is chosen
 	alg_crc32_nofallback, /*!< same algorithm as alg_crc32, with only a backup rule, but no fallback tree is chosen
                            if there is something wrong. */
                            if there is something wrong. */
 	alg_error
 	alg_error
@@ -394,16 +393,6 @@ static int rewrite_on_rule(struct route_flags *rf_head, flag_t flags, str * dest
 	}
 	}
 
 
 	switch (alg) {
 	switch (alg) {
-		case alg_prime:
-			if ((prob = prime_hash_func(msg, hash_source, rf->max_targets)) < 0) {
-				LM_ERR("could not hash message with prime algorithm");
-				return -1;
-			}
-			if ((rr = get_rule_by_hash(rf, prob)) == NULL) {
-				LM_CRIT("no route found\n");
-				return -1;
-			}
-			break;
 		case alg_crc32:
 		case alg_crc32:
 			if(rf->dice_max == 0) {
 			if(rf->dice_max == 0) {
 				LM_ERR("invalid dice_max value\n");
 				LM_ERR("invalid dice_max value\n");
@@ -682,41 +671,11 @@ int cr_route5(struct sip_msg * _msg, gparam_t *_carrier,
 }
 }
 
 
 
 
-/**
- * rewrites the request URI of msg after determining the
- * new destination URI with the prime hash algorithm.
- *
- * @param _msg the current SIP message
- * @param _carrier the requested carrier
- * @param _domain the requested routing domain
- * @param _prefix_matching the user to be used for prefix matching
- * @param _rewrite_user the localpart of the URI to be rewritten
- * @param _hsrc the SIP header used for hashing
- * @param _descavp the name of the AVP where the description is stored
- *
- * @return 1 on success, -1 on failure
- */
-int cr_prime_route(struct sip_msg * _msg, gparam_t *_carrier,
-		gparam_t *_domain, gparam_t *_prefix_matching,
-		gparam_t *_rewrite_user, enum hash_source _hsrc,
-		gparam_t *_descavp)
-{
-	return cr_do_route(_msg, _carrier, _domain, _prefix_matching,
-		_rewrite_user, _hsrc, alg_prime, _descavp);
-}
-
-int cr_prime_route5(struct sip_msg * _msg, gparam_t *_carrier,
-		gparam_t *_domain, gparam_t *_prefix_matching,
-		gparam_t *_rewrite_user, enum hash_source _hsrc)
-{
-	return cr_do_route(_msg, _carrier, _domain, _prefix_matching,
-		_rewrite_user, _hsrc, alg_prime, NULL);
-}
 /**
 /**
  * rewrites the request URI of msg after determining the
  * rewrites the request URI of msg after determining the
  * new destination URI with the crc32 hash algorithm. The difference
  * new destination URI with the crc32 hash algorithm. The difference
  * to cr_route is that no fallback rule is chosen if there is something
  * to cr_route is that no fallback rule is chosen if there is something
- * wrong (like cr_prime_route)
+ * wrong (like now obselete cr_prime_route)
  *
  *
  * @param _msg the current SIP message
  * @param _msg the current SIP message
  * @param _carrier the requested carrier
  * @param _carrier the requested carrier

+ 1 - 23
modules/carrierroute/cr_func.h

@@ -74,34 +74,12 @@ int cr_route5(struct sip_msg * _msg, gparam_t *_carrier,
 		gparam_t *_rewrite_user, enum hash_source _hsrc);
 		gparam_t *_rewrite_user, enum hash_source _hsrc);
 
 
 
 
-/**
- * rewrites the request URI of msg after determining the
- * new destination URI
- *
- * @param _msg the current SIP message
- * @param _carrier the requested carrier
- * @param _domain the requested routing domain
- * @param _prefix_matching the user to be used for prefix matching
- * @param _rewrite_user the localpart of the URI to be rewritten
- * @param _hsrc the SIP header used for hashing
- * @param _descavp the name of the AVP where the description is stored
- *
- * @return 1 on success, -1 on failure
- */
-int cr_prime_route(struct sip_msg * _msg, gparam_t *_carrier,
-		gparam_t *_domain, gparam_t *_prefix_matching,
-		gparam_t *_rewrite_user, enum hash_source _hsrc,
-		gparam_t *_descavp);
-int cr_prime_route5(struct sip_msg * _msg, gparam_t *_carrier,
-		gparam_t *_domain, gparam_t *_prefix_matching,
-		gparam_t *_rewrite_user, enum hash_source _hsrc);
-
 /**
 /**
  *
  *
  * rewrites the request URI of msg after determining the
  * rewrites the request URI of msg after determining the
  * new destination URI with the crc32 hash algorithm. The difference
  * new destination URI with the crc32 hash algorithm. The difference
  * to cr_route is that no fallback rule is chosen if there is something
  * to cr_route is that no fallback rule is chosen if there is something
- * wrong (behaves like cr_prime_route)
+ * wrong (behaves like now obselete cr_prime_route)
  *
  *
  * @param _msg the current SIP message
  * @param _msg the current SIP message
  * @param _carrier the requested carrier
  * @param _carrier the requested carrier

+ 1 - 86
modules/carrierroute/doc/carrierroute_admin.xml

@@ -364,21 +364,12 @@ modparam("carrierroute", "match_mode", 10)
 cr_rewrite_uri(domain, hash_source)
 cr_rewrite_uri(domain, hash_source)
 -> cr_route("default", domain, "$rU", "$rU", hash_source)
 -> cr_route("default", domain, "$rU", "$rU", hash_source)
 
 
-cr_prime_balance_uri(domain, hash_source)
--> cr_prime_route("default", domain, "$rU", "$rU", hash_source)
-
 cr_rewrite_by_to(domain, hash_source)
 cr_rewrite_by_to(domain, hash_source)
 -> cr_route("default", domain, "$tU", "$rU", hash_source)
 -> cr_route("default", domain, "$tU", "$rU", hash_source)
 
 
-cr_prime_balance_by_to(domain, hash_source)
--> cr_prime_route("default", domain, "$tU", "$rU", hash_source)
-
 cr_rewrite_by_from(domain, hash_source)
 cr_rewrite_by_from(domain, hash_source)
 -> cr_route("default", domain, "$fU", "$rU", hash_source)
 -> cr_route("default", domain, "$fU", "$rU", hash_source)
 
 
-cr_prime_balance_by_from(domain, hash_source)
--> cr_prime_route("default", domain, "$fU", "$rU", hash_source)
-
 cr_user_rewrite_uri(uri, domain)
 cr_user_rewrite_uri(uri, domain)
 -> cr_user_carrier(user, domain, "$avp(tree_avp)")
 -> cr_user_carrier(user, domain, "$avp(tree_avp)")
 -> cr_route("$avp(tree_avp)", domain, "$rU", "$rU", "call_id")
 -> cr_route("$avp(tree_avp)", domain, "$rU", "$rU", "call_id")
@@ -491,82 +482,6 @@ cr_tree_rewrite_uri(tree, domain)
         </listitem>
         </listitem>
 	    </itemizedlist>
 	    </itemizedlist>
 	</section>
 	</section>
-		<section>
-	    <title>
-		<function moreinfo="none">cr_prime_route(carrier, domain, prefix_matching, rewrite_user, hash_source, descavp)</function>
-	    </title>
-	    <para>
-        This function searches for the longest match for the user given
-        in prefix_matching at the given domain in the given carrier tree.
-        The Request URI is rewritten using rewrite_user and the given
-        hash source and algorithm. Returns -1 if there is no data found
-        or an empty rewrite host on the longest match is found. On success
-        also the description is stored in the given AVP (if obmitted, nothing
-        is stored in an AVP). This is useful if you need some additional
-        informations that belongs to each gw, like the destination or the
-        number of channels.
-        This function is only usable with rewrite_user and prefix_matching
-        containing a valid string. This string needs to be numerical if the match_mode
-        parameter is set to 10.
-            </para>
-            <para>
-        It uses the prime hash algorithm to calculate the hash values. This
-        means that the fuction behaves different then the normal routing
-        function. If you don't know what this prime functionality is,
-        you should just use the <emphasis>cr_route</emphasis> function. The
-        prime routing algorithm not use the configured probabilities in
-        order to route requests, it just uses a fixed hash distribution. If
-        one of the hash targets is not available, and no backup rule is
-        configured, the function will return -1.
-	    </para>
-	    <para>
-	Please not that this function is deprecated and will be removed in
-	the next stable release. Please consider using the
-	<emphasis>cr_nofallback_route</emphasis> function instead.
-	    </para>
-	    <para>Meaning of the parameters is as follows:</para>
-	    <itemizedlist>
-        <listitem>
-		      <para><emphasis>carrier</emphasis> - The routing tree to be used. Additional to a string
-            any pseudo-variable could be used as input.
-  		    </para>
-        </listitem>
-        <listitem>
-		      <para><emphasis>domain</emphasis> - Name of the routing domain to be used.
-            Additional to a string any pseudo-variable could
-            be used as input.
-  		    </para>
-        </listitem>
-        <listitem>
-		      <para><emphasis>prefix_matching</emphasis> - User name to be used for prefix matching
-            in the routing tree.
-            Additional to a string any pseudo-variable could
-            be used as input.
-  		    </para>
-        </listitem>
-        <listitem>
-		      <para><emphasis>rewrite_user</emphasis> - The user name to be used for applying the
-            rewriting rule. Usually this is the user part of the request
-            URI. Additional to a string any pseudo-variable could
-            be used as input.
-  		    </para>
-        </listitem>
-        <listitem>
-		      <para><emphasis>hash_source</emphasis> - The hash values of the destination set must
-            be a contiguous range starting at 1, limited by the
-            configuration parameter max_targets. Possible values for
-            hash_source are: call_id, from_uri, from_user, to_uri
-            to_user and rand
-  		    </para>
-        </listitem>
-        <listitem>
-		      <para><emphasis>descavp</emphasis> - Name of the AVP where to store the description.
-			This parameter is optional.
-  		    </para>
-        </listitem>
-	    </itemizedlist>
-	</section>
-
 		<section>
 		<section>
 	    <title>
 	    <title>
 		<function moreinfo="none">cr_nofallback_route(carrier, domain, prefix_matching, rewrite_user, hash_source, descavp)</function>
 		<function moreinfo="none">cr_nofallback_route(carrier, domain, prefix_matching, rewrite_user, hash_source, descavp)</function>
@@ -588,7 +503,7 @@ cr_tree_rewrite_uri(tree, domain)
 	    <para>
 	    <para>
 		It uses the standard CRC32 algorithm to calculate the hash values. In contrast
 		It uses the standard CRC32 algorithm to calculate the hash values. In contrast
 		to the normal <emphasis>cr_route</emphasis> function the backup
 		to the normal <emphasis>cr_route</emphasis> function the backup
-		rules of cr_prime_route is used. This means not the configured
+		rules of (now obselete) cr_prime_route is used. This means not the configured
 		probabilities will be used, only a fixed hash distribution. This
 		probabilities will be used, only a fixed hash distribution. This
 		makes sense to distribute incoming register requests e.g. to a bunch of
 		makes sense to distribute incoming register requests e.g. to a bunch of
 		registrar servers. If one of the hash targets is not available and
 		registrar servers. If one of the hash targets is not available and

+ 0 - 45
modules/carrierroute/prime_hash.c

@@ -69,51 +69,6 @@ int hash_func (struct sip_msg * msg,
 	return ret;
 	return ret;
 }
 }
 
 
-int prime_hash_func(struct sip_msg * msg,
-                              enum hash_source source, int denominator) {
-	str source_string;
-	if(source != shs_from_user && source != shs_to_user) {
-		LM_ERR("chosen hash source not usable (may contain letters)\n");
-		return -1;
-	}
-	if (determine_source (msg, source, &source_string) == -1) {
-		return -1;
-	}
-
-	static const int INT_DIGIT_LIMIT = 18;
-	static const int PRIME_NUMBER = 51797;
-	uint64_t number = 0;
-	uint64_t p10;
-	int i, j, limit = 0;
-	int ret;
-	char source_number_s[INT_DIGIT_LIMIT + 1];
-
-	i = INT_DIGIT_LIMIT - 1;
-	j = source_string.len - 1;
-	source_number_s[INT_DIGIT_LIMIT] ='\0';
-
-	while(i >= 0 && j >= 0) {
-		if(isdigit(source_string.s[j])) {
-			source_number_s[i] = source_string.s[j];
-			i--;
-		}
-		j--;
-	}
-	limit = i;
-
-	for(i=INT_DIGIT_LIMIT - 1, p10=1; i>limit; i--, p10=p10*10) {
-		number += (source_number_s[i] - '0') * p10;
-	}
-
-	LM_DBG("source_string is %.*s, source_number_s "
-	    "is: %s, number is %llu\n", source_string.len, source_string.s,
-	    source_number_s + (limit + 1), (long long unsigned int)number);
-	ret = number % PRIME_NUMBER;
-	ret = ret % denominator + 1;
-	LM_DBG("calculated hash is: %i\n", ret);
-	return ret;
-}
-
 static int determine_source (struct sip_msg *msg, enum hash_source source,
 static int determine_source (struct sip_msg *msg, enum hash_source source,
                              str *source_string) {
                              str *source_string) {
 	source_string->s = NULL;
 	source_string->s = NULL;

+ 0 - 8
modules/carrierroute/prime_hash.h

@@ -71,12 +71,4 @@ typedef int (*hash_func_t)(struct sip_msg * msg,
 int hash_func (struct sip_msg * msg,
 int hash_func (struct sip_msg * msg,
                          enum hash_source source, int denominator);
                          enum hash_source source, int denominator);
 
 
-/*!
- * \brief prime hash function
- * Returns an integer number between 0 and denominator - 1 based on
- * the hash source from the msg. Use the prime number algorithm.
-*/
-int prime_hash_func (struct sip_msg * msg,
-                               enum hash_source source, int denominator);
-
 #endif
 #endif