rem: if ((msg->contact == NULL)||((parse_headers(msg,HDR_CONTACT,0) == -1))) { LOG(L_ERR,"ERROR: decode_contact: no Contact header present\n"); return -1; }
context: decode_contact (struct sip_msg *msg,char *unused1,char *unused2){	contact_body_t *cb;	contact_t *c;	str uri;	str newUri;	char separator;	int res;	/*	 * 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--------DECODE CONTACT-----------------\n");#endif	if ((msg->contact == NULL)||((parse_headers(msg,HDR_CONTACT,0) == -1)))		{		LOG(L_ERR,"ERROR: decode_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;		res = decode_uri (uri, separator, &newUri);#ifdef DEBUG		fprintf (stdout, "newuri.s=[%.*s]\n", newUri.len, newUri.s);#endif		if (res != 0)		{			LOG (L_ERR,"ERROR: decode_contact:Failed decoding contact.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: decode_contact:lumping failed in mangling port \n");			return -2;		}#ifdef DECODE_ALL_CONTACTS		while (c->next != NULL)		{			c = c->next;			uri = c->uri;			res = decode_uri (uri, separator, &newUri);			if (res != 0)				{				LOG (L_ERR,"ERROR: decode_contact: Failed decoding contact.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: decode_contact:lumping failed in mangling port \n");				return -3;			}		} /* end while */#endif	   } /* if c!= NULL */	} /* end if */	else /* after parsing still NULL */		{			LOG(L_ERR,"ERROR: decode_contact: Unable to parse Contact header\n");			return -4;		}#ifdef DEBUG	fprintf (stdout,"---END--------DECODE CONTACT-----------------\n");#endif	return 1;}