[Serdev] to tag

Juha Heinanen jh at tutpro.com
Sat Jan 3 18:50:53 UTC 2004


i wrote sometime ago the following simple function to check is request
has to tag.  perhaps it could be included in some module.

-- juha

/* Checks if message has To tag
 */
int does_to_tag_exist(struct sip_msg* _msg, char* _s1, char* _s2)
{
	str to_tag;

	if ((_msg->to == NULL) || (parse_headers(_msg, HDR_TO, 0) == -1)) {
		LOG(L_ERR, "tag_match(): Error while parsing To header\n");
			return -1;
	}

	to_tag = get_to(_msg)->tag_value;

	if (to_tag.len == 0) {
	   return -1;
	} else {
	   return 1;
	}
}




More information about the Serdev mailing list