<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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]-->
</head>
<body lang="IT" link="#0563C1" vlink="#954F72">
<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 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 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">
tzanet@came.com</span><br id="c1-id-12">
<a style="FONT-FAMILY: arial" title="CAME" href="http://www.came.com/" id="c1-id-13"><img style="FONT-FAMILY: arial" alt="" src="cid:CAME.png" id="c1-id-14"></a><br id="c1-id-15">
<img src="cid:LogoExpo.png" alt="" id="c1-id-16"></p>
<table style="BACKGROUND-COLOR: #d9dadb" id="c1-id-17">
<colgroup id="c1-id-18"><col id="c1-id-19"></colgroup>
<tbody id="c1-id-20">
<tr id="c1-id-21">
<td style="PADDING-BOTTOM: 0px; MARGIN: 0px 5px; PADDING-LEFT: 5px; WIDTH: 100%; PADDING-RIGHT: 5px; COLOR: #808080; FONT-SIZE: 7.5pt; PADDING-TOP: 0px; font-family: Arial" id="c1-id-22">
<p style="font-family: Arial; FONT-SIZE: 7.5pt" id="c1-id-23"><br id="c1-id-24">
<img src="cid:FooterCAME.png" alt="" id="c1-id-25"><br id="c1-id-26">
<br id="c1-id-27">
Il messaggio di posta elettronica contiene informazioni di carattere confidenziale specifiche per il destinatario. Nel caso non ne siate il destinatario, segnalatelo immediatamente al mittente ed eliminate dai vostri archivi quanto ricevuto (compresi i file
 allegati). L'uso, la diffusione, distribuzione o riproduzione del presente messaggio e dei suoi allegati da parte di ogni altra persona costituisce reato. Rif. Decreto legislativo 30 giugno 2003, n. 196 - Codice in materia di protezione dei dati personali.<br id="c1-id-28">
<br id="c1-id-29">
The email message contains confidential information specific to the recipient. If you are not the recipient, write it to the sender immediately and delete from your files as received (including file attachments). Use, dissemination, distribution or reproduction
 of this message and its attachments by any other person is a criminal offense. References Legislative Decree 30 June 2003, n. 196 - Code for the protection of personal data.<br id="c1-id-30">
<br id="c1-id-31">
Right to opposition:<br id="c1-id-32">
The person concerned who receives the message has the right at any time to oppose its processing for forwarding commercial messages, advertising material or direct sales proposals, by clicking on the e-mail address below (or by traditional postal services by
 writing to: Came S.p.A., Via Martiri della Libertà 15, 31030 Dosson di Casier (TV) - Italy, or by sending a fax to +39 0422 4941. Furthermore the person concerned may exercise all the rights of access to the personal data as provided by art. 7, Legislative
 Decree no. 196/2003, including the rights to amendment, updating and deletion, by sending an e-mail to
<a style="FONT-FAMILY: arial" href="mailto:privacy@came.com" id="c1-id-33"><span style="COLOR: #0000ff" id="c1-id-34">privacy@came.com</span></a>.<br id="c1-id-35">
<br id="c1-id-36">
 </p>
</td>
</tr>
</tbody>
</table>
</body>
</html>