I don't see my sip parsing patch in any public release.  Judging from David's comment,
I'd say it's a simple oversight that it's not there.  So here it is:

It's in SIPInterface::drive()

right after this code:

        // Parse the mesage.
        osip_message_t * msg;
        int i = osip_message_init(&msg);
        LOG(INFO) << "osip_message_init " << i;
        int j = osip_message_parse(msg, mReadBuffer, strlen(mReadBuffer));
        // seems like it ought to do something more than display an error,
        // but it used to not even do that.
        LOG(INFO) << "osip_message_parse " << j;

insert this:

        char *p = strcasestr(mReadBuffer, "nonce");
        if (p) {
            string RAND = string(mReadBuffer, p-mReadBuffer+6, 32);
            LOG(INFO) << "crowbar www-authenticate " << RAND;
            osip_www_authenticate_t *auth;
            osip_www_authenticate_init(&auth);
            string auth_type = "Digest";
            osip_www_authenticate_set_auth_type(auth, osip_strdup(auth_type.c_str()));
            osip_www_authenticate_set_nonce(auth, osip_strdup(RAND.c_str()));
            int k = osip_list_add (&msg->www_authenticates, auth, -1);
            if (k < 0) LOG(ERR) << "problem adding www_authenticate";
        }

As you can see, it searches for exactly what the authentication server generates,
so it's not appropriate for general use in the sip library.

Hope this helps,
Doug


On Dec 25, 2011, at 1:43 AM, Alexander Chemeris wrote:

Max, I believe there is nothing secret in this technical discussion and we should continue this discussion at the mailing list.

To the point - Doug could you plase point us to the place which you have modified to workaround the problem? It would greatly help us to move forward to the everyone benefit.

--
Alexander Chemeris
Sent from my Android device. Sorry for my brevity.


On Dec 25, 2011 1:36 PM, <suraev@stud.ntnu.no> wrote:

24.12.2011 03:50, David Burgess пишет:
>

> Doug did it by hand. He didn't patch oSIP. The code he wrote to do that is in the
> ../a3a8 bran...

I've compared SIPEngine.cpp and SIPInterface.cpp in my branch and in public a3a8
branch and they looks pretty much the same (with more verbose logging in my case).

In my tests code works like this:
- 401 response arrive from SR
- the incoming buffer is parsed by osip_message_parse() in SIPInterface::drive()
- the parsed message is handed over to randy401() in SIPEngine.cpp

www-authenticates part with nonce is eaten out by osip_message_parse() so randy401()
fails to obtain nonce.

If my understanding is correct then Doug's workaround (e. g. manual parsing) should
kick in someplace before randy401() is called. Unfortunately I do not see anything
like this.

Doug, could you point me to where exactly you parse www-authenticates for randy401()?
Which file/revision should I look for?

thanks,
Max.


Doug Brown
Range Networks, Inc.
doug.brown@rangenetworks.com