------------------------------------------------------------------------
r19049 | dworley | 2010-08-24 11:41:26 -0400 (Tue, 24 Aug 2010) | 4 lines
Changed paths:
   M /branches/4.2/sipXregistry/src/SipRedirectServer.cpp

Correct how an ACK is routed if its request-URI is a GRUU:
The contact returned by the redirector is a name-addr, but the request-URI
of the forwarded ACK must be an addr-spec.

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

Index: sipXregistry/src/SipRedirectServer.cpp
===================================================================
--- sipXregistry/src/SipRedirectServer.cpp	(revision 19048)
+++ sipXregistry/src/SipRedirectServer.cpp	(revision 19049)
@@ -383,17 +383,26 @@
                              "Forwarding ACK for URI '%s': ",
                              stringUri.data());
 
-               UtlString contactUri;
+               UtlString contactNameAddr;
                UtlString routeEntries;
                int maxForwards;
 
-               contactList.get(0, contactUri);
+               // Get the (single) contact.
+               contactList.get(0, contactNameAddr);
+               // Convert from name-addr format (which is what is in
+               // contactList) to addr-spec (which is what is needed
+               // for a request-URI.
+               Url contactUri(contactNameAddr, Url::NameAddr);
+               UtlString contactAddrSpec;
+               contactUri.getUri(contactAddrSpec);
 
                // create the message to forward -
                // change reqUri to located value, add route for debugging info, decrement max-forwards
                // leave last via since we are circling back, not responding
                SipMessage ackCopy(*pMessage);    // "clone" original ACK
-               ackCopy.setRequestFirstHeaderLine(SIP_ACK_METHOD, contactUri, SIP_PROTOCOL_VERSION);
+               ackCopy.setRequestFirstHeaderLine(SIP_ACK_METHOD,
+                                                 contactAddrSpec,
+                                                 SIP_PROTOCOL_VERSION);
                routeEntries.insert(0, mAckRouteToProxy);        // put route proxy in first position for informational purposes
                ackCopy.setRouteField(routeEntries.data());      // into forwarded ack
                if(!ackCopy.getMaxForwards(maxForwards))
@@ -415,12 +424,14 @@
 
                OsSysLog::add(FAC_SIP, PRI_DEBUG,
                              "SipRedirectServer::processRedirect "
-                             "sending ACK to '%s':%d using '%s'"
-                             "location service returned '%s'",
+                             "sending ACK to '%s':%d using '%s' "
+                             "location service returned '%s', "
+                             "converted into '%s'",
                              lastViaAddress.data(),
                              lastViaPort,
                              lastViaProtocol.data(),
-                             contactUri.data());
+                             contactNameAddr.data(),
+                             contactAddrSpec.data());
 
                // This ACK has no matching INVITE, special case
                mpSipUserAgent->sendStatelessAck(ackCopy,            // this will add via
