Module: sip-router
Branch: master
Commit: 5ab5c7ff6954661de9efe84136f5fa42784ef2b9
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5ab5c7f…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: Wed Apr 7 09:24:44 2010 +0300
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.
---
modules/enum/README | 3 +--
modules/enum/doc/enum_admin.xml | 3 +--
modules/enum/enum.c | 24 ++----------------------
3 files changed, 4 insertions(+), 26 deletions(-)
diff --git a/modules/enum/README b/modules/enum/README
index 24f727c..1585dbe 100644
--- a/modules/enum/README
+++ b/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.
diff --git a/modules/enum/doc/enum_admin.xml b/modules/enum/doc/enum_admin.xml
index 8560049..0c031c6 100644
--- a/modules/enum/doc/enum_admin.xml
+++ b/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
diff --git a/modules/enum/enum.c b/modules/enum/enum.c
index ba4fc48..695beaf 100644
--- a/modules/enum/enum.c
+++ b/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;
@@ -1014,25 +1013,6 @@ int enum_pv_query_3(struct sip_msg* _msg, char* _sp, char*
_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
*/
if (sp && (pv_get_spec_value(_msg, sp, &pv_val) == 0)) {
@@ -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] = '!';