Revision: 3956d5cf2d18
Author:   [email protected] <[email protected]>
Date:     Thu May  2 06:21:45 2013
Log:      Update issue 210
http://code.google.com/p/sipservlets/source/detail?r=3956d5cf2d18

Modified:
/sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/MobicentsExtendedListeningPoint.java /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/JainSipUtils.java /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/ExtendedListeningPoint.java /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/SipNetworkInterfaceManagerImpl.java

=======================================
--- /sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/MobicentsExtendedListeningPoint.java Wed May 1 09:23:28 2013 +++ /sip-servlets-core-api/src/main/java/org/mobicents/servlet/sip/core/MobicentsExtendedListeningPoint.java Thu May 2 06:21:45 2013
@@ -115,6 +115,16 @@
        ContactHeader createContactHeader(String displayName, String userName,
                        boolean usePublicAddress);
        /**
+        * Create a Contact Header based on this SIP Listening Point
+ * @param displayName the display name to use for the contact header to create
+        * @param userName the user name to use for the contact header to create
+ * @param usePublicAddress wether or not to use the ip address found by STUN discovery
+        * @param outboundInterface the outbound interface ip address to be used
+        * @return a Contact Header based on this SIP Listening Point
+        */
+       ContactHeader createContactHeader(String displayName, String userName,
+                       boolean usePublicAddress, String outboundInterface);
+       /**
         * Create a Record Route Header based on this SIP Listening Point
* @param usePublicAddress wether or not to use the ip address found by STUN discovery
         * @return a Record Route Header based on this SIP Listening Point
@@ -127,19 +137,5 @@
         * @return true if the ip adress is a any local address
         */
        boolean isAnyLocalAddress();
-
-       /**
-        * https://code.google.com/p/sipservlets/issues/detail?id=210
-        * Set the desired outbound interface
-        * @param appOutboundAddress
-        */
-       void setAppOutboundAddress(String appOutboundAddress);
-
-       /**
-        * https://code.google.com/p/sipservlets/issues/detail?id=210
-        * Get the outbound interface
-        * @return
-        */
-       String getAppOutboundAddress();

 }
=======================================
--- /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/JainSipUtils.java Mon Jan 28 09:54:52 2013 +++ /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/JainSipUtils.java Thu May 2 06:21:45 2013
@@ -564,7 +564,12 @@
                }
                boolean usePublicAddress = findUsePublicAddress(
                                sipNetworkInterfaceManager, request, 
listeningPoint);
- ContactHeader ch = listeningPoint.createContactHeader(displayName, userName, usePublicAddress);
+               ContactHeader ch = null;
+               if(outboundInterface!=null){
+ ch = listeningPoint.createContactHeader(displayName, userName, usePublicAddress, outboundInterface);
+               } else {
+ ch = listeningPoint.createContactHeader(displayName, userName, usePublicAddress);
+               }
                
if(StaticServiceHolder.sipStandardService.isMd5ContactUserPart()) {
CallIdHeader callId = (CallIdHeader)request.getHeader(CallIdHeader.NAME);
                        String username = 
getHash(callId.getCallId().getBytes());
=======================================
--- /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/ExtendedListeningPoint.java Wed May 1 09:23:28 2013 +++ /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/ExtendedListeningPoint.java Thu May 2 06:21:45 2013
@@ -60,7 +60,6 @@
        private SipConnector sipConnector;
        private String globalIpAddress;
        String mostOutboundAddress = null;
-       String appOutboundAddress = null;
        private int globalPort;
        private List<String> ipAddresses;
        private boolean isAnyLocalAddress;
@@ -117,16 +116,11 @@
// Making use of the global ip address discovered by STUN if it is present
                if(usePublicAddress && globalIpAddress != null) {
                        return globalIpAddress;
-               }
-               //Issue: 
https://code.google.com/p/sipservlets/issues/detail?id=210
-               if(appOutboundAddress != null) {
-                       return appOutboundAddress;
-               } else {
-                       return mostOutboundAddress;
-               }
+               } else {
+                       return mostOutboundAddress;
+               }

        }
-
        /**
* Create a Contact Header based on the host, port and transport of this listening point * @param usePublicAddress if true, the host will be the global ip address found by STUN otherwise
@@ -135,9 +129,27 @@
         * @return the Contact header
         */
public ContactHeader createContactHeader(String displayName, String userName, boolean usePublicAddress) { + return createContactHeader(displayName, userName, usePublicAddress, null);
+       }
+
+       /**
+ * Create a Contact Header based on the host, port and transport of this listening point + * @param usePublicAddress if true, the host will be the global ip address found by STUN otherwise
+        *  it will be the local network interface ipaddress
+        * @param displayName the display name to use
+ * @param outboundInterface the outbound interface ip address to be used for the host part of the Contact header
+        * @return the Contact header
+        */
+ public ContactHeader createContactHeader(String displayName, String userName, boolean usePublicAddress, String outboundInterface) {
                try {
                        // FIXME : the SIP URI can be cached to improve 
performance
-                       String host = getIpAddress(usePublicAddress);
+                       String host = null;
+                       if(outboundInterface!=null){
+ javax.sip.address.SipURI outboundInterfaceURI = (javax.sip.address.SipURI) SipFactoryImpl.addressFactory.createURI(outboundInterface);
+                               host = outboundInterfaceURI.getHost();
+                       } else {
+                               host = getIpAddress(usePublicAddress);
+                       }
javax.sip.address.SipURI sipURI = SipFactoryImpl.addressFactory.createSipURI(userName, host);
                        sipURI.setHost(host);
                        sipURI.setPort(port);
@@ -358,12 +370,4 @@
        public SipConnector getSipConnector() {
                return sipConnector;
        }
-
-       public String getAppOutboundAddress(){
-               return appOutboundAddress;
-       }
-
-       public void setAppOutboundAddress(String appOutboundAddress){
-               this.appOutboundAddress = appOutboundAddress;
-       }
 }
=======================================
--- /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/SipNetworkInterfaceManagerImpl.java Wed May 1 09:23:28 2013 +++ /sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/SipNetworkInterfaceManagerImpl.java Thu May 2 06:21:45 2013
@@ -253,8 +253,6 @@
                                        if(logger.isTraceEnabled()) {
                                                logger.trace("Found listening point 
" + extendedListeningPoint);
                                        }
-                                       //Issue: 
https://code.google.com/p/sipservlets/issues/detail?id=210
- extendedListeningPoint.setAppOutboundAddress(outboundInterface.getHost());
                                        return extendedListeningPoint;
                                }
                        }
@@ -274,8 +272,6 @@
                                                if(logger.isTraceEnabled()) {
                                                        logger.trace("Found 
listening point " + extendedListeningPoint);
                                                }
-                                               //Issue: 
https://code.google.com/p/sipservlets/issues/detail?id=210
- extendedListeningPoint.setAppOutboundAddress(outboundInterface.getHost());
                                                return extendedListeningPoint;
                                        }
                                }

--

--- You received this message because you are subscribed to the Google Groups "mobicents-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to