<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof ContentPasted0">
Hello,
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">I am trying to implement uac authentication,</div>
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">My flow is SIP -> Opensips -> PBX(Register extension as trunk) -> PBX send 407/401 send re-invite -> PBX send 403.</div>
<div><br class="ContentPasted0">
</div>
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">I have called uac_auth(); in failover, function using this Authentication token header add in Invite but after PBX send 403.</div>
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">Code snap.</div>
<div class="ContentPasted0">loadmodule "uac.so"</div>
<div class="ContentPasted0">loadmodule "uac_auth.so"</div>
<div class="ContentPasted0">modparam("uac_auth","auth_realm_avp","$avp(10)")</div>
<div class="ContentPasted0">modparam("uac_auth","auth_username_avp","$avp(11)")</div>
<div class="ContentPasted0">modparam("uac_auth","auth_password_avp","$avp(12)")</div>
<div><br class="ContentPasted0">
</div>
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">onreply_route[external_reply]</div>
<div class="ContentPasted0">{</div>
<div class="ContentPasted0">      if($rs == '407' || $rs == '401'){</div>
<div class="ContentPasted0">            t_on_failure("1");</div>
<div class="ContentPasted0">            return;</div>
<div class="ContentPasted0">      }</div>
<div class="ContentPasted0">}</div>
<div class="ContentPasted0">failure_route[1] {</div>
<div class="ContentPasted0">$avp(10) = $avp(uac_realm);</div>
<div class="ContentPasted0">$avp(11) = "USER_NAME";</div>
<div class="ContentPasted0">$avp(12) = "PASSWORD";//Try with normal password and 0x HASH password as well.</div>
<div class="ContentPasted0">      if (uac_auth()) {</div>
<div class="ContentPasted0">            xlog ("$ci Authentication successfull\n");</div>
<div class="ContentPasted0">            t_relay();</div>
<div class="ContentPasted0">            exit;</div>
<div class="ContentPasted0">      } else {</div>
<div class="ContentPasted0">            xlog ("$ci Authentication FAILED\n");</div>
<div class="ContentPasted0">      }</div>
<div class="ContentPasted0">}</div>
<div><br class="ContentPasted0">
</div>
<div><br class="ContentPasted0">
</div>
<div class="ContentPasted0">I see in log uac_auth return success so it goes in if condition but fails two authentications.</div>
<div><br class="ContentPasted0">
</div>
Can anyone help me to solve this issue?<br>
</div>
</body>
</html>