[Kamailio-Users] How to send a to-tag in a CANCEL request generated by carrierroute?

mayamatakeshi mayamatakeshi at gmail.com
Wed Mar 4 16:49:15 CET 2009


Hello,
I'm using the module carrierroute. I'm setting the carrierfailureroute
table to try a second route if the first one times out. The first
route is a GW that sends 183 Ringing with SDP and to-tag.
But when the failure_route is called due to timeout and the second
route is resolved I see kamailio sending a CANCEL without a to-tag and
the GW replies with "481 Call Leg/Transaction Does No Exist". So, This
fails to cancel the first request. How can I make kamailio send the
to-tag in the CANCEL request?
Also, I noticed kamailio sends the INVITE to the second route before
sending the CANCEL to the first one. Was this coded on purpose? (I
believe this doesn't go against the RFC, but it is something curious).

If you bother to look at my cfg, here's the relevant parts:

route {
.........some stuff .....

	DOMAIN_AVP = "";
	if (!cr_route("CARRIER_AVP", "DOMAIN_AVP", "$rU", "$rU", "call_id",
"HOST_AVP")) {
		sl_send_reply("404", "No Route");
		exit;
	}
	t_on_failure("ROUTE_FIRST_ATTEMPT_FAILURE");
	
	if (subst_uri('/(sip:.*);nat=yes/\1/')) {
		setbflag(NAT_BFLAG);
	}
	
	if (isbflagset(NAT_BFLAG)) {
		fix_nated_contact();
	
		if (is_method("BYE|CANCEL")) {
			unforce_rtp_proxy();
		} else if (is_method("INVITE")) {
			force_rtp_proxy("cfr");
		}
		search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
	}
	
	t_on_reply("ONREPLY");
	if (!t_relay()) {
		sl_reply_error();
	}
}

failure_route[ROUTE_FIRST_ATTEMPT_FAILURE] {
        if (isbflagset(NAT_BFLAG)) {
                unforce_rtp_proxy();
        }
	
	revert_uri();

	if (!cr_next_domain("CARRIER_AVP", "DOMAIN_AVP", "$rU", "HOST_AVP",
"$T_reply_code", "DOMAIN_AVP")) {
		exit;
	}

	if (!cr_route("CARRIER_AVP", "DOMAIN_AVP", "$rU", "$rU", "call_id",
"HOST_AVP")) {
		exit;
	}

	t_on_failure("ROUTE_SECOND_ATTEMPT_FAILURE");
	append_branch();
	
	route(RELAY_REQUEST);		
}

failure_route[ROUTE_SECOND_ATTEMPT_FAILURE] {
	if (isbflagset(NAT_BFLAG) ) {
                unforce_rtp_proxy();
        }
}



More information about the Users mailing list