Hi Alberto,
I have to admit you lost me somewhere on the way with what you want to
do. But focusing on your final question "But when the uac starts a call,
how do I validate the uac was previously registered?", the answer is
https://opensips.org/html/docs/modules/3.2.x/registrar.html#func_is_registered
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
https://www.opensips-solutions.com
OpenSIPS eBootcamp
https://www.opensips.org/Training/Bootcamp
On 2/10/22 9:04 PM, Alberto wrote:
Hi,
I followed pretty much the available tutorials for mid_registrar, but
I can't figure out something:
I have:
loadmodule "registrar.so"
modparam("registrar", "attr_avp", "$avp(avp_json)")
modparam("registrar", "max_contacts", 1)
modparam("registrar", "tcp_persistent_flag", "TCP_PERSIST_DURATION")
loadmodule "mid_registrar.so"
modparam("mid_registrar", "attr_avp", "$avp(avp_json)")
modparam("mid_registrar", "max_contacts", 1)
modparam("mid_registrar", "mode", 0)
modparam("mid_registrar", "tcp_persistent_flag",
"TCP_PERSIST_REGISTRATIONS")
and then:
if (is_method("REGISTER")) {
$json(x) := "{}";
python_exec("fn_lookup_account", "$rd|$socket_in(proto)");
$avp(avp_json) = $json_compact(x);
mid_registrar_save("location");
switch ($retcode) {
case 1:
$du = $json(x/remote_dest);
$ru = $json(x/remote_uri);
route(relay);
break;
case 2:
xlog("L_INFO", "Absorb REGISTER!\n");
break;
default:
xlog("L_INFO", "Failed to save registration!\n");
break;
}
exit;
}
I do this because I want to store some configuration in the attr
column that I don't want to retrieve every call.
However, the mid_registrar example then continues with
mid_registrar_lookup, and that works fine for calls originating from
the main registrar going to the uac.
But when the uac starts a call, how do I validate the uac was
previously registered?
I tried with this below, but lookup doesn't work in this scenario.
if (mid_registrar_lookup("location")) {
$json(x) := $avp(avp_json);
xlog("L_INFO", "$C(cs)$cfg_file:$cfg_line$C(xx) [$rm] Found
mid_registrar_lookup from $si:$sp to $ru\n");
} else if (lookup("location")) {
$json(x) := $avp(avp_json);
xlog("L_INFO", "$C(cs)$cfg_file:$cfg_line$C(xx) [$rm] Found lookup
from $si:$sp to $ru\n");
} else {
t_reply(404, "Not Found");
exit;
}
Thanks
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users