<div dir="ltr">I think, it will be much better to plane reorganization of whole process. To start using Kamailio as registrar and load balance, and Asterisk as media servers, dial plan etc.<div>But, in current situation, I can suggest next:</div>
<div>1. You can not use authorization of Kamailio. You can use Kamailio only and alone as load balance. All requests to Kamailio you can forward to Asterisk servers.</div><div>2. When you get first request from somebody - you can do something like:</div>
<div><div><span class="" style="white-space:pre"> </span>ds_select_dst("1","4");</div><div><span class="" style="white-space:pre">        </span>$sht(forw=>$ft)=$du;</div></div><div>This way you will store address of Asterisk, where you forwarded request.</div>
<div>3. When you have next request from same "person" you can do:</div><div><span style="white-space:pre">  </span>$du=$sht(forw=>$ft);<br></div><div>I am using something alike, but only for active calls. All my registrations are handled by Kamailio, and Asterisk servers do not participate in authentication.</div>
<div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Sep 29, 2013 at 3:27 AM, Paul Penev <span dir="ltr"><<a href="mailto:ppquant@gmail.com" target="_blank">ppquant@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello all,<br>
<div class="im"><br>
I'm trying to implement a load balancer for asterisk servers using<br>
kamailio and the tutorial at<br>
<a href="http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb" target="_blank">http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb</a><br>
<br>
</div>I must put kamailio in front of the media servers (asterisk) without<br>
modifying their configuration (like a transparent proxy). It's a live<br>
system and I cannot touch it.<br>
<br>
The problem is that the asterisks require the devices to authenticate<br>
themselves (and register with user and password too).<br>
<div class="im"><br>
The sample implementation constructs a register request from scratch,<br>
</div>but does not handle the authorisation part<br>
<br>
I guess that the uac_req should contain the user and password fetched<br>
from the asterisk database. I would really appreciate some hints on<br>
how to proceed.<br>
<br>
Here's the current implementation of the register from kamailio->asterisk.<br>
<div class="HOEnZb"><div class="h5"># Forward REGISTER to Asterisk<br>
route[REGFWD] {<br>
if(!is_method("REGISTER"))<br>
{<br>
return;<br>
}<br>
$var(rip) = $sel(cfg_get.asterisk.bindip);<br>
$uac_req(method)="REGISTER";<br>
$uac_req(ruri)="sip:" + $var(rip) + ":" + $sel(cfg_get.asterisk.bindport);<br>
$uac_req(furi)="sip:" + $au + "@" + $var(rip);<br>
$uac_req(turi)="sip:" + $au + "@" + $var(rip);<br>
$uac_req(hdrs)="Contact: <sip:" + $au + "@"<br>
+ $sel(cfg_get.kamailio.bindip)<br>
+ ":" + $sel(cfg_get.kamailio.bindport) + ">\r\n";<br>
if($sel(contact.expires) != $null)<br>
$uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + "\r\n";<br>
else<br>
$uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + "\r\n";<br>
uac_req_send();<br>
}<br>
<br>
Thank you,<br>
Paul.<br>
<br>
_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</div></div></blockquote></div><br></div>