From 808449c92d8423e62c39e6155850cf977f52d36e Mon Sep 17 00:00:00 2001 From: lazedo Date: Tue, 12 Feb 2019 11:21:53 +0000 Subject: [PATCH] move AOR back to default --- kamailio/default.cfg | 31 ++++++++++++++++++++++++++++++- kamailio/registrar-role.cfg | 28 ---------------------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/kamailio/default.cfg b/kamailio/default.cfg index 41498c7..2b20b52 100644 --- a/kamailio/default.cfg +++ b/kamailio/default.cfg @@ -687,7 +687,7 @@ route[INTERNAL_TO_EXTERNAL_RELAY] #!endif #!ifdef REGISTRAR_ROLE - route(REGISTRAR_ROUTE_TO_AOR); + route(ROUTE_TO_AOR); #!endif remove_hf_re("^X-.*"); @@ -895,6 +895,35 @@ onsend_route { xlog("L_INFO", "$ci|pass|$sndfrom(ip):$sndfrom(port) -> $sndto(ip):$sndto(port)\n"); } +route[ROUTE_TO_AOR] +{ + if ($hdr(X-KAZOO-AOR) == $null) { + return; + } + + xlog("L_INFO", "$ci|log|using AOR $hdr(X-KAZOO-AOR)\n"); + if ($hdr(X-KAZOO-INVITE-FORMAT) == "contact") { + if(lookup("location", "$hdr(X-KAZOO-AOR)") > 0){ + xlog("L_INFO", "$ci|end|routing to contact $ru\n"); + handle_ruri_alias(); + } else { + xlog("L_INFO", "$ci|end|lookup for AOR $hdr(X-KAZOO-AOR) failed\n"); + sl_send_reply("410", "Not registered"); + exit; + } + } else if (reg_fetch_contacts("location", "$hdr(X-KAZOO-AOR)", "callee")) { + $du = $(ulc(callee=>received)); + $fs = $(ulc(callee=>socket)); + xlog("L_INFO", "$ci|log|routing $hdr(X-KAZOO-AOR) to $du via $fs\n"); + + } else { + xlog("L_INFO", "$ci|end|user is not registered\n"); + sl_send_reply("410", "Not registered"); + exit; + } +} + + #!ifdef REGISTRAR_ROLE #!ifdef WITH_AUTH_TOKEN diff --git a/kamailio/registrar-role.cfg b/kamailio/registrar-role.cfg index a3912ee..1c7730e 100644 --- a/kamailio/registrar-role.cfg +++ b/kamailio/registrar-role.cfg @@ -493,32 +493,4 @@ event_route[usrloc:contact-expired] #!include_file "registrar-sync-role.cfg" #!endif -route[REGISTRAR_ROUTE_TO_AOR] -{ - if ($hdr(X-KAZOO-AOR) == $null) { - return(); - } - - xlog("L_INFO", "$ci|log|using AOR $hdr(X-KAZOO-AOR)\n"); - setflag(FLT_AOR); - if ($hdr(X-KAZOO-INVITE-FORMAT) == "contact") { - if(lookup("location", "$hdr(X-KAZOO-AOR)") > 0){ - xlog("L_INFO", "$ci|end|routing to contact $ru\n"); - handle_ruri_alias(); - } else { - xlog("L_INFO", "$ci|end|lookup for AOR $hdr(X-KAZOO-AOR) failed\n"); - sl_send_reply("410", "Not registered"); - exit; - } - } else if (reg_fetch_contacts("location", "$hdr(X-KAZOO-AOR)", "callee")) { - $du = $(ulc(callee=>received)); - $fs = $(ulc(callee=>socket)); - xlog("L_INFO", "$ci|log|routing $hdr(X-KAZOO-AOR) to $du via $fs\n"); - } else { - xlog("L_INFO", "$ci|end|user is not registered\n"); - sl_send_reply("410", "Not registered"); - exit; - } -} - # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab