<div dir="ltr"><div>Hi,</div><div><br></div><div>I'm trying to put together a simple script to use uac_registrant</div><div>So I have:</div><div>LEFT SIP SERVERS <-[ip authentication]-> OPENSIPS <-[uac_registrant]-> REMOTE SIP PROVIDER<br></div><div><br></div><div></div><div>Here's the 2 problems I still have:</div><div>I have the users for the remote sip provider in the registrant table, and opensips is already able to register to this remote sip provider,but:</div><div>- When an INVITE comes from the remote sip provider I register to, how do I validate which user is it related to? Where should I store avp, and how should I load them?</div><div>- When an INVITE comes from the left sip servers and I have to call the remote sip provider, how do I load the credentials from the database to authenticate the INVITE to the remote sip provider?<br></div><div><br></div><div>I'm using the address table for the left sip servers and check_address, but I've stripped all that from my example below.</div><div>I hope this makes sense, thank you.</div><div><br></div><div>Here is a short example script I'm working with<br></div><div><br></div><div>#######<br></div><div>debug_mode=no<br><br>log_level=2<br>xlog_level=2<br>log_stdout=yes<br>stderror_enabled=yes<br>syslog_facility=LOG_LOCAL0<br><br>auto_aliases=no<br><br>server_signature=yes<br><br>socket=udp:<a href="http://0.0.0.0:5060">0.0.0.0:5060</a><br><br>mpath="/usr/lib64/opensips/modules/"<br><br>loadmodule "db_mysql.so"<br><br>loadmodule "signaling.so"<br><br>loadmodule "sl.so"<br><br>loadmodule "tm.so"<br>modparam("tm", "auto_100trying", 0)<br>modparam("tm", "fr_inv_timeout", 120)<br>modparam("tm", "fr_timeout", 30)<br>modparam("tm", "onreply_avp_mode", 1)<br>modparam("tm", "restart_fr_on_each_reply", 0)<br><br>loadmodule "rr.so"<br>modparam("rr", "append_fromtag", 1)<br><br>loadmodule "dialog.so"<br>modparam("dialog", "default_timeout", 14400)<br>modparam("dialog", "dlg_match_mode", 1)<br>modparam("dialog", "enable_stats", 1)<br>modparam("dialog", "profiles_with_value", "caller")<br><br>loadmodule "sipmsgops.so"<br><br>loadmodule "usrloc.so"<br><br>loadmodule "registrar.so"<br><br>loadmodule "uac_auth.so"<br>modparam("uac_auth", "credential", "username:domain:password")<br><br>loadmodule "uac_registrant.so"<br>modparam("uac_registrant", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")<br><br>loadmodule "proto_udp.so"<br><br>route {<br>  if (has_totag()) {<br>    if (loose_route()) {<br>      if ($DLG_status != NULL && !validate_dialog()) {<br>        exit;<br>      }<br>    } else {<br>      if (is_method("ACK")) {<br>        if (t_check_trans()) {<br>          t_relay();<br>        }<br>        exit;<br>      }<br><br>      sl_send_reply(404, "Not Found");<br>      exit;<br>    }<br><br>    t_relay();<br><br>    exit;<br>  }<br><br>  if (is_method("CANCEL")) {<br>    if (t_check_trans()) {<br>      t_relay();<br>    }<br>    exit;<br>  }<br><br>  t_check_trans();<br><br>  if (is_method("INVITE")) {<br>    if (!create_dialog("B")) {<br>      sl_send_reply(500, "Internal Server Error");<br>      exit;<br>    }<br>  }<br><br>  route(relay);<br>}<br><br>route[relay] {<br>  if (is_method("INVITE")) {</div><div>    # VALIDATE THIS RELATES TO A USER IN THE UAC_REGISTRANT TABLE AND LOAD AVPS<br></div><div>    # OR LOAD CREDENTIALS TO SEND INVITE ONWARD TO THE REMOTE SIP PROVIDER<br></div><div><br></div><div>    t_on_failure("invite_failure_route");<br>  }<br><br>  if (!t_relay()) {<br>    sl_send_reply(500, "Internal Error");<br>  }<br><br>  exit;<br>}<br><br>failure_route[invite_failure_route] {<br>  if (t_was_cancelled()) {<br>    exit;<br>  }<br><br>  if (t_check_status("3[0-9][0-9]")) {<br>    t_reply(404, "Not found");<br>    exit;<br>  }<br>}<br></div></div>