[asterisk-scf-commits] asterisk-scf/release/sip.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Jul 20 15:55:14 CDT 2011


branch "master" has been updated
       via  2b0ba42f2e557f5f5f3e5dba3b41f87a0937d8db (commit)
       via  c1891fda67849e50c553ccbba326ab431c8fa293 (commit)
      from  5cc1decf6fbf407a4d477f74f7832af9bf1df66d (commit)

Summary of changes:
 src/SipEndpoint.cpp |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)


- Log -----------------------------------------------------------------
commit 2b0ba42f2e557f5f5f3e5dba3b41f87a0937d8db
Merge: c1891fd 5cc1dec
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Jul 20 15:55:46 2011 -0500

    Merge branch 'master' of git.asterisk.org:asterisk-scf/release/sip


commit c1891fda67849e50c553ccbba326ab431c8fa293
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Jul 20 15:55:29 2011 -0500

    Add square brackets around IPv6 address if needed.

diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 59b78e8..60bb457 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -256,7 +256,17 @@ void SipEndpoint::setTargetAddress(std::string address, int port)
         return;
     }
     char target[64];
-    pj_ansi_snprintf(target, sizeof(target), "%s:%d", address.c_str(), port);
+    //If we're dealing with an IPv6 address that is not surrounded by square
+    //brackets, we need to adjust for that.
+    if (address.find(':') && 
+            (address.at(0) != '[' && address.at(address.length() - 1) != ']'))
+    {
+        pj_ansi_snprintf(target, sizeof(target), "[%s]:%d", address.c_str(), port);
+    }
+    else
+    {
+        pj_ansi_snprintf(target, sizeof(target), "%s:%d", address.c_str(), port);
+    }
     mImplPriv->mConfig.transportConfig.address = target;
 }
 

-----------------------------------------------------------------------


-- 
asterisk-scf/release/sip.git



More information about the asterisk-scf-commits mailing list