rem: if ((msg->contact == NULL)&&((parse_headers(msg,HDR_CONTACT,0) == -1)))
add: if ((msg->contact == NULL)&&((parse_headers(msg,HDR_CONTACT,0) == -1) || (msg->contact == NULL) ))
context: encode_contact (struct sip_msg *msg, char *encoding_prefix,char *public_ip){	contact_body_t *cb;	contact_t *c;	str uri;	str newUri;	int res;	char separator;	/*	 * I have a list of contacts in contact->parsed which is of type contact_body_t 	 * inside i have a contact->parsed->contact which is the head of the list of contacts	 * inside it is a 	 * str uri;	 * struct contact *next;	 * I just have to visit each uri and encode each uri according to a scheme	 */#ifdef DEBUG	fprintf (stdout,"---START--------ENCODE CONTACT-----------------\n");        fprintf (stdout,"%.*s\n",50,msg->buf);#endif		if ((msg->contact == NULL)&&((parse_headers(msg,HDR_CONTACT,0) == -1)))		{		LOG(L_ERR,"ERROR: encode_contact: no Contact header present\n");		return -1;		}	separator = DEFAULT_SEPARATOR[0];	if (contact_flds_separator != NULL)		if (strlen(contact_flds_separator)>=1)			separator = contact_flds_separator[0];#ifdef DEBUG	fprintf (stdout,"Using separator %c\n",separator);#endif				if (msg->contact->parsed == NULL)	parse_contact (msg->contact);	if (msg->contact->parsed != NULL)	{		cb = (contact_body_t *) msg->contact->parsed;		c = cb->contacts;		/* we visit each contact */		if (c != NULL)		{			uri = c->uri;#ifdef DEBUG			fprintf (stdout, "olduri.s=[%.*s]\n", uri.len, uri.s);#endif			res = encode_uri (uri, encoding_prefix, public_ip,separator, &newUri);						if (res != 0)				{				LOG (L_ERR,"ERROR: encode_contact: Failed encoding contact.Code %d\n", res);#ifdef DEBUG				fprintf (stdout, "Encoding uri failed with code %d\n",res);#endif#ifdef STRICT_CHECK				return res;#endif				}			else				if (patch (msg, uri.s, uri.len, newUri.s, newUri.len) < 0)				{					LOG (L_ERR,"ERROR: encode_contact: lumping failed in mangling port \n");					return -2;				}				#ifdef DEBUG			if (res == 0) fprintf (stdout, "newuri.s=[%.*s]\nnewlen=%d\n", newUri.len, newUri.s,newUri.len);	#endif			/* encoding next contacts too?*/#ifdef ENCODE_ALL_CONTACTS			while (c->next != NULL)			{				c = c->next;				uri = c->uri;								res = encode_uri (uri, encoding_prefix,public_ip,separator,&newUri);				if (res != 0)					{					LOG(L_ERR,"ERROR: encode_contact: Failed encode_uri.Code %d\n",res);#ifdef STRICT_CHECK				return res;#endif					}				else				if (patch (msg, uri.s, uri.len, newUri.s, newUri.len)< 0)				{					LOG (L_ERR,"ERROR: encode_contact: lumping failed in mangling port \n");					return -3;				}			} /* while */#endif /* ENCODE_ALL_CONTACTS */		} /* if c != NULL */	} /* end if */	else /* after parsing still NULL */		{			LOG(L_ERR,"ERROR: encode_contact: Unable to parse Contact header\n");#ifdef DEBUG    			printf("ERROR: encode_contact: Unable to parse Contact header\n");#endif                        			return -4;		}#ifdef DEBUG	fprintf (stdout,"---END--------ENCODE CONTACT-----------------\n");#endif	return 1;}