On Thu, Aug 10, 2017 at 9:05 AM, Daniel Tryba <d.tryba(a)pocos.nl> wrote:
On Thu, Aug 10, 2017 at 08:51:24AM -0400, Ryan Wagoner
wrote:
Thanks for the explanation! I finally got the
dispatcher working in an
active / passive Kamailio cluster in front of three FreePBX servers. I
was
using the Asipto Kamailio and Asterisk real time
guide as a starting
point
so it had the WITHINDLG route. I ended up
modifying the TOASTERISK route
to
call ds_select_dst and the FROMASTERSK route uses
an htable for matching
IPs off a mySQL view of the Kamailio dispatcher table.
Am I interpreting this as: you wanto check if a message is coming from a
dispatcher?
If yes, take a look at ds_is_from_list:
https://kamailio.org/docs/modules/stable/modules/
dispatcher.html#dispatcher.f.ds_is_from_list
Exactly so the traffic from asterisk is trusted and isn't modified. I just
swapped my while loop for that function and it's good to go. I can't
believe I didn't see that earlier.
In my REGFWD route I have this chunk of code to lookup the dispatcher
IP/port from the same hash table before calling uac_req_send(). The
regserver column contains the dispatcher set id. Is there a way I can call
ds_select and then access the IP / port variables directly?
#!if WITH_DISPATCHER
sql_query("castdb", "select regserver from sipusers where name =
'$au'","ra");
if($dbr(ra=>rows)>0)
{
$var(rip) = $sht(dispatcherHosts=>set::$dbr(ra=>[0,0])[0]);
$var(rport) = $sht(dispatcherHosts=>port::$var(rip));
}
else
{
return;
}
sql_result_free("ra");
#!else
$var(rip) = $sel(cfg_get.asterisk.bindip);
$var(rport) = $sel(cfg_get.asterisk.bindport);
#!endif
$uac_req(method)="REGISTER";
$uac_req(ruri)="sip:" + $var(rip) + ":" + $var(rport);
$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();
Thanks,
Ryan