[SR-Users] kamailio registering on back-end asterisk with username and password

Paul Penev ppquant at gmail.com
Sat Sep 28 08:49:39 CEST 2013


I'm trying to implement a load balancer for asterisk servers using
kamailio and the tutorial at
http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb

I must fit the balancer in an infrastructure without touching the
other media servers (asterisk) which require a username/password
authentication.

The sample implementation constructs a register request from scratch,
but does not handle authorization and thus fails. I cannot change the
current sip servers and their configuration as these are a live system
and I'm not allowed to touch it.

I would really appreciate some hints on how to proceed.

# 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();
}

Thank you,
Paul.



More information about the sr-users mailing list