I found t_on_branch_failure() in 4.1.  Would that be the way to handle this?


On Thu, Mar 13, 2014 at 1:36 PM, Marc Soda <msoda@coredial.com> wrote:
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



--

Marc Soda, Sr. Systems Engineer
CoreDial, LLC | www.coredial.com

1787 Sentry Parkway West, Building 16, Suite 100, Blue Bell, PA 19422
Office: (215) 297-4400 x203 | Fax: (215) 297-4401 | Email: msoda@coredial.com

- - - - -

The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission,  dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.