<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-2" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Michal<br>
<br>
<br>
Michal Matyska napisa³(a):
<blockquote cite="mid1171892483.6703.19.camel@broucek" type="cite">
  <pre wrap="">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).
  </pre>
</blockquote>
I did like you wrote and called t_relay() after positive result of the
sd_lookup() unfortunatelly the result was<br>
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 <br>
again received and processed through the logic, but the invocation of
the
lookup_user("$t.uid","@ruri") in the 'second round' didn't cause the
'second round' lookup_contacts() to return the positive result. <br>
<blockquote cite="mid1171892483.6703.19.camel@broucek" type="cite">
  <pre wrap="">

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;
}
  </pre>
</blockquote>
lookup_contacts() works but only in the 'first round' with the
lookup_user("$t.uid","@ruri").<br>
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<br>
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).
<blockquote cite="mid1171892483.6703.19.camel@broucek" type="cite">
  <pre wrap="">
Michal

On Fri, 2007-02-16 at 09:29 +0100, tzieleniewski wrote:
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">Hi,

seems related to the lookup session we had on beginning of this week.
sd_lookup puts the uid into TO / USER, which is not working with the
head version (lookup_contacts need it in TO / URI)

You can use this workaround:
   if (uri =~ <a class="moz-txt-link-rfc2396E" href="sip:[0-9]{2}@.*">"sip:[0-9]{2}@.*"</a>) {
      sd_lookup("speed_dial");
      $tr.uid=$tu.uid;
   }
      </pre>
    </blockquote>
    <pre wrap="">Yes it seemed to me but I just wasn't sure:)
I checked it if it helped and unfortunately nothing changed. I checked it more deeply to get some more view on this and found strange results.
I did the following:
   
   dump_attrs();
   xlog("L_INFO", " route[INBOUND]: (uri =~ <a class="moz-txt-link-freetext" href="sip:[0-9">sip:[0-9</a>]{<a class="moz-txt-link-abbreviated" href="mailto:2}@.*">2}@.*</a>) &lt;%rm&gt; &lt;%ru&gt; \n");
   if (uri =~ <a class="moz-txt-link-rfc2396E" href="sip:[0-9]{2}@.*">"sip:[0-9]{2}@.*"</a>) {
      xlog("L_INFO", " route[INBOUND]: sd_lookup(speed_dial) \n");
      sd_lookup("speed_dial");
   };
   dump_attrs();

and result showed that there is no uid put into TO / USER so generally putting $tr.uid=$tu.uid does nothing, it is visible below in the output:

Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:540: class=GLOBAL
Feb 16 09:14:10 rd ser[16874]: AVP["lang"]="en"
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 16 09:14:10 rd ser[16874]: AVP["did"]="voip.touk.pl"
Feb 16 09:14:10 rd ser[16874]: AVP["digest_realm"]="voip.touk.pl"
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 16 09:14:10 rd ser[16874]: AVP["did"]="voip.touk.pl"
Feb 16 09:14:10 rd ser[16874]: AVP["digest_realm"]="voip.touk.pl"
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:570: track=FROM class=USER
Feb 16 09:14:10 rd ser[16874]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 16 09:14:10 rd ser[16874]: AVP["email"]=<a class="moz-txt-link-rfc2396E" href="mailto:tzl@touk.pl">"tzl@touk.pl"</a>
Feb 16 09:14:10 rd ser[16874]: AVP["lang"]="en"
Feb 16 09:14:10 rd ser[16874]: AVP["tyk"]="tyk"
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:580: track=TO class=USER
Feb 16 09:14:10 rd ser[16874]: INFO: No AVP present
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:590: track=FROM class=URI
Feb 16 09:14:10 rd ser[16874]: AVP["authuid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 16 09:14:10 rd ser[16874]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:600: track=TO class=URI
Feb 16 09:14:10 rd ser[16874]: INFO: No AVP present
Feb 16 09:14:10 rd ser[16874]:  route[INBOUND]: (uri =~ <a class="moz-txt-link-freetext" href="sip:[0-9">sip:[0-9</a>]{<a class="moz-txt-link-abbreviated" href="mailto:2}@.*">2}@.*</a>) &lt;INVITE&gt; <a class="moz-txt-link-rfc2396E" href="sip:01@voip.touk.pl">&lt;sip:01@voip.touk.pl&gt;</a>
Feb 16 09:14:10 rd ser[16874]:  route[INBOUND]: sd_lookup(speed_dial)
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:540: class=GLOBAL
Feb 16 09:14:10 rd ser[16874]: AVP["lang"]="en"
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 16 09:14:10 rd ser[16874]: AVP["did"]="voip.touk.pl"
Feb 16 09:14:10 rd ser[16874]: AVP["digest_realm"]="voip.touk.pl"
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 16 09:14:10 rd ser[16874]: AVP["did"]="voip.touk.pl"
Feb 16 09:14:10 rd ser[16874]: AVP["digest_realm"]="voip.touk.pl"
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:570: track=FROM class=USER
Feb 16 09:14:10 rd ser[16874]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 16 09:14:10 rd ser[16874]: AVP["email"]=<a class="moz-txt-link-rfc2396E" href="mailto:tzl@touk.pl">"tzl@touk.pl"</a>
Feb 16 09:14:10 rd ser[16874]: AVP["lang"]="en"
Feb 16 09:14:10 rd ser[16874]: AVP["tyk"]="tyk"
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:580: track=TO class=USER
Feb 16 09:14:10 rd ser[16874]: INFO: No AVP present
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:590: track=FROM class=URI
Feb 16 09:14:10 rd ser[16874]: AVP["authuid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 16 09:14:10 rd ser[16874]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 16 09:14:10 rd ser[16874]: INFO: avp.c:600: track=TO class=URI
Feb 16 09:14:10 rd ser[16874]: INFO: No AVP present

And there are still many questions about the lookup_user() function.
When I call a subscriber directly not by speeddial number and I invoke it this way:

lookup_user("$t.uid", "@ruri");

then the invocation of he lookup_contacts("location") function returns positive result. Any other form of lookup_user() causes the failure of the lookup_contacts() function. 
I tried to do $tr.uid = $t.uid as well as $tu.uid = $t.uid after lookup_user() but it always didn't cause any change and those avp values where always empty. 

Please share any ideas:)
Cheers
-tomasz

    </pre>
    <blockquote type="cite">
      <pre wrap="">it will set the AVP in the URI track and should be then reachable.

Michal


On Thu, 2007-02-15 at 14:20 +0100, tzieleniewski wrote:
      </pre>
      <blockquote type="cite">
        <pre wrap="">Hi!

I have encountered the following situation after I make the translation from the speeddial number into the proper uri the user cannot be found by the lookup_contacts() function. Calling a user directly works without any problem:

My logic is the following:

   dump_attrs();
   if (uri =~ <a class="moz-txt-link-rfc2396E" href="sip:[0-9]{2}@.*">"sip:[0-9]{2}@.*"</a>) {
      sd_lookup("speed_dial");
   }
   dump_attrs();
   if (lookup_user("$t.uid", "@ruri")) {
      dump_attrs();
      load_attrs("$tu", "@ruri");
      load_attrs("$tr", "@ruri");
      dump_attrs();
      if (lookup_contacts("location")) {
         append_hf("P-hint: usrloc applied\r\n");
         route(FORWARD);
         drop;
      } else {
         route(CALL_FORWARD_VOICEMAIL);
         drop;
      }
   }

Here is the debug output:

Feb 15 14:15:23 rd ser[14469]:  route[INBOUND]: &lt;INVITE&gt; <a class="moz-txt-link-rfc2396E" href="sip:01@voip.touk.pl">&lt;sip:01@voip.touk.pl&gt;</a>
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:540: class=GLOBAL
Feb 15 14:15:23 rd ser[14469]: AVP["lang"]="en"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 15 14:15:23 rd ser[14469]: AVP["did"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: AVP["digest_realm"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 15 14:15:23 rd ser[14469]: AVP["did"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: AVP["digest_realm"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:570: track=FROM class=USER
Feb 15 14:15:23 rd ser[14469]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["email"]=<a class="moz-txt-link-rfc2396E" href="mailto:tzl@touk.pl">"tzl@touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["lang"]="en"
Feb 15 14:15:23 rd ser[14469]: AVP["tyk"]="tyk"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:580: track=TO class=USER
Feb 15 14:15:23 rd ser[14469]: INFO: No AVP present
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:590: track=FROM class=URI
Feb 15 14:15:23 rd ser[14469]: AVP["authuid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:600: track=TO class=URI
Feb 15 14:15:23 rd ser[14469]: INFO: No AVP present
Feb 15 14:15:23 rd ser[14469]:  route[INBOUND]: (uri =~ <a class="moz-txt-link-freetext" href="sip:[0-9">sip:[0-9</a>]{<a class="moz-txt-link-abbreviated" href="mailto:2}@.*">2}@.*</a>) &lt;INVITE&gt; <a class="moz-txt-link-rfc2396E" href="sip:01@voip.touk.pl">&lt;sip:01@voip.touk.pl&gt;</a>
Feb 15 14:15:23 rd ser[14469]:  route[INBOUND]: sd_lookup(speed_dial)
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:540: class=GLOBAL
Feb 15 14:15:23 rd ser[14469]: AVP["lang"]="en"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 15 14:15:23 rd ser[14469]: AVP["did"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: AVP["digest_realm"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 15 14:15:23 rd ser[14469]: AVP["did"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: AVP["digest_realm"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:570: track=FROM class=USER
Feb 15 14:15:23 rd ser[14469]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["email"]=<a class="moz-txt-link-rfc2396E" href="mailto:tzl@touk.pl">"tzl@touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["lang"]="en"
Feb 15 14:15:23 rd ser[14469]: AVP["tyk"]="tyk"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:580: track=TO class=USER
Feb 15 14:15:23 rd ser[14469]: INFO: No AVP present
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:590: track=FROM class=URI
Feb 15 14:15:23 rd ser[14469]: AVP["authuid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:600: track=TO class=URI
Feb 15 14:15:23 rd ser[14469]: INFO: No AVP present
Feb 15 14:15:23 rd ser[14469]:  route[INBOUND]: (lookup_user($t.uid, @ruri)) &lt;INVITE&gt; <a class="moz-txt-link-rfc2396E" href="sip:hellboy@voip.touk.pl">&lt;sip:hellboy@voip.touk.pl&gt;</a>
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:540: class=GLOBAL
Feb 15 14:15:23 rd ser[14469]: AVP["lang"]="en"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 15 14:15:23 rd ser[14469]: AVP["did"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: AVP["digest_realm"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 15 14:15:23 rd ser[14469]: AVP["did"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: AVP["digest_realm"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:570: track=FROM class=USER
Feb 15 14:15:23 rd ser[14469]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["email"]=<a class="moz-txt-link-rfc2396E" href="mailto:tzl@touk.pl">"tzl@touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["lang"]="en"
Feb 15 14:15:23 rd ser[14469]: AVP["tyk"]="tyk"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:580: track=TO class=USER
Feb 15 14:15:23 rd ser[14469]: INFO: No AVP present
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:590: track=FROM class=URI
Feb 15 14:15:23 rd ser[14469]: AVP["authuid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:600: track=TO class=URI
Feb 15 14:15:23 rd ser[14469]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]:  route[INBOUND]: load_attrs($tu,@ruri) &lt;INVITE&gt; <a class="moz-txt-link-rfc2396E" href="sip:hellboy@voip.touk.pl">&lt;sip:hellboy@voip.touk.pl&gt;</a>
Feb 15 14:15:23 rd ser[14469]:  route[INBOUND]: load_attrs($tr,@ruri) &lt;INVITE&gt; <a class="moz-txt-link-rfc2396E" href="sip:hellboy@voip.touk.pl">&lt;sip:hellboy@voip.touk.pl&gt;</a>
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:540: class=GLOBAL
Feb 15 14:15:23 rd ser[14469]: AVP["lang"]="en"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:550: track=FROM class=DOMAIN
Feb 15 14:15:23 rd ser[14469]: AVP["did"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: AVP["digest_realm"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:560: track=TO class=DOMAIN
Feb 15 14:15:23 rd ser[14469]: AVP["did"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: AVP["digest_realm"]="voip.touk.pl"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:570: track=FROM class=USER
Feb 15 14:15:23 rd ser[14469]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["email"]=<a class="moz-txt-link-rfc2396E" href="mailto:tzl@touk.pl">"tzl@touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["lang"]="en"
Feb 15 14:15:23 rd ser[14469]: AVP["tyk"]="tyk"
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:580: track=TO class=USER
Feb 15 14:15:23 rd ser[14469]: INFO: No AVP present
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:590: track=FROM class=URI
Feb 15 14:15:23 rd ser[14469]: AVP["authuid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: INFO: avp.c:600: track=TO class=URI
Feb 15 14:15:23 rd ser[14469]: AVP["uid"]=<a class="moz-txt-link-rfc2396E" href="mailto:hellboy@voip.touk.pl">"hellboy@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]: AVP["forward_blindd"]=<a class="moz-txt-link-rfc2396E" href="sip:evn@voip.touk.pl">"sip:evn@voip.touk.pl"</a>
Feb 15 14:15:23 rd ser[14469]:  route[INBOUND]: (lookup_contacts(location))
Feb 15 14:15:23 rd ser[14469]:  route[INBOUND]: route(CALL_FORWARD_VOICEMAIL) &lt;INVITE&gt; <a class="moz-txt-link-rfc2396E" href="sip:hellboy@voip.touk.pl">&lt;sip:hellboy@voip.touk.pl&gt;</a>

Bests
-tomasz
_______________________________________________
Serusers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Serusers@lists.iptel.org">Serusers@lists.iptel.org</a>
<a class="moz-txt-link-freetext" href="http://lists.iptel.org/mailman/listinfo/serusers">http://lists.iptel.org/mailman/listinfo/serusers</a>
        </pre>
      </blockquote>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->

  </pre>
</blockquote>
<br>
</body>
</html>