[Asterisk-Dev] help needed - SIP register response contact

Conroy, Lawrence (SMTP) lwc at roke.co.uk
Sat Nov 29 06:15:43 MST 2003


Hi Folks,
   suitably nudged, I would like to fix a latent bug that has been 
hanging around in chan_sip for ages.
I do need help testing it against other phones.

In channels/chan_sip.c, at line 2252-2257 in respprep, the current 
lines are:
		char contact[256];
		char tmp[256];
		snprintf(contact, sizeof(contact), "%s;expires=%d", p->our_contact, 
p->expiry);
		snprintf(tmp, sizeof(tmp), "%d", p->expiry);
		add_header(resp, "Expires", tmp);
		add_header(resp, "Contact", contact);

I believe that this is WRONG - it certainly causes the mediatrix stack 
(and Siemens phones)
to ignore the register response, as they don't think it's for them. 
They expect to see their
OWN contact address in the register response, not that of the proxy (or 
any other machine).
Symptom - they keep sending the Register request and then give up.

As a quick hack, I replace the last line (2257) with the following:
	/* lwc	add_header(resp, "Contact", contact); */ copy_header(resp, req, 
"Contact");

This 'works for me', as it puts in a Contact header with the address of 
the registrant/phone.
The real issue is line 2254, where p->our_contact is used. Nope, it 
should be THEIR contact
address (as in the req Contact header).

Some phones don't check the Contact header address in the register 
response, so the current
stuff doesn't break them. This is why it has worked for most folk - 
their phones aren't
strictly compliant. However...

Help:
I don't have any Cisco phones (or pingtel, grandstream, Snom ones) 
available, so could
someone put in my proposed hack to check whether it breaks their setup, 
please?

The symptoms of a problem will be that the phone ignores the 200 
response from * and
retransmits the register request;
if it works (and a subsequent sip call works) you're laughing, and we 
could roll in
this change (or a more hygienic one). If not, then more thought is 
needed.


TIA,
   Lawrence

--
Registered Office: Roke Manor Research Ltd, Siemens House, Oldbury, Bracknell,
Berkshire. RG12 8FZ

The information contained in this e-mail and any attachments is confidential to
Roke Manor Research Ltd and must not be passed to any third party without
permission. This communication is for information only and shall not create or
change any contractual relationship.




More information about the asterisk-dev mailing list