Opensips relaying MESSAGE - source IP problem

  • Halys

    Halys - 2010-11-05


    I'm encountering some issue with my Opensips configuration.
    My Opensips server is configured to relay SIP MESSAGE requests to another server when the destination URI is not located on my server. Here is the part of opensips.cfg which is concerned :

            if (!lookup("location","m")) {
                    switch ($retcode) {
                            case -1:
                            case -3:

                                    if (is_method("MESSAGE")) {
                                    if (!t_relay()) {
                            case -2:
                                    sl_send_reply("405", "Method Not Allowed");

    My server receives SIP requests on eth0 interface (IP but when it relays the requests to the server it should use eth2 interface (IP because there is a firewall between the two servers and port 5062 is only allowed for source IP The problem is the following : when I open Wireshark on my Opensips server, I can see that the source IP for the relayed MESSAGE is still so it never reaches the other server !

    I don't understand where is the issue, my Linux routing table is OK, when I'm trying to reach from my Opensips server using telnet for example it uses the right interface and the right gateway. Here is my routing table : UG        0 0          0 eth2   U         0 0          0 eth0   U         0 0          0 eth2   U         0 0          0 eth3   UG        0 0          0 eth2   UG        0 0          0 eth2         UG        0 0          0 eth0

    Did I miss something in Opensips configuration file ?
    Thanks a lot for your help.

    Best Regards,


  • Bogdan-Andrei Iancu

    does your opensips listen on both and IPs ?


  • Halys

    Halys - 2010-11-23

    Hi Bogdan,

    Yes it does.
    Actually I posted a message on the Opensips-users mailing list and someone helped me find a solution : I used the force_send_socket() function and it worked.
    Thank you.

    Best Regards,


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks