[SR-Users] Routing between 2 domains

Daniel-Constantin Mierla miconda at gmail.com
Mon Oct 12 14:25:51 CEST 2015


Hello,

the src_ip is not a local IP, so do not match it with INT_IP or EXT_IP.
The dst_ip is local ip, but the one on which the interface was received.

You can test the $fs to see what socket is going to be used for sending out.

Or set some branch flag for each interface when the registration is
processed and check that in branch route

if(is_method("REGISTER")) {
if(dst_ip==INT_IP){
   setbflag(20);
}else{
   setbflag(21);
}
}

then in route[NATMANGE] have conditions like:

if(src_ip==INT_IP && isflagset(20)) {
   # internal to internal
} else if(src_ip==INT_IP && isflagset(21)) {
   # internal to external
} else if ...


Cheers,
Daniel

On 08/10/15 11:14, kai.ohnacker at cbc.de wrote:
>
> Hello community,
>
>  
>
> I work with Kamailio 4.2.0 which is placed between two networks (with
> two interfaces) and RTPproxy in bridge mode.
>
> The task from Kamailio is to handle the calls from internal networks
> to internal networks only on the internal Interface without bridging.
> For external networks vice versa. If the call comes from external to
> internal, then the RTPproxy should work in bridge mode and vice versa.
> I adapt the example with IPv4 and IPv6 routing, but this is not
> working for internal to external calls and vice versa
> (http://kb.asipto.com/kamailio:kamailio-mixed-ipv4-ipv6). Only
> external calls and only internal calls works. I think the cause of
> this behavior is the routing which I implemented to the RTPmanage part
> in the Kamailio config.
>
> The error message is given by the internal device. (call from external
> to internal)
>
> If I make a call from internal to external, the RTP stream is only in
> one direction.
>
>  
>
> Internal Interface IP: 203.207.111.58
>
> External Interface IP: 193.16.163.58
>
>  
>
> The RTPproxy config is:
>
> CONTROL_SOCK=udp:127.0.0.1:9000
>
> EXTRA_OPTS="-l 203.207.111.58/193.16.163.58 -d WARN:LOG_LOCAL1"
>
>  
>
> Kamailio.cfg:
>
> #!define INT_IP 10.96.0.0/14
>
> #!define EXT_IP 193.0.0.0/8
>
>  
>
> # RTPProxy control and singaling updates for NAT traversal
>
> route[NATMANAGE] {
>
> #!ifdef WITH_NAT
>
>         if (is_request()) {
>
>                 if(has_totag()) {
>
>                         if(check_route_param("nat=yes")) {
>
>                                 setbflag(FLB_NATB);
>
>                         }
>
>                 }
>
>         }
>
>         if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))
>
>                 return;
>
>  
>
> #       rtpproxy_manage("co");
>
>  
>
> # Start Test routing
>
>  
>
>         if((src_ip==INT_IP && dst_ip==EXT_IP)){
>
>                         rtpproxy_manage("cowie");
>
>                         }
>
>         if((src_ip==EXT_IP && dst_ip==INT_IP)){
>
>                         rtpproxy_manage("cowei");
>
>                         }
>
>  
>
>         if (is_request()) {
>
>                 if (!has_totag()) {
>
>                         if(t_is_branch_route()) {
>
>                                 add_rr_param(";nat=yes");
>
>                         }
>
>                 }
>
>         }
>
>         if (is_reply()) {
>
>                 if(isbflagset(FLB_NATB)) {
>
>                         if(is_first_hop())
>
>                                 set_contact_alias();
>
>                 }
>
>         }
>
> #!endif
>
>         return;
>
> }
>
>  
>
> Can someone help me with the right routing? Do you need some more
> debugging information?
>
>  
>
> Cheers,
>
> Kai
>
>  
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20151012/dd183e29/attachment.html>


More information about the sr-users mailing list