<div dir="ltr">Hi,<br><br>I followed pretty much the available tutorials for mid_registrar, but I can't figure out something:<br><br>I have:<br><br>loadmodule "registrar.so"<br>modparam("registrar", "attr_avp", "$avp(avp_json)")<br>modparam("registrar", "max_contacts", 1)<br>modparam("registrar", "tcp_persistent_flag", "TCP_PERSIST_DURATION")<br> <br>loadmodule "mid_registrar.so"<br>modparam("mid_registrar", "attr_avp", "$avp(avp_json)")<br>modparam("mid_registrar", "max_contacts", 1)<br>modparam("mid_registrar", "mode", 0)<br>modparam("mid_registrar", "tcp_persistent_flag", "TCP_PERSIST_REGISTRATIONS")<br><br>and then:<br><br>  if (is_method("REGISTER")) {<br>    $json(x) := "{}";<br><br>    python_exec("fn_lookup_account", "$rd|$socket_in(proto)");<br><br>    $avp(avp_json) = $json_compact(x);<br>    mid_registrar_save("location");<br>    switch ($retcode) {<br>      case 1:<br>        $du = $json(x/remote_dest);<br>        $ru = $json(x/remote_uri);<br>        route(relay);<br>        break;<br>      case 2:<br>        xlog("L_INFO", "Absorb REGISTER!\n");<br>        break;<br>      default:<br>        xlog("L_INFO", "Failed to save registration!\n");<br>        break;<br>    }<br><br>    exit;<br>  }    <br><br><br>I do this because I want to store some configuration in the attr column that I don't want to retrieve every call.<br><br>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.<br>But when the uac starts a call, how do I validate the uac was previously registered?<br><br>I tried with this below, but lookup doesn't work in this scenario.<br><br>if (mid_registrar_lookup("location")) {<br>  $json(x) := $avp(avp_json);<br>  xlog("L_INFO", "$C(cs)$cfg_file:$cfg_line$C(xx) [$rm] Found mid_registrar_lookup from $si:$sp to $ru\n");<br>} else if (lookup("location")) {<br>  $json(x) := $avp(avp_json);<br>  xlog("L_INFO", "$C(cs)$cfg_file:$cfg_line$C(xx) [$rm] Found lookup from $si:$sp to $ru\n");<br>} else {<br>  t_reply(404, "Not Found");<br>  exit;<br>} <br><br><br>Thanks</div>