[SR-Users] Kamailio and several Asterisk - Realtime DB Integration

Alejandro Rios P. alerios at debian.org
Fri Apr 8 00:28:29 CEST 2011


Hi all,

I am testing the scenario described here:
http://kb.asipto.com/asterisk:realtime:kamailio-3.1.x-asterisk-1.6.2-astdb

It works great with one instance of Asterisk, but now that I'm testing with
two Asterisk instances to load balance, and I see a problem regarding the
registration forwarding to the second Asterisk.

I tried adding a second "uac_req_send()" bellow the first one, but Kamailio
only sends the first request and the REGISTER never gets to the second
Asterisk:

# Forward REGISTER to Asterisk
route[REGFWD] {
	if(!is_method("REGISTER"))
	{
		return;
	}
	$var(rip) = $sel(cfg_get.asterisk.bindip);
	$uac_req(method)="REGISTER";
	$uac_req(ruri)="sip:" + $var(rip) + ":" + $sel(cfg_get.asterisk.bindport);
	$uac_req(furi)="sip:" + $au + "@" + $var(rip);
	$uac_req(turi)="sip:" + $au + "@" + $var(rip);
	$uac_req(hdrs)="Contact: <sip:" + $au + "@"
				+ $sel(cfg_get.kamailio.bindip)
				+ ":" + $sel(cfg_get.kamailio.bindport) + ">\r\n";
	if($sel(contact.expires) != $null)
		$uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n";
	else
		$uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n";
	uac_req_send();

        $uac_req(all) = null;

	$var(rip2) = $sel(cfg_get.asterisk2.bindip);
	$uac_req(method)="REGISTER";
	$uac_req(ruri)="sip:" + $var(rip2) + ":" + $sel(cfg_get.asterisk2.bindport);
	$uac_req(furi)="sip:" + $au + "@" + $var(rip2);
	$uac_req(turi)="sip:" + $au + "@" + $var(rip2);
	$uac_req(hdrs)="Contact: <sip:" + $au + "@"
				+ $sel(cfg_get.kamailio.bindip)
				+ ":" + $sel(cfg_get.kamailio.bindport) + ">\r\n";
	if($sel(contact.expires) != $null)
		$uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n";
	else
		$uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n";
	uac_req_send();
}


I also tried appending another branch and sending the second
uac_req_send() from there, but it is not being sent.

How can I use uac_req_send() several times for the same request or in
parallel?


Thank you,

Alejandro Rios Peña


DISCLAIMER: The opinions expressed are my own, and not necessarily those of
my employer.

<http://www.avatar.com.co>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20110407/4c3d2c73/attachment.htm>


More information about the sr-users mailing list