On Fri, 2007-02-23 at 01:39 +0100, TZieleniewski wrote:
Hi Michal
Michal Matyska napisaĆ(a):
Hi,
so I've finally found some time and checked the code and from that point
of view:
sd_lookup rewrites request-uri, so basically you should call t_relay if
it was successful. (as the target of the speeddial might be different
domain you should relay it).
I did like you wrote and called t_relay() after positive result of the
sd_lookup() unfortunatelly the result was
the same as in the previously tried scenarios when I tried to forward
the sip message again to ser. The URI as you said was rewritten and
again received and processed through the logic, but the invocation of
OK, so sd_lookup solved.
the lookup_user("$t.uid","@ruri")
in the 'second round' didn't cause
the 'second round' lookup_contacts() to return the positive result.
lookup_contacts searches in the TO / USER avp list only for avp with uid
name. If such avp is not found the TO header uri is parsed and user uid
looked in the db and new avp stored. (This is correct for REGISTER (but
you won't use lookup_contacts within register :), for other request
methods it should use the request-uri).
Which makes me crazy related to your observations, it is supposed to be
working this way (but you reported it as failing):
...
lookup_user("$tu.uid", "@ruri");
if (lookup_contacts("location")) {
t_relay();
drop;
}
lookup_contacts() works but only in the 'first round' with the
lookup_user("$t.uid","@ruri").
It works by accident, if you don't set user/to avp uid, then the TO
header is used for the AOR building (I've already created SER-234 bug
report). So in the first loop, the To and request uri are the same and
the user is found correctly. The second round (e.g. due to sd_lookup) is
not working, as the To header is the original one.
I tried to invoke
lookup_user("$tu.uid","@ruri") after the positive
invocation of lookup_user("$t.uid","@ruri") to have the uid in the
to / user track but
even with the uid avp present the result of the second
lookup_contacts() was negative (user was registered and available -
direct call worked without any problems).
That's strange as we use it everywhere and it works.... Check uid of the
registered contact (location table) against the uid found by lookup_user
before the lookup_contacts call (dump_attrs).
Michal