diff --git a/kamailio/default.cfg b/kamailio/default.cfg index 4545594..a12d352 100644 --- a/kamailio/default.cfg +++ b/kamailio/default.cfg @@ -552,13 +552,6 @@ route[PREPARE_INITIAL_REQUESTS] } } - if ( is_method("INVITE|MESSAGE|NOTIFY") && isflagset(FLAG_INTERNALLY_SOURCED) && $hdr(X-KAZOO-AOR) != $null && registered("location", "$hdr(X-KAZOO-AOR)")) - { - $avp(kazoo_aor) = $hdr(X-KAZOO-AOR); - $avp(kazoo_du) = $xavp(ulrcd=>received); - xlog("L_INFO", "$ci|end|setting aor avp : AOR : $hdr(X-KAZOO-AOR)\n"); - }; - record_route(); } @@ -582,6 +575,19 @@ route[INTERNAL_TO_EXTERNAL_RELAY] } #!endif + if ($hdr(X-KAZOO-AOR) != $null) { + xlog("L_INFO", "$ci|log|using AOR $hdr(X-KAZOO-AOR)\n"); + 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"); + exit; + } + } + remove_hf_re("^X-.*"); if( $avp(kazoo_aor) != $null)