diff --git a/kamailio/default.cfg b/kamailio/default.cfg index df1e3e6..1fff271 100644 --- a/kamailio/default.cfg +++ b/kamailio/default.cfg @@ -652,19 +652,21 @@ route[INTERNAL_TO_EXTERNAL_RELAY] #!ifdef REGISTRAR_ROLE if ($hdr(X-KAZOO-AOR) != $null) { xlog("L_INFO", "$ci|log|using AOR $hdr(X-KAZOO-AOR)\n"); - if(lookup("location", "$hdr(X-KAZOO-AOR)") > 0) { - if ($hdr(X-KAZOO-INVITE-FORMAT) == "contact") { + 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"); } else { - reg_fetch_contacts("location", "$hdr(X-KAZOO-AOR)", "callee"); - $du = $(ulc(callee=>received)); - $fs = $(ulc(callee=>socket)); - reg_free_contacts("callee"); - xlog("L_INFO", "$ci|log|routing $hdr(X-KAZOO-AOR) to $du via $fs\n"); + 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("404", "Not registered"); + sl_send_reply("410", "Not registered"); exit; } }