[OpenSIPS-Users] Openser running between 2 networks

Robert Dyck rob.dyck at telus.net
Sat Oct 11 01:47:32 CEST 2008


Correct
Below is an excerpt from my working config. You will notice that I commented 
the commands associated with rtpproxy in bridge mode. My openser is 
essentially an ALG. I am looking forward to trying the B2BUA.

        # Check if package originates from LAN
        if (src_ip==192.168.1.0/255.255.255.0)
        {
                 log(1, "incoming package from lan\n");
                if (lookup("location") or lookup("aliases"))
                {
                         log(1, "contact in local database\n");
                        if (uri=~"^sip:(.+)@192.168.1")
                        {
                                # at least one command here
                                log(1, "internal call\n");
                        }
                        else
                        {
                                if (method=="INVITE")
                                {
                                         log(1, "call from lan to wan\n");
                                        setflag(5);
                                        #force_rtp_proxy("FAIE");
                                        force_rtp_proxy("R");
                                         #log(1, "forcing RTP proxy IE\n");
                                        log(1, "forcing RTP proxy\n");
                                        t_on_reply("1");
                                };

                        };
                }
                else
               {
                         log(1, "contact NOT in local database\n");
                        if (uri==myself)
                        {
                                 log(1, "contact not found\n");
                                sl_send_reply("404", "Not Found");
                               return;
                        }
                        else
                        {
                                if (method=="INVITE")
                                {
                                         log(1, "call from lan to wan\n");
                                        setflag(5);
                                        if (uri =~"^sip:[0-9]+\*[0-9]+@")
                                        {
                                        log(1, "looks like an ISN URI\n");
                                        #we do not care what host the client 
has written into the URI
                                        
rewritehostport("public.freenum.org:5060");
                                        #we should recieve a 302 Moved 
Temporarily message
                                        }
                                        else
                                        {
                                        #force_rtp_proxy("FAIE");
                                        force_rtp_proxy("R");
                                         #log(1, "forcing RTP proxy IE\n");
                                        log(1, "forcing RTP proxy\n");
                                        };
                                        t_on_reply("1");
                                };
                        };
                };
        }
        else
        {
                 log(1, "incoming package from wan\n");
                if (uri==myself)
                {
                        if (lookup("location") or lookup("aliases"))
                        {
                                 log(1, "contact in local database\n");
                                if (method=="INVITE")
                                {
                                         log(1, "call from wan to lan\n");
                                        setflag(5);
                                        #force_rtp_proxy("FAEI");
                                        force_rtp_proxy("R");
                                         #log(1, "forcing RTP proxy EI\n");
                                        log(1, "forcing RTP proxy\n");
                                        t_on_reply("1");
                                };
                        }
                        else
                        {
                                # log(1, "contact not found\n");
                                sl_send_reply("404", "Not Found");
                                return;
                        };
                }
                 else
                       if (method=="INVITE")
                        {
                                log(1, "is this a re-invite???\n");
                           log(1, "call from wan to lan\n");
                           setflag(5);
                           #force_rtp_proxy("FAEI");
                                force_rtp_proxy("R");
                           #log(1, "forcing RTP proxy EI\n");
                                log(1, "forcing RTP proxy\n");
                           t_on_reply("1");
                        };
                };


        };
        route(1);


On Thursday 09 October 2008, Bogdan-Andrei Iancu wrote:
> Hi Robert,
>
> What you are saying is you are using only the public interface as this
> routable and reachable from the private network also. Is this correct?
>
> Regards,
> Bogdan
>
> Robert Dyck wrote:
> > I also use openser as an outgoing proxy. At first I had the proxy
> > listening on both interfaces and used rtpproxy in bridge mode. I decided
> > that was not necessary. Now on the local phones I use the proxy's public
> > address as the outgoing proxy address. I no longer use rtpproxy in bridge
> > mode. Both the local phones and external phones can connect with the
> > rtpproxy public address.
> >
> > On Thursday 09 October 2008, Bogdan-Andrei Iancu wrote:
> >> Hi,
> >>
> >> Another option is to use force_send_socket() core function
> >> (http://www.opensips.org/pmwiki.php?n=Resources.DocsCoreFcn#toc95).
> >>
> >> If you receive the message on the private IP and want to send it out on
> >> the public one, do force_send_socket(public_IP); before t_relay().
> >>
> >> Regards,
> >> Bogdan
> >>
> >> Hung Nguyen wrote:
> >>> Hi Bruno Machodo
> >>>
> >>> 1. With openser, you must add line mhomed = 1 to openser.cfg ==> it
> >>> will run on bridge mode
> >>> 2. With rtpproxy you must add flag "EI" ==> for calls from public
> >>> network to private network and "IE" with calls from private network to
> >>> public network.
> >>> force_rtp_proxy("EI");
> >>>
> >>> nguyen,
> >>>
> >>> On 9/24/08, Bruno Machado <bsmufu at yahoo.com.br> wrote:
> >>>> Hi fellows.
> >>>>
> >>>> I've been looking for a solution to solve this problem. The Openser is
> >>>> running
> >>>> over 2 IPs: private and public. I also have 2 ATAs: one of them has a
> >>>> private IP
> >>>> and the second has a public. When the session is established, ATA A
> >>>> will send
> >>>> RTP to the Openser private interface and ATA B will send to its public
> >>>> IP. RTPProxy will
> >>>> route the "private RTP packets" to "public network" and vice-versa
> >>>>
> >>>> private                                       public
> >>>> ATA A                Openser                ATA B
> >>>> ------- INVITE -------> private IP
> >>>>                      public IP  ------- INVITE ----->
> >>>>
> >>>>
> >>>> I've implemented a script but it doesn't work like the way described
> >>>> above. When Openser receives the INVITE through its private IP, it
> >>>> forwards the message to ATA B using the its private IP.
> >>>> I saw that RTPProxy has a bridge mode and the Nathelper's function has
> >>>> some parameters to handle with it. The SDP's 'c header' is changed
> >>>> properly when
> >>>> I use them, but the source IP (when Openser sends it to the public
> >>>> ATA) remains private (I'm not thinking that 'force_rtp_proxy' will set
> >>>> the network layer). In one hand, I already
> >>>> have the SDP set properly; but the source address still belonging to
> >>>> the private
> >>>> network. So, I just have 50% done. I tried to add an argument in
> >>>> "t_relay", like "udp:XXX.YYY.WWW.ZZZ:5060", without success.
> >>>> I don't know if what I want is possible: this behavior belongs to a
> >>>> "IP router", interconnecting 2 different networks. I didn't find
> >>>> anything similar to this (maybe I didn't search enough (and I believe
> >>>> that it is the only clever thing here until now...)).
> >>>> So... Am I getting crazy or it is clearly possible? (perhaps both..)
> >>>>
> >>>> Regards
> >>>> Bruno Machado
> >>>>
> >>>>
> >>>>
> >>>>       Novos endereços, o Yahoo! que você conhece. Crie um email novo
> >>>> com a sua cara @ymail.com ou @rocketmail.com.
> >>>> http://br.new.mail.yahoo.com/addresses
> >>>
> >>> _______________________________________________
> >>> Users mailing list
> >>> Users at lists.opensips.org
> >>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> >>
> >> _______________________________________________
> >> Users mailing list
> >> Users at lists.opensips.org
> >> http://lists.opensips.org/cgi-bin/mailman/listinfo/users





More information about the Users mailing list