[reSIProcate] [DUM] User agent unable to register
Hello everybody,
We are building a SIP user agent and trying to register to an Asterisk
server. It fails. After anayzing the REGISTER message composed by the
DUM, we noticed that:
1 - the Via header does not include the source port (which is not 5060
in our particular case) so the UA. The Asterisk send back the answers
packet on 5060 and off course they are not received.
2 - the Authentication header is simply missing !! So of course
Asterisks rejects the REGISTER
We are using a DUM and a RegistrationHandler as follow:
mdum.addTransport(UDP, 5061, V4 );
mdum.setClientAuthManager(m_clientAuth);
mdum.setClientRegistrationHandler(&m_registrationHandler);
(...)
NameAddr from("<sip:2004@xxxxxxxxxxxx:5061>");
m_masterprofile->setDefaultFrom(from);
mdum.setMasterProfile(m_masterprofile);
(...)
NameAddr user("sip:2004@xxxxxxxxxxxx:5060");
m_masterprofile->setDigestCredential(user.uri().host(),
user.uri().user(), "123456");
mdum.send( mdum.makeRegistration(user) );
Regarding 1 - I examined the class BasicCreator and the method
makeInitialRequest()
The Via header seems to be added by the following code:
Via via;
mLastRequest->header(h_Vias).push_front(via);
So where is the actual values for Via taken ?
Regarding 2 - in the same class it seems that the Authentication header
is added by:
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);
}
So I guess that we have to do a setImsAuthUri() in our master profile.
Is it correct ?
Why is this not the case in sample code dum/test/basicRegister.cxx ?
What value shoud we use for setImsAuthUri() ?
Emmanuel BUU