<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body text="#000000" bgcolor="#ffffff">
    <tt>Hello Rik,<br>
      <br>
      It may be silly , but are you sure you filled in the proper
      credentials (realm, auth user and password) ??<br>
      <br>
      Also, based on how the response for digest is computed, you can
      double check the OpenSIPS auth response (calculating the HA and
      md5 sums as per RFC 2617).<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <br>
    On 11/01/2013 01:09 PM, Rik Broers wrote:
    <blockquote
cite="mid:685BED81F9FCC7418ACC487ECF36B7E919FFC52E@W2K8SV00008.MOTTOVOIP.lan"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Trebuchet MS";
        panose-1:2 11 6 3 2 2 2 2 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Lucida Console";
        panose-1:2 11 6 9 4 5 4 2 2 4;}
@font-face
        {font-family:"Lucida Console \;";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"31\)";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Trebuchet MS \, sans-serif \;";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;
        mso-fareast-language:EN-US;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><a moz-do-not-send="true"
            name="_MailEndCompose"><span style="color: black;"
              lang="EN-US">Yes, thats correct. Opensips sends out an
              invite with Authorization header as response on the 401
              unauthorized.<o:p></o:p></span></a></p>
        <p class="MsoNormal"><span style="color: black;" lang="EN-US">This
            authorization header contains the correct Nonce.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color: black;" lang="EN-US">Instead
            of being authorized I receive another 401 unauthorized which
            opensips replies again with new nonce and so on until max
            branches is reached.<o:p></o:p></span></p>
        <p class="MsoNormal"><span style="color: black;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <div>
          <p class="MsoNormal"><span style="color: black;">Met
              vriendelijke groet,<o:p></o:p></span></p>
          <p class="MsoNormal"><span style="color: black;">Regards,</span><span
              style="color: black;"><o:p></o:p></span></p>
          <p class="MsoNormal"><span style="color: black;"><o:p>&nbsp;</o:p></span></p>
          <table class="MsoNormalTable" style="border-collapse:
            collapse;" border="0" cellpadding="0" cellspacing="0">
            <tbody>
              <tr>
                <td style="width: 529.15pt; padding: 0cm;" valign="top"
                  width="706">
                  <p class="MsoNormal" style="line-height: 105%;"><b><span
                        style="font-size: 10pt; line-height: 105%;
                        font-family: &quot;Trebuchet
                        MS&quot;,&quot;sans-serif&quot;; color: rgb(161,
                        195, 31);" lang="EN-US">Rik Broers<o:p></o:p></span></b></p>
                  <p class="MsoNormal" style="line-height: 105%;"><b><i><span
                          style="font-size: 8pt; line-height: 105%;
                          font-family: &quot;Trebuchet
                          MS&quot;,&quot;sans-serif&quot;; color:
                          black;" lang="EN-US">Voice Engineer</span></i></b><b><i><span
                          style="font-size: 8pt; line-height: 105%;
                          font-family:
                          &quot;Verdana&quot;,&quot;sans-serif&quot;;
                          color: black;" lang="EN-US"><o:p></o:p></span></i></b></p>
                </td>
              </tr>
            </tbody>
          </table>
          <p class="MsoNormal"><span style="color: black;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        </div>
        <p class="MsoNormal"><span style="color: black;" lang="EN-US"><o:p>&nbsp;</o:p></span></p>
        <div>
          <div style="border-right: medium none; border-width: 1pt
            medium medium; border-style: solid none none; border-color:
            rgb(225, 225, 225) -moz-use-text-color -moz-use-text-color;
            padding: 3pt 0cm 0cm;">
            <p class="MsoNormal" style="margin-left: 35.4pt;"><b><span
                  style="color: windowtext;" lang="EN-US">From:</span></b><span
                style="color: windowtext;" lang="EN-US"> Bogdan-Andrei
                Iancu [<a class="moz-txt-link-freetext" href="mailto:bogdan@opensips.org">mailto:bogdan@opensips.org</a>]
                <br>
                <b>Sent:</b> vrijdag 1 november 2013 11:49<br>
                <b>To:</b> OpenSIPS users mailling list<br>
                <b>Cc:</b> Rik Broers<br>
                <b>Subject:</b> Re: [OpenSIPS-Users] uac_auth<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal" style="margin-left: 35.4pt;"><o:p>&nbsp;</o:p></p>
        <p class="MsoNormal" style="margin-left: 35.4pt;"><tt><span
              style="font-size: 10pt;">Hello Rik,</span></tt><span
            style="font-size: 10pt; font-family: &quot;Courier
            New&quot;;"><br>
            <br>
            <tt>So OpenSIPS generates a new INVITE with credentials (as
              a result of the uac_auth() ), but this is also rejected ?</tt><br>
            <br>
            <tt>Regards,</tt><br>
            <br>
          </span><span style="font-size: 12pt;"><o:p></o:p></span></p>
        <pre style="margin-left: 35.4pt;">Bogdan-Andrei Iancu<o:p></o:p></pre>
        <pre style="margin-left: 35.4pt;">OpenSIPS Founder and Developer<o:p></o:p></pre>
        <pre style="margin-left: 35.4pt;"><a moz-do-not-send="true" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a><o:p></o:p></pre>
        <p class="MsoNormal" style="margin-left: 35.4pt;"><br>
          On 10/31/2013 11:46 AM, Rik Broers wrote: <o:p></o:p></p>
        <blockquote style="margin-top: 5pt; margin-bottom: 5pt;">
          <p class="MsoNormal" style="margin-left: 35.4pt;">Hi,<o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;">&nbsp;<o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">I&#8217;m trying to use the uac_auth() function to
              add Authorization to my invite after I received a 401
              Unauthorized.
            </span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">I call the function in the failure route and
              according to Debug the authorization header is inserted. I
              also see this in a trace.</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">Unfortunately I haven&#8217;t been able to
              authorize successfully, double checked everything and also
              tried with phones to ensure the credentials are correct
              and my asterisk is working.</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">I&#8217;m filling the credentials with a modparam
              not with AVP.</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">In DBG I see this:
            </span><span style="font-size: 9pt; font-family:
              &quot;Lucida Console ;&quot;,&quot;serif&quot;;"
              lang="EN-US">DBG:uac_auth:build_authorization_hdr: hdr is
              &lt;Authorization: Digest username="**", realm="**",
              nonce="31d5b0d9", uri="***;user=phone",
              response="ea344343187f27c668be8fdc3acf8c5a",
              algorithm=MD5#015#012&gt;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">So it seems to match correctly.</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">I&#8217;m authenticating against Asterisk. And my
              failure route looks like this:</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              style="font-size: 9pt; font-family: &quot;Lucida
              Console&quot;;" lang="EN-US">failure_route</span><span
              style="font-size: 9pt; font-family: &quot;Lucida
              Console&quot;; color: rgb(0, 187, 0);" lang="EN-US">[FailPBX]</span><span
              style="font-size: 9pt; font-family: &quot;Lucida
              Console&quot;;" lang="EN-US">{</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              style="font-size: 9pt; font-family: &quot;Lucida
              Console&quot;;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog("Im in failpbx
              route")</span><span style="font-size: 9pt; font-family:
              &quot;Lucida Console&quot;; color: aqua;" lang="EN-US">;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              style="font-size: 9pt; font-family: &quot;Lucida
              Console&quot;;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uac_auth()</span><span
              style="font-size: 9pt; font-family: &quot;Lucida
              Console&quot;; color: aqua;" lang="EN-US">;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              style="font-size: 9pt; font-family: &quot;Lucida
              Console&quot;;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
              t_on_failure("FailPBX")</span><span style="font-size: 9pt;
              font-family: &quot;Lucida Console&quot;; color: aqua;"
              lang="EN-US">;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              style="font-size: 9pt; font-family: &quot;Lucida
              Console&quot;;" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </span><span style="font-size: 9pt; font-family:
              &quot;Lucida Console ;&quot;,&quot;serif&quot;;">t_relay()</span><span
              style="font-size: 9pt; font-family: &quot;Lucida Console
              ;&quot;,&quot;serif&quot;; color: aqua;">;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              style="font-size: 9pt; font-family: &quot;Lucida
              Console&quot;;">}</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              style="font-size: 9pt; font-family: &quot;Lucida
              Console&quot;;">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">What happens is the following</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">-&gt; Invite</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&lt;- 100 Giving a try</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&lt;- 401 Unauthorized (Unique nonce 1)</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">-&gt; ACK</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">-&gt; invite with authorization header
              (unique Nonce 1)</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&lt;- 100 Giving a try</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&lt;- 401 Unauthorized (Unique nonce 2)</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">-&gt; invite with authorization header
              (unique Nonce 2)</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&#8230;.. and so on until
            </span><span style="font-size: 9pt; font-family:
              &quot;Lucida Console ;&quot;,&quot;serif&quot;;"
              lang="EN-US">ERROR:tm:add_uac: maximum number of branches
              exceeded.</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">Only thing left for me now is to verify that
              the Digest calculated is correct.
              <b>How can I do this?</b> What functions should I use on
              linux..</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">Below my authorization challenge.</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><img
              id="Picture_x0020_5"
              src="cid:part1.07030508.03070405@opensips.org" height="31"
              width="641" border="0"><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">Or are there any other things I&#8217;m missing?</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">Im using </span>
            <span style="font-size: 9pt; font-family: &quot;Lucida
              Console ;&quot;,&quot;serif&quot;;" lang="EN-US">NOTICE:core:main:
              version: opensips 1.10.0-notls (x86_64/linux)</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&nbsp;</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;">Met
            vriendelijke groet,<o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;">Regards,<o:p></o:p></p>
          <p class="MsoNormal" style="margin-left: 35.4pt;">&nbsp;<o:p></o:p></p>
          <table class="MsoNormalTable" style="width: 529.15pt;
            margin-left: 35.4pt; border-collapse: collapse;" width="706"
            border="0" cellpadding="0" cellspacing="0">
            <tbody>
              <tr>
                <td style="width: 529.15pt; padding: 0cm;" valign="top"
                  width="706">
                  <p class="MsoNormal" style="line-height: 105%;"><b><span
                        style="font-size: 10pt; line-height: 105%;
                        font-family: &quot;31)&quot;,&quot;serif&quot;;"
                        lang="EN-US">Rik Broers</span></b><o:p></o:p></p>
                  <p class="MsoNormal" style="line-height: 105%;"><b><i><span
                          style="font-size: 8pt; line-height: 105%;
                          font-family: &quot;Trebuchet MS , sans-serif
                          ;&quot;,&quot;serif&quot;;" lang="EN-US">Voice
                          Engineer</span></i></b><o:p></o:p></p>
                </td>
              </tr>
            </tbody>
          </table>
          <p class="MsoNormal" style="margin-left: 35.4pt;"><span
              lang="EN-US">&nbsp;</span><o:p></o:p></p>
          <pre style="margin-left: 35.4pt;"><o:p>&nbsp;</o:p></pre>
          <pre style="margin-left: 35.4pt;"><o:p>&nbsp;</o:p></pre>
          <pre style="margin-left: 35.4pt;">_______________________________________________<o:p></o:p></pre>
          <pre style="margin-left: 35.4pt;">Users mailing list<o:p></o:p></pre>
          <pre style="margin-left: 35.4pt;"><a moz-do-not-send="true" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><o:p></o:p></pre>
          <pre style="margin-left: 35.4pt;"><a moz-do-not-send="true" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre>
        </blockquote>
      </div>
    </blockquote>
  </body>
</html>