Преглед изворни кода

modules/enum: enum_pv_query() modification

- enum_pv_query() now applies NAPTR regex to E.164 number given in its
  pv argument.  Earlier NAPTR was applied to E.164 number in Request URI
  user part.
Juha Heinanen пре 15 година
родитељ
комит
5ab5c7ff69
3 измењених фајлова са 4 додато и 26 уклоњено
  1. 1 2
      modules/enum/README
  2. 1 2
      modules/enum/doc/enum_admin.xml
  3. 2 22
      modules/enum/enum.c

+ 1 - 2
modules/enum/README

@@ -116,8 +116,7 @@ Chapter 1. Admin Guide
    you may wish to route based on something else. The function
    enum_pv_query mimics the behavior of the enum_query function except the
    E.164 number in its pseudo variable argument is used for the enum
-   lookup instead of the user part of the RURI. Obviously the user part of
-   the RURI is still used in the NAPTR regexp.
+   lookup instead of the user part of the RURI.
 
    Enum query returns 1 if the current Request URI was replaced and -1 if
    not.

+ 1 - 2
modules/enum/doc/enum_admin.xml

@@ -77,8 +77,7 @@
 		<function moreinfo="none">enum_pv_query</function> mimics the behavior
 		of the <function moreinfo="none">enum_query</function> function except the
 		E.164 number in its pseudo variable argument is used for the enum lookup instead of the user
-		part of the RURI.  Obviously the user part of the RURI is still used in the
-		NAPTR regexp.
+		part of the RURI.
 	</para>
 	<para>
 		Enum query returns 1 if the current Request URI was replaced 

+ 2 - 22
modules/enum/enum.c

@@ -3,7 +3,7 @@
  *
  * Enum and E164 related functions
  *
- * Copyright (C) 2002-2008 Juha Heinanen
+ * Copyright (C) 2002-2010 Juha Heinanen
  *
  * This file is part of Kamailio, a free SIP server.
  *
@@ -999,7 +999,6 @@ int enum_pv_query_3(struct sip_msg* _msg, char* _sp, char* _suffix,
 	char new_uri[MAX_URI_SIZE];
 	unsigned int priority, curr_prio;
 	qvalue_t q;
-	char tostring[17];
 	struct rdata* head;
 	struct rdata* l;
 	struct naptr_rdata* naptr;
@@ -1013,25 +1012,6 @@ int enum_pv_query_3(struct sip_msg* _msg, char* _sp, char* _suffix,
 	suffix = (str*)_suffix;
 	service = (str*)_service;
 
-	/*
-	 *  Get R-URI user to tostring
-	 */
-	if (parse_sip_msg_uri(_msg) < 0) {
-		LM_ERR("R-URI parsing failed\n");
-		return -1;
-	}
-
-	if (is_e164(&(_msg->parsed_uri.user)) == -1) {
-		LM_ERR("R-URI user is not an E164 number\n");
-		return -1;
-	}
-
-	user_s = _msg->parsed_uri.user.s;
-	user_len = _msg->parsed_uri.user.len;
-
-	memcpy(&(tostring[0]), user_s, user_len);
-	tostring[user_len] = (char)0;
-
 	/*
 	 * Get E.164 number from pseudo variable
          */
@@ -1112,7 +1092,7 @@ int enum_pv_query_3(struct sip_msg* _msg, char* _sp, char* _suffix,
 		/* Avoid making copies of pattern and replacement */
 		pattern.s[pattern.len] = (char)0;
 		replacement.s[replacement.len] = (char)0;
-		if (reg_replace(pattern.s, replacement.s, &(tostring[0]),
+		if (reg_replace(pattern.s, replacement.s, &(string[0]),
 				&result) < 0) {
 			pattern.s[pattern.len] = '!';
 			replacement.s[replacement.len] = '!';