[OpenSIPS-Users] OpenSIPS mhomed

Bogdan-Andrei Iancu bogdan at voice-system.ro
Tue Dec 7 12:01:17 CET 2010


Hi Yuri,

Yuri Kirsanov wrote:
> Hi community,
>
> I have following setup:
>
> Public IP (eth0) < OpenSIPS > Private IP (eth1) <------> Private IP 
> (eth0) Asterisk.
>
> I'm trying to relay all the initial packets received by OpenSIPS to 
> Asterisk, so I record-route initial packets and process all responses 
> using loose routing. OpenSIPS is restricted to use only two UDP IP 
> addresses - private & public ones. It all works fine on SIP layer, I 
> do understand that I also need RTP proxy, but at this stage I've got 
> strange problem - with mhomed=1 in configuration file OpenSIPS still 
> sends packets using public IP address, while Contact, To and Via 
> fields are set correctly, to private IP address of OpenSIPS.
OpenSIPS does not changes Contact and To IPs when forwarding a 
request.....are you sure you see such changes???

The only IPs that reflects the used interface are the VIA and 
Record-Route...Actually in your case (if interface changing is done), 
you should have 2 RR headers...

Also, using mhomed and force_send_socket() in the same time is a bit 
redundant - they do the same : setting the outgoing interface for the 
request:
    - mhomed is doing autodetection based on destination IP
    - force_send_socket() is setting the inteface from script.

BTW, it is bogus to do:
        rewritehostport("10.22.10.1:6000 <http://10.22.10.1:6000/>");
        force_send_socket(10.22.10.254);

in route[1] as this route is a generic relay route used also for sending 
sequential requests.....put that lines in main route just where you do 
record_route().

Regards,
Bogdan
> I have tried to use force_send_socket but without any luck. Could you 
> please help me with this configuration? At least - why does OpenSIPS 
> uses public IP? Thanks!
>
> Here's my configuration:
>
> ####### Global Parameters #########
> log_facility=LOG_LOCAL4
> fork=yes
> children=4
> debug=9
> disable_tcp=yes
> auto_aliases=no
> mhomed=1
> port=5066
> listen=udp:XXX.XXX.XXX.XXX:5066
> listen=udp:10.22.10.254:5068 <http://10.22.10.254:5068/>
>
> ####### Modules Section ########
>
> #set module path
> mpath="/opt/opensips/lib64/opensips/modules/"
>
> loadmodule "signaling.so"
> loadmodule "sl.so"
> loadmodule "tm.so"
> loadmodule "rr.so"
> loadmodule "maxfwd.so"
> loadmodule "textops.so"
> loadmodule "mi_fifo.so"
> loadmodule "uri.so"
>
> # ----------------- setting module-specific parameters ---------------
>
> # ----- mi_fifo params -----
> modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")
>
> # ----- rr params -----
> # add value to ;lr param to cope with most of the UAs
> modparam("rr", "enable_full_lr", 1)
> modparam("rr", "append_fromtag", 1)
>
> # ----- uri params -----
> modparam("uri", "use_uri_table", 0)
>
> ####### Routing Logic ########
>
> # main request routing logic
>
> route{
>
>         if (!mf_process_maxfwd_header("10")) {
>                 sl_send_reply("483","Too Many Hops");
>                 exit;
>         }
>
>         if (has_totag()) {
>                 # sequential request withing a dialog should
>                 # take the path determined by record-routing
>                 if (loose_route()) {
>                         if (is_method("BYE")) {
>                                 setflag(1); # do accounting ...
>                                 setflag(3); # ... even if the 
> transaction fails
>                         } else if (is_method("INVITE")) {
>                                 # even if in most of the cases is 
> useless, do RR for
>                                 # re-INVITEs alos, as some buggy 
> clients do change route set
>                                 # during the dialog.
>                                 record_route();
>                         }
>                         # route it out to whatever destination was set 
> by loose_route()
>                         # in $du (destination URI).
>                         route(1);
>                 } else {
>                          if ( is_method("ACK") ) {
>                                 if ( t_check_trans() ) {
>                                         # non loose-route, but 
> stateful ACK; must be an ACK after
>                                         # a 487 or e.g. 404 from 
> upstream server
>                                         t_relay();
>                                         exit;
>                                 } else {
>                                         # ACK without matching 
> transaction ->
>                                         # ignore and discard
>                                         exit;
>                                 }
>                         }
>                         sl_send_reply("404","Not here");
>                 }
>                 exit;
>         }
>
>         #initial requests
>
>         # CANCEL processing
>         if (is_method("CANCEL"))
>         {
>                 if (t_check_trans())
>                         t_relay();
>                 exit;
>         }
>
>         t_check_trans();
>
>         # preloaded route checking
>         if (loose_route()) {
>                 xlog("L_ERR",
>                 "Attempt to route with preloaded Route's 
> [$fu/$tu/$ru/$ci]");
>                 if (!is_method("ACK"))
>                         sl_send_reply("403","Preload Route denied");
>                 exit;
>         }
>
>         record_route();
>         route(1);
> }
>
>
> route[1] {
>         rewritehostport("10.22.10.1:6000 <http://10.22.10.1:6000/>");
>         force_send_socket(10.22.10.254);
>         if (!t_relay()) {
>                 sl_reply_error();
>         };
>         exit;
> }
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   


-- 
Bogdan-Andrei Iancu
OpenSIPS Bootcamp
15 - 19 November 2010, Edison, New Jersey, USA
www.voice-system.ro




More information about the Users mailing list