<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=utf-8">
<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:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-AU" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Hey Matthias,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Thanks for the reply, and the pointers!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">I guess the thing that’s confusing me most is that in my existing config, the 183 reply from Asterisk comes in as RTP/AVP and then Kamailio *<b>does</b>* change it to RTP/SAVP in the
 183 forwarded to teams *<b>and</b>* the same thing happens for the subsequent 200 OK. So to me that indicates that rtpengine_manage is already re-writing the SDP offers between RTP and SRTP to some level? But for some reason the crypto attribute is still missing
 in this one case.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">If I remove my attempts to re-write to/from RTP/SAVP then it’s RTP/AVP all the way through (as that’s what Asterisk sends to Kamailio) and it gets rejected because SRTP is required,
 whereas right now it fails because SRTP fails to negotiate – so it’s not the same error.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-GB" style="mso-fareast-language:EN-US">Regardless,
</span></b><span lang="EN-GB" style="mso-fareast-language:EN-US">I am still working on a solution based on what you’ve said where I more explicitly call rtpengine_manage and pass in RTP/AVP or SAVP in MANAGE_BRANCH and MANAGE_REPLY. But no luck yet! Still missing
 the crypto attribute in the same spot unfortunately.<o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US">Thanks.</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US"><br>
<b>Rhys Hanrahan</b> | Chief Information Officer<br>
<b>e:</b> <a href="mailto:rhys@nexusone.com.au"><span style="color:#0563C1">rhys@nexusone.com.au</span></a>  <br>
<br>
</span><a href="http://www.nexusone.com.au/"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US;text-decoration:none"><img border="0" width="229" height="57" style="width:2.3854in;height:.5937in" id="Picture_x0020_2" src="cid:image001.png@01D82F5C.A398B3A0" alt="www.nexusone.com.au"></span></a><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US">   </span><a href="http://www.fusiontech.com.au/"><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US;text-decoration:none"><img border="0" width="197" height="59" style="width:2.052in;height:.6145in" id="Picture_x0020_1" src="cid:image002.png@01D82F5C.A398B3A0" alt="signature_21907561"></span></a><span lang="EN-GB" style="font-size:12.0pt;color:black;mso-fareast-language:EN-US"><br>
</span><b><span lang="EN-GB" style="font-size:12.0pt;color:#0070C0;mso-fareast-language:EN-US"><br>
</span></b><b><span lang="EN-GB" style="font-size:12.0pt;color:#1F4E79;mso-fareast-language:EN-US">NEXUS ONE</span></b><b><span lang="EN-GB" style="font-size:12.0pt;color:#0070C0;mso-fareast-language:EN-US"> </span></b><b><span lang="EN-GB" style="font-size:12.0pt;color:black;mso-fareast-language:EN-US">|</span></b><b><span lang="EN-GB" style="font-size:12.0pt;color:#0070C0;mso-fareast-language:EN-US"> FUSION
 TECHNOLOGY SOLUTIONS</span></b><b><span lang="EN-GB" style="color:#0070C0;mso-fareast-language:EN-US"><br>
</span></b><b><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US">p:</span></b><span lang="EN-GB" style="color:black;mso-fareast-language:EN-US"> 1800 NEXUS1 (1800 639 871) or 1800 565 845 <b>|</b> <b>a:</b> Suite 12.03 Level 12, 227 Elizabeth
 Street, Sydney NSW 2000<br>
<a href="http://www.nexusone.com.au/"><span style="color:#0563C1">www.nexusone.com.au</span></a> <b>|</b> <a href="http://www.fusiontech.com.au/"><span style="color:#0563C1">www.fusiontech.com.au</span></a><br>
<br>
</span><i><span lang="EN-GB" style="font-size:9.0pt;color:#767171;mso-fareast-language:EN-US">The information in this email and any accompanying attachments may contain; a. Confidential information of Fusion Technology Solutions Pty Ltd, Nexus One Pty Ltd or
 third parties; b. Legally privileged information of Fusion Technology Solutions Pty Ltd, Nexus One Pty Ltd or third parties; and or c. Copyright material Fusion Technology Solutions Pty Ltd, Nexus One Pty Ltd or third parties. If you have received this email
 in error, please notify the sender immediately and delete this message. Fusion Technology Solutions Pty Ltd, Nexus One Pty Ltd does not accept any responsibility for loss or damage arising from the use or distribution of this email.</span></i><span lang="EN-GB" style="font-size:10.0pt;color:black;mso-fareast-language:EN-US"><br>
<br>
</span><i><span lang="EN-GB" style="font-size:8.0pt;color:#1F4E79">Please consider the environment before printing this email.</span></i><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">sr-users <sr-users-bounces@lists.kamailio.org> on behalf of Matthias Urlichs <matthias@urlichs.de><br>
<b>Reply to: </b>"Kamailio (SER) - Users Mailing List" <sr-users@lists.kamailio.org><br>
<b>Date: </b>Thursday, 3 March 2022 at 11:06 pm<br>
<b>To: </b>"sr-users@lists.kamailio.org" <sr-users@lists.kamailio.org><br>
<b>Subject: </b>Re: [SR-Users] rtpengine - SRTP <> RTP missing a=crypto<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">On 03.03.22 12:07, Rhys Hanrahan wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Any advice appreciated, as this is my first time dealing with SRTP (and rtpengine). Feeling very stuck. Thanks!<o:p></o:p></p>
</blockquote>
<p>Yeah, me too. ;-)<o:p></o:p></p>
<p>Basically you need to call "rtpengine_manage" with the correct parameter, i.e. either RTP/AVP or RTP/SAVP, based on whether audio to the destination of the message is to be encrypted or not. This applies to basically any message with "application/sdp" content,
 i.e. both the INVITE *and* the 183 or 200 reply.<o:p></o:p></p>
<p>Thus if you relay from encrypted to plaintext, the INVITE's handler needs to call rtpengine_manage("… RTP/AVP") and the response handler needs to call rtpengine_manage("… RTP/SAVP").<o:p></o:p></p>
<p>In my code I discover these settings (for both call source and destination) during the INVITE, then I save them in a couple of XAVU variables. All the other handlers just select source / destination based on whether the message's source IP address is the
 same as the INVITE's.<o:p></o:p></p>
<p>IMHO it's way easier to program the whole thing in Python instead of Kamailio's language. This in turn would be much simpler if Kamailio used threads instead of separate processes and shared memory, but apparently you can't have everything. :-P<o:p></o:p></p>
<pre>-- <o:p></o:p></pre>
<pre>-- Matthias Urlichs<o:p></o:p></pre>
</div>
</body>
</html>