5 Replies Latest reply: Mar 11, 2010 11:23 AM by 758936 RSS

    How to get the termination / destination IP from sip message

    758936
      Hi,

      My application needs the destination IP from an incoming/outgoing sip request (SipServletRequest). I am using MessageListener to listen the sip messages coming in and going out. unable to find the destination ip from the sip message (request).

      Thanks,
      Raju.
        • 1. Re: How to get the termination / destination IP from sip message
          654136
          SipServletMessage interface (which is implemented by SipServletRequest) has method getRemoteAddr that returns the IP address of the sender of this message.
          • 2. Re: How to get the termination / destination IP from sip message
            758936
            Thanks for your time, yes getRemoteAddr and getInitialRemoteAddr will provide the originating ip. But we need the destination/ termination/target ip, to which the message should reach finally. For instance, If in case OCCAS is acting as a proxy UA1 sending INVITE, to UA2. getInitialRemoteAddr will give the UA1 ip address, but how to get the UA2 ip. Is there any api something like getTermAddr / getDestAddr, I did not find in the SipServletMessage or SipServletRequest. Is there any indirect way to get the destination / termination ip...

            Thanks,
            Raju
            • 3. Re: How to get the termination / destination IP from sip message
              user753546
              There is no API to provide the actually resolved terminating IP where message will finally be sent. This is something which happens at lower level (transport layer) in the container and control is already outside application scope.

              But if you enable message-debug in sipserver.xml , you'll see that it prints out the actual IP where message is finally sent..something like following.

              <1230934032544> <BEA-331803> <SIP Tracer: logger Message: <message><![CDATA[:[1230934032544]:[out]:[udp]:[10.148.127.205:4204]=>[10.148.126.168:5062]


              So you may may choose to parse the sip-messages log file to determine the terminating ip for debugging purposes.

              Regards
              Anurag Bahl
              • 4. Re: How to get the termination / destination IP from sip message
                715547
                am not suer if you look at the appropriate message.

                If you send out the request you wont know where it is going to be sent to as the container resolves the address through DNS. However you could do tihs resolution in your app and set a route-header with the IP to send it to.

                Alternatively i believe it should be possible to see the remote IP address on the SIP Response you get from the far end. if you call getRemoteAddr on the SipServletResponse you shoudl get the information.

                have you tried that?
                • 5. Re: How to get the termination / destination IP from sip message
                  758936
                  Thanks Anurag, Yes, i am exactly struck there. I need the transport layer info. I saw the sip messages generated by the container. When a message is leaving out the container it is logging the message with destination ip, and port in the sip-messages.log, but the same message when it comes as a SipServletRequest to MessageListener the destination ip, and port are not provided in the object...