<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-15"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hello,<br>
    <br>
    <tt>the problem is that lookup(location) is handling only R-URI, so
      if ruri is for user XYZ and that is offline, then will return
      false.<br>
      <br>
      Since you create many branches with avp_pushto(), other
      destinations added as extra branches will be not attempted because
      of lookup(location) condition.<br>
      <br>
      The best is to relay the call after the avp_pushto(), so you will
      get two branches (or more) coming back via loopback and then you
      do lookup location for each:<br>
      <br>
      if(src_ip!=myself)<br>
      {<br>
         if(avp_db_load("$ru/username","$avp(s:fork)"))<br>
         {<br>
           avp_pushto("$ru/username","$avp(s:fork)/g");<br>
           t_relay();<br>
           exit;<br>
         }<br>
      }<br>
      <br>
      if(!lookup("location")) ....<br>
      <br>
      Be sure you skip authentication or other checks when the requests
      comes back due to such loop, using if(src_ip==myself) conditions.<br>
      <br>
      Cheers,<br>
      Daniel<br>
    </tt>
    <br>
    <br>
    On 1/21/11 11:10 AM, Daniel Grotti wrote:
    <blockquote cite="mid:4D395B79.4070504@klarya.it" type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-15">
      <tt>Hi all,<br>
        I'm using kamailio 3.1 and I have some problems with parallel
        forking.<br>
        I need to implement parallel forking to different users
        registered on kamailio.<br>
        So, when call arrives with R-URI= <a moz-do-not-send="true"
          class="moz-txt-link-freetext" href="sip:003912345678@">sip:003912345678@</a>&lt;IP_server&gt;,
        I need to fork te call to (for example) 2 users: 1001 and 1001.<br>
        <br>
        To do that, I've created my usr_preferences table like this:<br>
        <br>
      </tt>
      <pre>+----+------+------------------+--------+-----------+------+-------+---------------------+
|<i> id | uuid | username                | domain | attribute | type | value | </i>last_modified       |
+----+------+------------------+--------+-----------+------+-------+---------------------+
|<i>  1 |      | </i><tt>003912345678</tt><i>     |        | fork      |    0 | 1001  |              |
</i>|<i>  2 |      | </i><tt>003912345678</tt><i>     |        | fork      |    0 | 1002  |              |
</i>+----+------+------------------+--------+-----------+------+-------+---------------------+</pre>
      <br>
      <tt>and I've added a code to my kam.cfg like this:<br>
        <br>
      </tt>
      <pre>if (is_method("INVITE")) 
{
        
        xlog("L_INFO", "REQUEST Invite - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        if(avp_db_load("$ru/username","$avp(s:fork)"))
        {
            avp_pushto("$ru/username","$avp(s:fork)/g");

        }
        
        if(!lookup("location"))
        {

                xlog("L_INFO", "Local user offline - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                sl_send_reply("404", "User Offline");
                exit;
        }
        else
        {

                xlog("L_INFO", "Local user online - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
                t_relay();
        }

}</pre>
      <br>
      <tt><br>
        If 1001 and 1002 are registered everything works fine (1001
        Ringing and 1002 ringing).<br>
        If</tt><tt> only 1001</tt> <tt>registered everything works fine
        (</tt><tt>1001 ringing and 1002 is offline.).</tt> <br>
      <br>
      <tt>But when 1002 is registered and 1001 in offline, kamailio try
        to call 1001, find that it's offline ( and I get 404 User
        Offline") but no call to 1002 is attempted.<br>
        <br>
        <br>
        <br>
        What's wrong ?<br>
        <br>
        <br>
        <br>
        Regards,<br>
      </tt><tt><br>
        Daniel</tt><br>
      <p class="western" style="margin-bottom: 0cm;"><br>
      </p>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
<a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
  </body>
</html>