Skip to content

Commit

Permalink
Updated Pass-Thru Authentication
Browse files Browse the repository at this point in the history
- Added support to handle pass-thru when the hostname of the media server is used as the endpoint.
  • Loading branch information
mackhendricks committed Oct 18, 2022
1 parent eeb5386 commit f321abf
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions kamailio/configs/kamailio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ modparam("htable", "htable", "inbound_failfwd=>size=8;autoexpire=0;dmqreplicate=
# inbound_prefixmap is used to lookup dr_ruleid for a prefix
modparam("htable", "htable", "inbound_prefixmap=>size=8;autoexpire=0;dmqreplicate=DMQ_REPLICATE_ENABLED;dbtable=dsip_prefix_mapping;cols='prefix,ruleid,priority';")
# to manage Pass Thru Auth for Registration. Used to send Authorization requests back to the same backend media server
modparam("htable", "htable", "pass_thru_auth=>size=8;autoexpire=30;dmqreplicate=DMQ_REPLICATE_ENABLED;")
modparam("htable", "htable", "pass_thru_auth=>size=8;autoexpire=3600;dmqreplicate=DMQ_REPLICATE_ENABLED;")
# enrichdnid_lnpmap is used to lookup dnid prefixes to match against
# to manage callid to inbound endpoint map. Entries will expire in 24 hours (1440 seconds)
modparam("htable", "htable", "callid_inbound_endpoint_map=>size=8;autoexpire=1440;dmqreplicate=DMQ_REPLICATE_ENABLED;")
Expand Down Expand Up @@ -1879,9 +1879,22 @@ route[REGISTRAR] {
#Add the Path header for SIP UAC's - so that we know how to route back
add_path_received($fU);
}

# Store the pbx ip to domain mapping so that SIP messages from the PBX can be rewritten
$sht(pass_thru_auth=>$(avp(domain_pbx_ip){s.select,0,:})) = $var(rd_orig);
if !is_ip($(avp(domain_pbx_ip){s.select,0,:})) {
if(dns_query($(avp(domain_pbx_ip){s.select,0,:}),"xyz"))
{
$var(i) = 0;
while($var(i)<$dns(xyz=>count)) {
$sht(pass_thru_auth=>$dns(xyz=>addr[$var(i)])) = $var(rd_orig);
$var(i) = $var(i) + 1;
}
}

}
else {
$sht(pass_thru_auth=>$(avp(domain_pbx_ip){s.select,0,:})) = $var(rd_orig);
}

#We are going to pass this request on to the backend server
route(RELAY);
Expand Down

0 comments on commit f321abf

Please sign in to comment.