< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] REGISTER request sent without Address if HostPort is not overridden


All,

If I do not override that HostAndPort, my REGISTER requests are being
sent out with only a username, not an address.  I have not really
tried reproducing the problem with other requests, but I imagine the
same problem would happen no matter what the initial request.

Here is a listing of BaseCreator::makeInitialRequest.  I have
annotated the code with NOTE comments in the relevant areas:

void BaseCreator::makeInitialRequest(const NameAddr& target, const
NameAddr& from, MethodTypes method)
{
[snip]

   // NOTE: Line 66 declares an empty contact...
   NameAddr contact; // if no GRUU, let the stack fill in the contact

   assert(mUserProfile.get());
   if (!mUserProfile->getImsAuthUri().host().empty())
   {
      Auth auth;
      Uri source = mUserProfile->getImsAuthUri();
      auth.scheme() = "Digest";
      auth.param(p_username) = source.getAorNoPort();
      auth.param(p_realm) = source.host();
      source.user() = Data::Empty;
      auth.param(p_uri) = "sip:" + source.host();
      auth.param(p_nonce) = Data::Empty;
      auth.param(p_response) = Data::Empty;
      mLastRequest->header(h_Authorizations).push_back(auth);
      DebugLog ( << "Adding auth header to inital reg for IMS: " << auth);
   }

   // NOTE: on line 84, the hasGruu() is hard-coded to return false
   if (mUserProfile->hasGruu(target.uri().getAor()))
   {
      contact = mUserProfile->getGruu(target.uri().getAor());
      mLastRequest->header(h_Contacts).push_front(contact);
   }
   else
   {
      if (mUserProfile->hasOverrideHostAndPort())
      {
         contact.uri() = mUserProfile->getOverrideHostAndPort();

      }

      // NOTE: at this point, if we didn't set the contact from the
      // mUserProfile->getOverrideHostAndPort(), it's still empty.
      // I'm not sure if it is supposed to be set from another spot
      // (e.g., the "from" parameter...), but unless I have done an
      // setOverrideHostAndPort() in my client, the contact has no IP or
      // port.

      contact.uri().user() = from.uri().user();
      const Data& instanceId = mUserProfile->getInstanceId();
      if (!instanceId.empty())
      {
         contact.param(p_Instance) = instanceId;
      }
      mLastRequest->header(h_Contacts).push_front(contact);

[ snip ]

The comment for the 'contact' variable says that we're letting the
stack fill in the contact, but it doesn't seem to.  Am I doing
something wrong to keep that from happening?  Is this a bug in the
Dum?

Thanks in advance for your help.

Shaun