[SR-Users] 401 after a 302

Marc Soda msoda at coredial.com
Thu Mar 13 18:36:15 CET 2014


Can someone tell me how to handle a 401 from a 302 redirect?  I am
attempting to register with the uac module.  Normally, I set a failure
route for the 401 and call auc_auth().  In this case, I am receiving a 302,
sending the register with get_redirects(), then getting a 401.  However,
Kamailio seems to be ignoring the 401.  I see it in an onrely_route, but
not a failure route.

failure_route[REG_AUTH] {
  xlog("L_NOTICE","route[REG_AUTH]\n");

  # Handle redirects
  if ($T_reply_code == 302) {
    get_redirects("*", "Redirected");
    t_on_failure("REG_AUTH");
    route(RELAY);
  } else if ($T_reply_code == 401) {
    uac_auth();
    t_on_reply("REG_REPLY");
    route(RELAY);
 }
}

route[RELAY] {
  xlog("L_NOTICE","route[RELAY] ($rm)\n");

  if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {
    if (!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH");
  }

  if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
    if (!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY");
  }

  if (is_method("INVITE")) {
    if (!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
  }

  xlog("L_NOTICE","t_relay()'ing ($rm)\n");

  if (!t_relay()) {
    sl_reply_error();
  }
  exit;
}
Thanks!

Marc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140313/71669126/attachment.html>


More information about the sr-users mailing list