Module: sip-router
Branch: 3.1
Commit: 4d5a004b2bb78fa8bf9bb4b603b085d04dee5519
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4d5a004…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Apr 25 11:45:12 2011 +0200
rls(k): few fixes
- string comparison that fails because sometimes one of the strings
is '\0' terminated and the other never is.
- fix for when some non-RLS SUBSCRIBEs are not identified as such.
- fix for a small typo in an error diagnostic.
- patch by Peter Dunkley
(cherry picked from commit 2917d848a0ede8b7285a2f8414d43fcd4262f6e3)
---
modules_k/rls/subscribe.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/modules_k/rls/subscribe.c b/modules_k/rls/subscribe.c
index f667379..c1efbd9 100644
--- a/modules_k/rls/subscribe.c
+++ b/modules_k/rls/subscribe.c
@@ -90,7 +90,7 @@ xmlNodePtr rls_get_by_service_uri(xmlDocPtr doc, str* uri)
val = XMLNodeGetAttrContentByName(node, "uri");
if(val!=NULL)
{
- if((uri->len==strlen(val)) && (strcmp(val, uri->s)==0))
+ if((uri->len==strlen(val)) && (strncmp(val, uri->s, uri->len)==0))
{
xmlFree(val);
return node;
@@ -241,13 +241,17 @@ int rls_get_service_list(str *service_uri, str *user, str *domain,
*service_node = rls_get_by_service_uri(xmldoc, service_uri);
if(*service_node==NULL)
{
- LM_ERR("service uri %.*s not found in rl document for user"
+ LM_DBG("service uri %.*s not found in rl document for user"
" sip:%.*s@%.*s\n", service_uri->len, service_uri->s,
user->len, user->s, domain->len, domain->s);
- goto error;
+ rootdoc = NULL;
+ if(xmldoc!=NULL)
+ xmlFreeDoc(xmldoc);
+ }
+ else
+ {
+ *rootdoc = xmldoc;
}
-
- *rootdoc = xmldoc;
rls_dbf.free_result(rls_db, result);
if(xcapdoc!=NULL)
@@ -621,7 +625,7 @@ int rls_handle_subscribe(struct sip_msg* msg, char* s1, char* s2)
if(send_full_notify(&subs, service_node, subs.version, &subs.pres_uri,
hash_code)<0)
{
- LM_ERR("failed sending full state sotify\n");
+ LM_ERR("failed sending full state notify\n");
goto error;
}
/* send subscribe requests for all in the list */
Module: sip-router
Branch: master
Commit: 2917d848a0ede8b7285a2f8414d43fcd4262f6e3
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2917d84…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Apr 25 11:45:12 2011 +0200
rls(k): few fixes
- string comparison that fails because sometimes one of the strings
is '\0' terminated and the other never is.
- fix for when some non-RLS SUBSCRIBEs are not identified as such.
- fix for a small typo in an error diagnostic.
- patch by Peter Dunkley
---
modules_k/rls/subscribe.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/modules_k/rls/subscribe.c b/modules_k/rls/subscribe.c
index f667379..c1efbd9 100644
--- a/modules_k/rls/subscribe.c
+++ b/modules_k/rls/subscribe.c
@@ -90,7 +90,7 @@ xmlNodePtr rls_get_by_service_uri(xmlDocPtr doc, str* uri)
val = XMLNodeGetAttrContentByName(node, "uri");
if(val!=NULL)
{
- if((uri->len==strlen(val)) && (strcmp(val, uri->s)==0))
+ if((uri->len==strlen(val)) && (strncmp(val, uri->s, uri->len)==0))
{
xmlFree(val);
return node;
@@ -241,13 +241,17 @@ int rls_get_service_list(str *service_uri, str *user, str *domain,
*service_node = rls_get_by_service_uri(xmldoc, service_uri);
if(*service_node==NULL)
{
- LM_ERR("service uri %.*s not found in rl document for user"
+ LM_DBG("service uri %.*s not found in rl document for user"
" sip:%.*s@%.*s\n", service_uri->len, service_uri->s,
user->len, user->s, domain->len, domain->s);
- goto error;
+ rootdoc = NULL;
+ if(xmldoc!=NULL)
+ xmlFreeDoc(xmldoc);
+ }
+ else
+ {
+ *rootdoc = xmldoc;
}
-
- *rootdoc = xmldoc;
rls_dbf.free_result(rls_db, result);
if(xcapdoc!=NULL)
@@ -621,7 +625,7 @@ int rls_handle_subscribe(struct sip_msg* msg, char* s1, char* s2)
if(send_full_notify(&subs, service_node, subs.version, &subs.pres_uri,
hash_code)<0)
{
- LM_ERR("failed sending full state sotify\n");
+ LM_ERR("failed sending full state notify\n");
goto error;
}
/* send subscribe requests for all in the list */
Juha Heinanen writes:
> domain module sets $td.did at lookup_domain call. $td.did seems to be a
> normal avp, because i can print its value with xlog by referring to it
> as $avp(td.did). however, its value is gone at failure route, which
> makes me suspect that $td.did is not really a normal avp.
perhaps this has something to do with the flags of $td.did avp that seem
to be
flags = AVP_TRACK_TO | AVP_CLASS_DOMAIN
i modified avpops avp_print() to print AVP with those flags and called
it at the and of branch route and at the beginning of onerply route. i
got to syslog
Apr 23 14:25:52 sip /usr/sbin/sip-proxy[9862]: INFO: Printing AVPs in branch route
Apr 23 14:25:52 sip /usr/sbin/sip-proxy[9862]: INFO: avpops [avpops_impl.c:1328]: p=0xb4797ca0, flags=0x0041
Apr 23 14:25:52 sip /usr/sbin/sip-proxy[9862]: INFO: avpops [avpops_impl.c:1332]: #011#011#011name=<lcr_id>
Apr 23 14:25:52 sip /usr/sbin/sip-proxy[9862]: INFO: avpops [avpops_impl.c:1342]: #011#011#011val_int=<1>
Apr 23 14:25:52 sip /usr/sbin/sip-proxy[9862]: INFO: avpops [avpops_impl.c:1328]: p=0xb4797c10, flags=0x0043
Apr 23 14:25:52 sip /usr/sbin/sip-proxy[9862]: INFO: avpops [avpops_impl.c:1332]: #011#011#011name=<did>
Apr 23 14:25:52 sip /usr/sbin/sip-proxy[9862]: INFO: avpops [avpops_impl.c:1340]: #011#011#011val_str=<test.fi / 7>
Apr 23 14:25:52 sip /usr/sbin/sip-proxy[9865]: INFO: Printing AVPs in onreply route
this shows that $td.did was set at the end of branch route, but not at
the beginning of onreply route, which seems to indicate that avps with
flags AVP_TRACK_TO | AVP_CLASS_DOMAIN are not saved/restored with the
transaction.
i then tried to read tm module code and found this kind of line in
t_hooks.c:
set_avp_list(AVP_CLASS_DOMAIN | AVP_TRACK_TO, backup_dom_to );
which seems to indicate that those avps would be saved, but clearly that
is not the case.
i'll switch this to sr-dev list in the hope that there is someone left
who knows what is going on and how also AVP_TRACK_TO | AVP_CLASS_DOMAIN
avps can be saved/restored with the transaction?
-- juha