[SR-Users] Routing between 2 domains

Daniel-Constantin Mierla miconda at gmail.com
Wed Oct 21 12:57:22 CEST 2015


Hello,

I spotted at least one issue: you set the branch flag (with setbflag())
but then you test message/transaction flags with isflagset() -- to test
branch flags you have to use isbflagset().

Cheers,
Daniel

On 21/10/15 11:42, kai.ohnacker at cbc.de wrote:
>
> Hello Daniel,
>
>  
>
> thanks for the reply. I try out your suggestion, but this is not
> working. There is no sound transmitted and the connection ended after
> 23 seconds (I think a timer is expired). 
>
> Scenario is:
>
> Kamailio route all internal calls only internal (external vice versa)
>
> Kamailio route all internal to external through rtpproxy (also vice
> versa)                           
>
>  
>
> INT_IP: 203.207.111.58
>
> EXT_IP: 193.16.163.58
>
>  
>
> Here my code:
>
> request_route {
>
>         if(is_method("REGISTER")) {
>
>                 if(dst_ip==203.207.111.58){
>
>                         setbflag(20);
>
>                 }else{
>
>                         setbflag(21);
>
>                 }
>
>         }
>
> }
>
>  
>
> Route [NATMANAGE]
>
>  
>
>  
>
>         if(dst_ip==203.207.111.58 && isflagset(20)){
>
>                         rtpproxy_manage("coii");
>
>         }else if(dst_ip==203.207.111.58 && isflagset(21)){
>
>                         rtpproxy_manage("coie");
>
>         }else if(dst_ip==193.16.163.58 && isflagset(20)){
>
>                         rtpproxy_manage("coei");
>
>         }else if(dst_ip==193.16.163.58 && isflagset(21)){
>
>                         rtpproxy_manage("coee");
>
>         }
>
>  
>
> Alternative try
>
>  
>
> if(from_uri=~".*@203.207.111.58"&& isflagset(20)){
>
>                         rtpproxy_manage("coii");
>
>         }else if(from_uri=~".*@203.207.111.58"&& isflagset(21)){
>
>                         rtpproxy_manage("coie");
>
>         }else if(from_uri=~".*@193.16.163.58"&& isflagset(20)){
>
>                         rtpproxy_manage("coei");
>
>         }else if(from_uri=~".*@193.16.163.58"&& isflagset(21)){
>
>                         rtpproxy_manage("coee");
>
>         }
>
>  
>
> Another try
>
>  
>
>  
>
>         if(from_uri=~".*@203.207.111.58" && isflagset(20)){
>
>                         rtpproxy_manage("coii");
>
>         }else if(from_uri=~".*@203.207.111.58" && isflagset(21)){
>
>                         rtpproxy_manage("coie");
>
>         }else if(from_uri=~".*@193.16.163.58" && isflagset(20)){
>
>                         rtpproxy_manage("coei");
>
>         }else if(from_uri=~".*@193.16.163.58" && isflagset(21)){
>
>                         rtpproxy_manage("coee");
>
>         }
>
>  
>
> RTPproxy config
>
>  
>
> EXTRA_OPTS="-l 203.207.111.58/193.16.163.58 -m 20000 -M 20100 -d
> WARN:LOG_LOCAL1"
>
>  
>
> Some debugging information are in the txt file. TCPdump debugging does
> not shows interesting informations…
>
>  
>
> Has somebody a good idea which could be helpful? Do you need some more
> information?
>
>  
>
>  
>
> Cheers,
>
> Kai
>
>  
>
>  
>
> *Von:*sr-users [mailto:sr-users-bounces at lists.sip-router.org] *Im
> Auftrag von *Daniel-Constantin Mierla
> *Gesendet:* Montag, 12. Oktober 2015 14:26
> *An:* Kamailio (SER) - Users Mailing List <sr-users at lists.sip-router.org>
> *Betreff:* Re: [SR-Users] Routing between 2 domains
>
>  
>
> 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 <mailto: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 <mailto: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://twitter.com/#%21/miconda>-
> http://www.linkedin.com/in/miconda
> Book: SIP Routing With Kamailio - http://www.asipto.com

-- 
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/20151021/e609dd17/attachment.html>


More information about the sr-users mailing list