[OpenSER-Devel] carrierroute

Carsten Bock lists at bock.info
Wed Sep 26 16:45:38 CEST 2007


Hi,

after understanding, how the carrier-route-module works (thanks
Henning), i have a question regarding the source.
I looked at the method tree_route_uri:

int tree_route_uri(struct sip_msg * msg, char * _tree, char * _level) {
	struct rewrite_data * rd = NULL;
	int index;
	str ruser;
	str ruri;
	if (parse_sip_msg_uri(msg) < 0) {
		return -1;
	}
	ruser.s = msg->parsed_uri.user.s;
	ruser.len = msg->parsed_uri.user.len;
	ruri.s = msg->parsed_uri.user.s;
	ruri.len = msg->parsed_uri.user.len;
	do {
		rd = get_data();
	} while (rd == NULL);
	index = rd->default_carrier_index;
	release_data(rd);
	return carrier_rewrite_msg(index, (int)_level, &ruri, msg, &ruser,
shs_call_id, alg_crc32);
}
and wondered, why the determined tree-id (checked in tree_route_fixup)
is nowhere used in this function and instead the "default_carrier_index"
is used...
Must this not be (if i look at the user_route_uri method):

int tree_route_uri(struct sip_msg * msg, char * _tree, char * _level) {
	struct rewrite_data * rd = NULL;
	struct carrier_tree * ct = NULL;
	int index;
	str ruser;
	str ruri;
	if (parse_sip_msg_uri(msg) < 0) {
		return -1;
	}
	ruser.s = msg->parsed_uri.user.s;
	ruser.len = msg->parsed_uri.user.len;
	ruri.s = msg->parsed_uri.user.s;
	ruri.len = msg->parsed_uri.user.len;
	do {
		rd = get_data();
	} while (rd == NULL);
	if ((ct = get_carrier_tree((int)_tree, rd)) == NULL) {
		if (fallback_default) {
			index = rd->default_carrier_index;
		} else {
			LM_ERR("desired routing tree with id %i doesn't exist\n",
				(int)_tree);
			return -1;
		}
	} else {
		index = ct->index;
	}
	release_data(rd);
	return carrier_rewrite_msg(index, (int)_level, &ruri, msg, &ruser,
shs_call_id, alg_crc32);
}

Is it ok, that release_data(rd) is not called at every return statement?
(e.g. here: LM_ERR("desired routing tree with id %i doesn't exist\n",
(int)_tree);).
If i understood the source right, i will add a patch for this until end
of the week and add pseudo-variables-support to the
"cr_tree_rewrite_uri"-Method.

Thank you in advance,

Carsten

P.S.: Keep up the great work!






More information about the Devel mailing list