[SR-Users] [Kamailio 4.2.0] Carrieroute Routing Questions

Massimo Varriale (IPZeta) m.varriale at ipzeta.it
Tue Nov 25 16:27:05 CET 2014


Hi Guys,
I'm new on Kamailio and this list, so be patient with me :)

I've built an almost "complete" working SIP server on Ubuntu 14.04 LTS.
I told almost complete because my problem is with carrierroute module because I'm not understanding the routing file and where I should put the code to use function cr_route

I would like to allow SIP calls/video between users for free and send calls to different external Gateways / Switches, etc based on the dialled destination.

In particular, I can send outbound calls a prepaid platform that will allow to bill calls based on CLI validation, but in all my tests, it seems that calls are going out always to the IP address of the remote gateway found into the carrierroute table ignoring the SIP user I'm calling.....what is the correct routing?

I'm finding some docs around there, but some refer to very old versions of Kamailio and some others are not clear to me.

What's wrong with my routing logic?

Thank you so much!
Max







route {

	# per request initial checks
	route(REQINIT);

	# NAT detection
	route(NAT);

	# handle requests within SIP dialogs
	route(WITHINDLG);

	### only initial requests (no To tag)

	# CANCEL processing
	if (is_method("CANCEL"))
	{
		if (t_check_trans())
			t_relay();
		exit;
	}

	t_check_trans();

	# authentication
	route(AUTH);

	# record routing for dialog forming requests (in case they are routed)
	# - remove preloaded route headers
	remove_hf("Route");
	if (is_method("INVITE|SUBSCRIBE"))
		record_route();

	# account only INVITEs
	if (is_method("INVITE"))
	{
		setflag(FLT_ACC); # do accounting
	}
		
	# dispatch requests to foreign domains
	route(SIPOUT);

	### requests for my local domains

	# handle presence related requests
	route(PRESENCE);

	# handle registrations
	route(REGISTRAR);

	if ($rU==$null)
	{
		# request with no Username in RURI
		sl_send_reply("484","Address Incomplete");
		exit;
	}

	# dispatch destinations to PSTN
	#route(PSTN);
		
	
	# CARRIERROUTE MODULE routing logic
	# check table for carrier default and domain default
	if(!cr_route("default", "default", "$rU", "$rU", "call_id")){
		sl_send_reply("403", "Not allowed");
	} else {
		# In case of failure, re-route the request
		t_on_failure("1");
		# Relay the request to the gateway
		t_relay();
	}			
 
	
	
	# user location service
	route(LOCATION);

	route(RELAY);
}


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20141125/32a6f7e9/attachment.html>


More information about the sr-users mailing list