[SR-Users] Problem with parallel forking

2011-01-21 Thread Daniel Grotti
Hi all,
I'm using kamailio 3.1 and I have some problems with parallel forking.
I need to implement parallel forking to different users registered on
kamailio.
So, when call arrives with R-URI= sip:003912345678@, I need
to fork te call to (for example) 2 users: 1001 and 1001.

To do that, I've created my usr_preferences table like this:

++--+--++---+--+---+-+
|/ id | uuid | username| domain | attribute | type | value | 
/last_modified   |
++--+--++---+--+---+-+
|/  1 |  | /003912345678/ || fork  |0 | 1001  | 
 |
/|/  2 |  | /003912345678/ || fork  |0 | 1002  |
  |
/++--+--++---+--+---+-+


and I've added a code to my kam.cfg like this:

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();
}

}



If 1001 and 1002 are registered everything works fine (1001 Ringing and
1002 ringing).
Ifonly 1001 registered everything works fine (1001 ringing and 1002 is
offline.).

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.



What's wrong ?



Regards,

Daniel


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Problem with parallel forking

2011-01-21 Thread Daniel-Constantin Mierla

Hello,

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.


Since you create many branches with avp_pushto(), other destinations 
added as extra branches will be not attempted because of 
lookup(location) condition.


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:


if(src_ip!=myself)
{
   if(avp_db_load("$ru/username","$avp(s:fork)"))
   {
 avp_pushto("$ru/username","$avp(s:fork)/g");
 t_relay();
 exit;
   }
}

if(!lookup("location")) 

Be sure you skip authentication or other checks when the requests comes 
back due to such loop, using if(src_ip==myself) conditions.


Cheers,
Daniel


On 1/21/11 11:10 AM, Daniel Grotti wrote:

Hi all,
I'm using kamailio 3.1 and I have some problems with parallel forking.
I need to implement parallel forking to different users registered on 
kamailio.
So, when call arrives with R-URI= sip:003912345678@, I need 
to fork te call to (for example) 2 users: 1001 and 1001.


To do that, I've created my usr_preferences table like this:

++--+--++---+--+---+-+
|/  id | uuid | username   | domain | attribute | type | value 
|/last_modified   |
++--+--++---+--+---+-+
|/   1 |  |/003912345678/  || fork  |0 | 1001  |
  |
/|/   2 |  |/003912345678/  || fork  |0 | 1002  |   
   |
/++--+--++---+--+---+-+

and I've added a code to my kam.cfg like this:

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();
 }

}


If 1001 and 1002 are registered everything works fine (1001 Ringing 
and 1002 ringing).
Ifonly 1001 registered everything works fine (1001 ringing and 1002 is 
offline.).


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.




What's wrong ?



Regards,

Daniel



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


--
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
http://www.asipto.com

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Problem with parallel forking

2011-01-21 Thread Daniel Grotti


  
  
Thank you Daniel,

That was what I was looking for.

Cheers,
Daniel G.



Il 21/01/2011 12:04, Daniel-Constantin Mierla ha scritto:

  
  
  Hello,
  
  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.

Since you create many branches with avp_pushto(), other
destinations added as extra branches will be not attempted
because of lookup(location) condition.

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:

if(src_ip!=myself)
{
   if(avp_db_load("$ru/username","$avp(s:fork)"))
   {
 avp_pushto("$ru/username","$avp(s:fork)/g");
 t_relay();
 exit;
   }
}

if(!lookup("location")) 

Be sure you skip authentication or other checks when the
requests comes back due to such loop, using if(src_ip==myself)
conditions.

Cheers,
Daniel
   
  
  On 1/21/11 11:10 AM, Daniel Grotti wrote:
  

Hi all,
  I'm using kamailio 3.1 and I have some problems with parallel
  forking.
  I need to implement parallel forking to different users
  registered on kamailio.
  So, when call arrives with R-URI= sip:003912345678@,

  I need to fork te call to (for example) 2 users: 1001 and
  1001.
  
  To do that, I've created my usr_preferences table like this:
  

++--+--++---+--+---+-+
| id | uuid | username 	   | domain | attribute | type | value | last_modified   |
++--+--++---+--+---+-+
|  1 |  | 003912345678 || fork  |0 | 1001  |  |
|  2 |  | 003912345678 || fork  |0 | 1002  |  |
++--+--++---+--+---+-+

and I've added a code to my kam.cfg like this:
  

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();
}

}


  If 1001 and 1002 are registered everything works fine (1001
  Ringing and 1002 ringing).
  If only 1001 registered everything works
  fine (1001 ringing and 1002 is offline.). 

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.
  
  
  
  What's wrong ?
  
  
  
  Regards,

  Daniel



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

  
  
  -- 
Daniel-Constantin Mierla
Kamailio (OpenSER) Advanced Training
Jan 24-26, 2011, Irvine, CA, USA
http://www.asipto.com



-- 
  
  
  
  
  
  
  
  
  
Ing.
Daniel
  Grotti - System
  Engineer
  Certified
Asterisk Professional dCAP
  Mobile:
+39 331 6907200
Office: +39 059 821672 
Fax: +39 059
821492
  Web:
www.klarya.it
  



  
  This
  e-mail transmission may contain legally privileged and/or
  confidential information. Please do not read it if you are
  not the intended recipient(s). Any use, distribution,
  reproduction or disclosure by any other person is strictly
  prohibited. If you have received this e-mail in error,
  please notify the sender and destroy the original
  transmission.
  
  

  

___

[SR-Users] Problem with parallel forking of aliases

2012-05-09 Thread x-kamailio
Greetings,

I'm having trouble getting parallel forking to work with aliasdb. I'm
running kamailio 3.2 with the standard kamailio.cfg script.

I have found that if an alias points to a set of addresses that all
reference local devices that are registered with the server, kamailio
sends an invitation to the first device in the set (the one that the
aliasdb lookup function sets to the ruri, but does *not* invite any of
the other devices in the set, which aliasdb adds as branches.

However, if one of the other aliases points to a non-local address,
such as a PSTN address, kamailio does correctly invite the non-local
address in parallel with the first alias address, which is a local
device.

It seems as if kamailio is ignoring invitations that it is in effect
sending to itself via the additional parallel branches. I would expect
that to call a branch in parallel, kamailio would need to do a lookup
on the branch address and rewrite it to send the invitation to the
registered device. But none of that seems to be happening.

There must be some additional configuration change required to make
this work. Any suggestions?

-- 
Mark Sidell
Partner
Forte, Inc.
919-942-7068
fax 919-969-2844
www.forteinc.com

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users