I did some tests.
I sent them on the list because I wat not sure how to interpret their correctness beefore
putting them on the tracker
I did the following general procedure:
dump_attrs()
lookup_user(..)
dump_attrs()
load_attrs(..)
dump_attrs()
lookup_contacts(..)
Case one:
dump_attrs()
lookup_user("$t.uid","@ruri")
dump_attrs()
load_attrs("$tu","$t.uid")
dump_attrs()
lookup_contacts("location")
my observations: after lookup_user("$t.uid","@ruri") uid avp appered
in the uri class and to track, lookup_contacts("location") found the user
debug log:
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:540: class=GLOBAL
Feb 13 13:48:25 rd ser[9875]: AVP["lang"]="en"
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 13 13:48:25 rd ser[9875]: AVP["did"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 13 13:48:25 rd ser[9875]: AVP["did"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:570: track=FROM class=USER
Feb 13 13:48:25 rd ser[9875]: INFO: No AVP present
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:580: track=TO class=USER
Feb 13 13:48:25 rd ser[9875]: INFO: No AVP present
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:590: track=FROM class=URI
Feb 13 13:48:25 rd ser[9875]: INFO: No AVP present
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:600: track=TO class=URI
Feb 13 13:48:25 rd ser[9875]: INFO: No AVP present
Feb 13 13:48:25 rd ser[9875]: route[INBOUND]: (lookup_user($t.uid, @ruri))
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:540: class=GLOBAL
Feb 13 13:48:25 rd ser[9875]: AVP["lang"]="en"
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 13 13:48:25 rd ser[9875]: AVP["did"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 13 13:48:25 rd ser[9875]: AVP["did"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:570: track=FROM class=USER
Feb 13 13:48:25 rd ser[9875]: INFO: No AVP present
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:580: track=TO class=USER
Feb 13 13:48:25 rd ser[9875]: INFO: No AVP present
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:590: track=FROM class=URI
Feb 13 13:48:25 rd ser[9875]: INFO: No AVP present
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:600: track=TO class=URI
Feb 13 13:48:25 rd ser[9875]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: route[INBOUND]: load_attrs($tu,$t.uid)
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:540: class=GLOBAL
Feb 13 13:48:25 rd ser[9875]: AVP["lang"]="en"
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 13 13:48:25 rd ser[9875]: AVP["did"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 13 13:48:25 rd ser[9875]: AVP["did"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:570: track=FROM class=USER
Feb 13 13:48:25 rd ser[9875]: INFO: No AVP present
Feb 13 13:48:25 rd ser[9875]: INFO: avp.c:580: track=TO class=USER
Feb 13 13:48:25 rd ser[9875]: INFO: No AVP present
Feb 13 13:48:26 rd ser[9875]: INFO: avp.c:590: track=FROM class=URI
Feb 13 13:48:26 rd ser[9875]: INFO: No AVP present
Feb 13 13:48:26 rd ser[9875]: INFO: avp.c:600: track=TO class=URI
Feb 13 13:48:26 rd ser[9875]: AVP["uid"]="hellboy(a)voip.touk.pl"
Case two:
dump_attrs()
lookup_user("Request-uri")
dump_attrs()
load_attrs("$tu","$tu.uid")
dump_attrs()
lookup_contacts("location")
my observations: after lookup_user("Request-uri") uid avp appered in the user
class and to track, lookup_contacts("location") didn't find the user
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:540: class=GLOBAL
Feb 13 14:22:57 rd ser[10047]: AVP["lang"]="en"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 13 14:22:57 rd ser[10047]: AVP["did"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 13 14:22:57 rd ser[10047]: AVP["did"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:570: track=FROM class=USER
Feb 13 14:22:57 rd ser[10047]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:580: track=TO class=USER
Feb 13 14:22:57 rd ser[10047]: INFO: No AVP present
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:590: track=FROM class=URI
Feb 13 14:22:57 rd ser[10047]: AVP["authuid"]="hellboy(a)voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:600: track=TO class=URI
Feb 13 14:22:57 rd ser[10047]: INFO: No AVP present
Feb 13 14:22:57 rd ser[10047]: route[INBOUND]: (lookup_user(Request-uri)
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:540: class=GLOBAL
Feb 13 14:22:57 rd ser[10047]: AVP["lang"]="en"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 13 14:22:57 rd ser[10047]: AVP["did"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 13 14:22:57 rd ser[10047]: AVP["did"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:570: track=FROM class=USER
Feb 13 14:22:57 rd ser[10047]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:580: track=TO class=USER
Feb 13 14:22:57 rd ser[10047]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: AVP["ruri_canonical"]="1"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:590: track=FROM class=URI
Feb 13 14:22:57 rd ser[10047]: AVP["authuid"]="hellboy(a)voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:600: track=TO class=URI
Feb 13 14:22:57 rd ser[10047]: INFO: No AVP present
Feb 13 14:22:57 rd ser[10047]: route[INBOUND]: load_attrs($tu,$t.uid)
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:540: class=GLOBAL
Feb 13 14:22:57 rd ser[10047]: AVP["lang"]="en"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 13 14:22:57 rd ser[10047]: AVP["did"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 13 14:22:57 rd ser[10047]: AVP["did"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:570: track=FROM class=USER
Feb 13 14:22:57 rd ser[10047]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:580: track=TO class=USER
Feb 13 14:22:57 rd ser[10047]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: AVP["ruri_canonical"]="1"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:590: track=FROM class=URI
Feb 13 14:22:57 rd ser[10047]: AVP["authuid"]="hellboy(a)voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:22:57 rd ser[10047]: INFO: avp.c:600: track=TO class=URI
Feb 13 14:22:57 rd ser[10047]: INFO: No AVP present
Case three:
dump_attrs()
lookup_user("$tu.uid","@ruri")
dump_attrs()
load_attrs("$tu","$tu.uid")
dump_attrs()
lookup_contacts("location")
my observations: after lookup_user("$tu.uid","@ruri") uid avp appered
in the user class and to track, lookup_contacts("location") didn't find the
user I also tried to invoke lookup_contacts("location","$tu.uid") but
with the same result user wasn't found.
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:540: class=GLOBAL
Feb 13 14:36:42 rd ser[10100]: AVP["lang"]="en"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 13 14:36:42 rd ser[10100]: AVP["did"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 13 14:36:42 rd ser[10100]: AVP["did"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:570: track=FROM class=USER
Feb 13 14:36:42 rd ser[10100]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:580: track=TO class=USER
Feb 13 14:36:42 rd ser[10100]: INFO: No AVP present
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:590: track=FROM class=URI
Feb 13 14:36:42 rd ser[10100]: AVP["authuid"]="hellboy(a)voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:600: track=TO class=URI
Feb 13 14:36:42 rd ser[10100]: INFO: No AVP present
Feb 13 14:36:42 rd ser[10100]: route[INBOUND]: (lookup_user($tu.uid, @ruri))
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:540: class=GLOBAL
Feb 13 14:36:42 rd ser[10100]: AVP["lang"]="en"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 13 14:36:42 rd ser[10100]: AVP["did"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 13 14:36:42 rd ser[10100]: AVP["did"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:570: track=FROM class=USER
Feb 13 14:36:42 rd ser[10100]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:580: track=TO class=USER
Feb 13 14:36:42 rd ser[10100]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:590: track=FROM class=URI
Feb 13 14:36:42 rd ser[10100]: AVP["authuid"]="hellboy(a)voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:600: track=TO class=URI
Feb 13 14:36:42 rd ser[10100]: INFO: No AVP present
Feb 13 14:36:42 rd ser[10100]: route[INBOUND]: load_attrs($tu,$tu.uid)
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:540: class=GLOBAL
Feb 13 14:36:42 rd ser[10100]: AVP["lang"]="en"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 13 14:36:42 rd ser[10100]: AVP["did"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 13 14:36:42 rd ser[10100]: AVP["did"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: AVP["digest_realm"]="voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:570: track=FROM class=USER
Feb 13 14:36:42 rd ser[10100]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:580: track=TO class=USER
Feb 13 14:36:42 rd ser[10100]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:590: track=FROM class=URI
Feb 13 14:36:42 rd ser[10100]: AVP["authuid"]="hellboy(a)voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: AVP["uid"]="hellboy(a)voip.touk.pl"
Feb 13 14:36:42 rd ser[10100]: INFO: avp.c:600: track=TO class=URI
Feb 13 14:36:42 rd ser[10100]: INFO: No AVP present
So generally lookup_contacts works only if it can find the uid in the uri class even if
there are uid set in other classes it doesn' find the user. Another thing is that when
invoked lookup_user("$t.uid","@ruri") the uid avp is put in the uri
track.
Maybe instead of lookup_contacts one should use registerd() function??
But what does it do? does it only check the location table or as well make an uri set??
Bests
Tomasz
On Mon, 2007-02-12 at 22:13 +0100, tzieleniewski
wrote:
Thank You:) It help!
But actually I had it done with the usage of
lookup_user("$t.uid","@ruri").
does it make any difference from lookup_user("$tu.uid","@ruri") when
I use $t.uid instead of $tu.uid? this is putting this avp to general class with the To
track isn't it??
when I changed to lookup_user("Request-uri") it worked so generally works:) but
not for lookup_user("$t.uid","@ruri").
Obviously there must be some difference... if it has helped. :-) You can
check what it has done using dump_attrs() call. It will output all AVPs
set to the syslog (must have debug >= 3 iirc).
It should not go into general class, if not specified the user should be
the correct one... check the dump_attrs output and fill bug report at
tracker.iptel.org. (I guess it set the uri class and lookup_contacts
checks user class only)
Michal
is there some order and priority in which the
lookup_contacts() searches for uid?? (for instance first in user class and then I
global??)
Basically uri, user, domain, global is the order if you specify track
only AVP e.g. $t.uid so you can set widely accepted default value
(domain/global) and override it for some users and uris if you want.
Some functions (like lookup_contacts) don't allow to set the avp name,
have to check the code what they expect.
If you specify class too (e.g. $tu.uid) just the only one track/class is
searched.
Michal
tomasz
> The difference is that there is the forwarded request visible...
> #
> U 2007/02/12 20:35:16.241648 192.168.1.2:5060 -> 192.168.1.2:5060
> INVITE sip:hellboy@tezet.no-ip.org SIP/2.0.
> Record-Route: <sip:192.168.1.2;ftag=1173592111;lr=on>.
> Via: SIP/2.0/UDP 192.168.1.2;branch=z9hG4bKb946.ee8b4793.0.
> Via: SIP/2.0/UDP
> 192.168.1.2:7061;rport=7061;branch=z9hG4bK7AF94D00BA07C6380C5EC3434F4EB592.
> From: tomix <sip:tomix@tezet.no-ip.org:7061>;tag=1173592111.
> To: <sip:tomix@tezet.no-ip.org>.
> Contact: <sip:tomix@192.168.1.2:7061>.
> Call-ID: 0E6FCCFF-D661-0186-3392-977A4BBCDE86(a)192.168.1.2.
> CSeq: 23808 INVITE.
> Proxy-Authorization: Digest
>
username="tomix",realm="tezet.no-ip.org",nonce="45d0c2a0f928f22d790a5dfa17228b193d454c7e",response="0df094e8ea2808fa71d2fa28ccdfa8a4",uri="sip:tomix@tezet.no-ip.org",qop=auth,cnonce="67344073698582511BAA60061EBDA625",nc=00000001.
> Max-Forwards: 16.
> Content-Type: application/sdp.
> User-Agent: X-Lite release 1105d.
> Content-Length: 308.
>
>
> If I understand it correctly you get this request being forwarded to the
> contacs of tomix(a)tezet.no-ip.org and not hellboy@.... using usrloc
> lookup (P-hint in the next INVITE).
>
> Then you must have set the TO / USER avp name "uid" based on the To
> header instead of request-uri. Check the lookup_user function calls, it
> should be
> for REGISTER
> lookup_user("To") or lookup_user("$tu.uid","(a)to.uri")
>
> and for other requests
> lookup_user("Request-uri") or
lookup_user("$tu.uid","@ruri")
>
>
> If you want to do some originating services, you can use
> lookup_user("From") or lookup_user("$fu.uid",
"(a)from.uri")
>
> Michal
>
>
>
> On Mon, 2007-02-12 at 20:41 +0100, tzieleniewski wrote:
> > Ok I did it.
> > There is no difference.
> > Just to make sure I attached the file.
> >
> > Because I left work I repeated the situation at home. I call to
"myself" tomix(a)tezet.no-ip.org and I try to forward to hellboy(a)tezet.no-ip.org
which is not registered.
> >
> > I can also send my ser.cfg if it might help.
> >
> > tomasz
> >
> > > I see. Please capture the network on linux cooked interface
"any", so
> > > even the request sent over loopback will be visible.
> > >
> > > Michal
> > >
> > > On Mon, 2007-02-12 at 16:53 +0100, tzieleniewski wrote:
> > > > Yes but this ruri sip:hellboy@192.168.0.116:5060 is set after the
invocation of lookup_contacts(). the function is invoked on the message which contains
ruri changed by the forward_blind parameter.
> > > > There is first "round" when processing of the first INVITE
reaches the checking of the forward_blind parameter after which I invoke the attr2uri and
just after this make the t_relay. then there is second "round" with the changed
ruri. before lookup_contacts I see the ruri as mm(a)voip.touk.pl and after
sip:hellboy@192.168.0.116:5060 which is in fact the location corresponding to
sip:hellboy@voip.touk.pl.
> > > > there is no message sending through the network but the message with
the new ruri is processed which is visible in the log file I see it logged with the
changed ruri??
> > > >
> > > > So where is the problem??
> > > > Is it the problem of attr2uri?
> > > > I tried it by using rewriteuri() and it gave me the same result.
changed ruri but lookup_contacts() returns value corresponding to the first ruri. Maybe
> > > > lookup_contacts() checks not the ruri??
> > > >
> > > >
> > > > > Yes, your request-uri is sip:hellboy@192.168.0.116:5060 which I
think
> > > > > will not be looked up in location (lookup_contact should fail),
so it
> > > > > does not rewrite the request-uri at all.
> > > > >
> > > > > Michal
> > > > >
> > > > > On Mon, 2007-02-12 at 16:05 +0100, tzieleniewski wrote:
> > > > > > hmm
> > > > > > it is strange because I can see that after attr2uri and
t_relay() message again enters the main route block and goes through the whole processing
but I can't see the message being send through the network. the recourd_route and via
headers are being attached which is visible in the message send to unwanted (contained in
the first invite - in this case myself because I try this by calling my self and setting
forward_blind to another sip uri) destination:
> > > > > >
> > > > > > U 2007/02/12 16:05:12.199566 192.168.0.74:506