<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    can you check what is the value of the realm parameter in
    Proxy-Authorization header of PUBLISH? Is it myhome2.xip.bpt.com?<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 24/04/15 15:31, Tomas Zanet wrote:<br>
    </div>
    <blockquote
cite="mid:CA44A4830985A140A30A1E55D8CDFEEF956EE251@CG003SERVER.camegroup.local"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        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;}
span.StileMessaggioDiPostaElettronica17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 2.0cm 2.0cm 2.0cm;}
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">Hello everyone,<o:p></o:p></p>
        <p class="MsoNormal"><span lang="EN-US">I’ve been working on a
            project where I would like to implement RFC6035<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><a
              moz-do-not-send="true"
              href="https://tools.ietf.org/html/rfc6035">https://tools.ietf.org/html/rfc6035</a><o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Basically, after the end
            of the call, our SIP UAC sends a SIP PUBLISH to Kamailio
            where there are some useful information about media quality
            (packet loss, mos, etc..)<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">This information is
            stored by Kamailio with sql_query command…<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">To achieve this, I
            implemented a custom route function inside Kamailio cfg
            file, which handles PUBLISH request, check vq-rtcpxr body
            and store that information into a database.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Here is a snippet code:<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"># AVPF report
            route                                            
            <o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">route[AVPF] {<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">       
            if(!is_method("PUBLISH"))<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">                return;<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">        if
            (has_body("application/vq-rtcpxr"))<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">        {<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent:35.4pt"><span
            lang="EN-US">$var(x) =  "INSERT INTO
            quality_reporting_raw(body) VALUES (\"" +
            $(rb{s.escape.common}) + "\");";<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">               
            sql_query("cb", "$(var(x))");<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">                …… reply
            200 ok and so on….<o:p></o:p></span></p>
        <p class="MsoNormal" style="text-indent:35.4pt"><span
            lang="EN-US">exit(0)<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">        }<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">}<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Everything works fine
            (almost fine, because the report is stored twice…) if I do
            the route(AVPF) before authentication, like this…<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">(main route):<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">        # handle AVPF
            reports<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">        route(AVPF);<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">        # authentication<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">        route(AUTH);<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Instead if I swap these
            two functions, doing the authentication before publish
            processing, I have some problems about publish
            authentication….not for the other requests (INVITE and
            REGISTER)<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">As far as I know From,
            To and Request-URI must match the authentication user, in
            the PUBLISH REQUEST as described here<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><a
              moz-do-not-send="true"
href="http://kamailio.org/docs/modules/4.2.x/modules/auth_db.html#auth_db.f.auth_check">http://kamailio.org/docs/modules/4.2.x/modules/auth_db.html#auth_db.f.auth_check</a><o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">I confirm that…I’m
            sending the SIP PUBLISH from user 101 to user 101, which is
            currently registered.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">My problem is that
            Kamailio is continuously answering with 407 to the SIP
            PUBLISH, even if the PUBLISH request has the right
            Proxy-Authorization header…<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Digging into the log
            file, I found this :<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Apr 24 14:30:58
            bptrnddmzserver kamailio[30886]: DEBUG: auth_db
            [authorize.c:486]: auth_check(): realm [myhome2.xip.bpt.com]
            table [subscriber] flags [1]<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Apr 24 14:30:58
            bptrnddmzserver kamailio[30886]: DEBUG: auth [api.c:86]:
            pre_auth():
            <b>auth:pre_auth: Credentials with realm
              'myhome2.xip.bpt.com' not found</b><o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Apr 24 14:30:58
            bptrnddmzserver kamailio[30886]: DEBUG: auth_db
            [authorize.c:252]:
            <b>digest_authenticate_hdr(): no credentials</b><o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Just for your better
            understanding I’m doing authorization with db, using
            subscriber table where there are all the users with
            'myhome2.xip.bpt.com' domain…<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">In fact, all INVITEs and
            REGISTERs are correctly authenticated…<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Would you mind address
            me to find out the problem? Maybe, there’s something wrong
            in my cfg file.<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">Thanks in advance<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US">T,<o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p></o:p></span></p>
        <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
      </div>
      <p style="FONT-FAMILY: arial" id="c1-id-6"><span style="FONT-SIZE:
          10pt; -webkit-text-adjust: none" id="c1-id-7"><strong
            id="c1-id-8">Tomas Zanet</strong><br id="c1-id-9">
          Software Design Department<br id="c1-id-10">
          <a class="moz-txt-link-abbreviated" href="mailto:tzanet@came.com">tzanet@came.com</a></span><br>
      </p>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
  </body>
</html>