[Asterisk-Users] SIP REGISTER -- Asterisk non-compliant or is it the provider?

Benjamin on Asterisk Mailing Lists benjk.on.asterisk.ml at gmail.com
Sun Nov 7 01:44:18 MST 2004


On Sun, 07 Nov 2004 09:47:33 +0200, Gilad Ben-Yossef
<gilad at codefidence.com> wrote:
> I don't claim to understand the code at all, but what little I think I
> understand from it makes me believe this is not the change you're
> looking for.

The differences between chan_sip.c of the version on the production
system and today's CVS are so major and plenty, that I felt it was a
better idea to try to make sense of the older code.

I put in ast_log calls all over the place to see what various
variables are at which stage and that way I managed to track down the
problem to function build_reply_digest, which come to think of it
makes a lot of sense just by looking at the name of it ;-)

here are the changes I made ...

static int build_reply_digest(struct sip_pvt *p, char* orig_header,
char* digest, int digest_len)
{
        char a1[256];
        char a2[256];
        char a1_hash[256];
        char a2_hash[256];
        char resp[256];
        char resp_hash[256];
        char uri[256] = "";
        char cnonce[80];
        char *uname;
-     if (strlen(p->username))
-               uname = p->username;
-        else
-                uname = p->peername;
+
+    uname = p->peername; /* uname should always be peername */

and this fixes the problem.

The reason being that sip_transmit_register already contains the code
that checks which value to put into p->peername and it also populates
p->username. Consequently the else branch is never executed and that
is why the authuser value is never used in the digest.


Unfortunately, but not unexpected, Asterisk's attempts to register
with NTT's SIP service still fail despite the REGISTER message and the
digest now conforming to what NTT's staff claims to be proper. But
what else would you expect of NTT?!

rgds
benjk
-- 
Sunrise Telephone Systems, 9F Shibuya Daikyo Bldg., 1-13-5 Shibuya,
Tokyo, Japan.

NB: Spam filters in place. Messages unrelated to the * mailing lists
may get trashed.



More information about the asterisk-users mailing list