Re: [OpenSIPS-Users] Dynamic Routing - routing using source IPaddress

2009-09-15 Thread Bogdan-Andrei Iancu
Hi Julien,

Julien Chavanton wrote:
> Thank you, I will look further after using group, I am also facig some 
> requirements to append prefix, when a call comes in from a defined 
> Gateway.
> Here is a recap, of what I understand after reading testing Dynamic 
> Routing :
>  
> When a call is comming from a given Gateway we can not use Dynamic 
> Routing to append/strip prefixes, DR module only work on destination 
> Gateway.
well, you can do it, but only if the source is also a GW defined in DR 
module. See the is_from_gw() function:
  
http://www.opensips.org/html/docs/modules/1.6.x/drouting.html#id272680

Regards,
Bogdan



>  
> Therefore I selected to use Dial Plan for append/strip prefix on 
> inbound calls.
>  
>  
> Outbound number manipulation prefix append/strip : module (Dynamic 
> Routing)
> 
> "STRIP" : striped from the RURI when the call is going to the target 
> gateway
> "PRI Prefix" : assigned to the RURI when the call is going to the 
> target gateway
>  
>  
> Inbound number manipulation prefix append/strip : module (Dial Plan)
> --
> Prefix : a lookup in the dialplan table for the source IP address will 
> return a prefix to append if any
>  
> Example:
>  # find if there is a prefix for traffic from the IP address
>  dp_translate("0", "$src_ip/$avp(s:prefix)");
>  if($avp(s:prefix) && method=="INVITE" && !has_totag()){
>   xlog("prefix for IP[$src_ip]=[$avp(s:prefix)]\n");
>   $rU  =  $avp(s:prefix) + $rU ;
>  }
>  else{
>   xlog("no prefix for IP[$src_ip]\n");
>  }
>  
>
> ------------------------
> *From:* users-boun...@lists.opensips.org on behalf of Brett Nemeroff
> *Sent:* Thu 10/09/2009 4:18 PM
> *To:* OpenSIPS users mailling list
> *Subject:* Re: [OpenSIPS-Users] Dynamic Routing - routing using source 
> IPaddress
>
> Usually you set the group based on something else. I use memcache for 
> this.. so I toss the IP against memcache, which returns a group id, 
> then I use that in the do_routing() cmd. 
>
> Of course, this requires pre-populating the cache src_ip => group_id
>
> The newly released startup_route can do that for you now. :D
>
> -Brett
>
>
> On Thu, Sep 10, 2009 at 8:00 AM, Julien Chavanton  <mailto:j...@atlastelecom.com>> wrote:
>
> With Dynamic Routing, how can we route based on source IP
> address/Gateway ?
>
> ___
> Users mailing list
> Users@lists.opensips.org <mailto:Users@lists.opensips.org>
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> 
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Dynamic Routing - routing using source IPaddress

2009-09-10 Thread Julien Chavanton
Thank you, I will look further after using group, I am also facig some 
requirements to append prefix, when a call comes in from a defined Gateway.
Here is a recap, of what I understand after reading testing Dynamic Routing :
 
When a call is comming from a given Gateway we can not use Dynamic Routing to 
append/strip prefixes, DR module only work on destination Gateway.
 
Therefore I selected to use Dial Plan for append/strip prefix on inbound calls.
 
 
Outbound number manipulation prefix append/strip : module (Dynamic Routing) 

"STRIP" : striped from the RURI when the call is going to the target gateway
"PRI Prefix" : assigned to the RURI when the call is going to the target gateway
 
 
Inbound number manipulation prefix append/strip : module (Dial Plan) 
--
Prefix : a lookup in the dialplan table for the source IP address will return a 
prefix to append if any
 
Example:
 # find if there is a prefix for traffic from the IP address
 dp_translate("0", "$src_ip/$avp(s:prefix)");
 if($avp(s:prefix) && method=="INVITE" && !has_totag()){
  xlog("prefix for IP[$src_ip]=[$avp(s:prefix)]\n");
  $rU  =  $avp(s:prefix) + $rU ;
 }
 else{
  xlog("no prefix for IP[$src_ip]\n");
 }

 



From: users-boun...@lists.opensips.org on behalf of Brett Nemeroff
Sent: Thu 10/09/2009 4:18 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Dynamic Routing - routing using source IPaddress


Usually you set the group based on something else. I use memcache for this.. so 
I toss the IP against memcache, which returns a group id, then I use that in 
the do_routing() cmd.  

Of course, this requires pre-populating the cache src_ip => group_id

The newly released startup_route can do that for you now. :D

-Brett


On Thu, Sep 10, 2009 at 8:00 AM, Julien Chavanton  wrote:


With Dynamic Routing, how can we route based on source IP 
address/Gateway ?

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users