<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<tt>Hi Alain,<br>
<br>
It is highly unusual to have "multiple" definition of the same
codec - I think the function does not expect such a non-sense and
it searches + removes the first found entry for the codec.<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="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Summit 2020 online
<a class="moz-txt-link-freetext" href="https://www.opensips.org/events/Summit-2020Distributed/">https://www.opensips.org/events/Summit-2020Distributed/</a></pre>
<div class="moz-cite-prefix">On 8/11/20 11:54 AM, Alain Bieuzent
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:5A7F12D5-36DE-494E-A277-98584E713A15@free.fr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<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;}
@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;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"Préformaté HTML Car";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
tt
{mso-style-priority:99;
font-family:"Courier New";}
span.PrformatHTMLCar
{mso-style-name:"Préformaté HTML Car";
mso-style-priority:99;
mso-style-link:"Préformaté HTML";
font-family:Consolas;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.tlid-translation
{mso-style-name:tlid-translation;}
.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>
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi Bogdan,<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">When you said « </span><tt><span
style="font-size:10.0pt" lang="EN-US">once the rtpmap line
found, use the {re.subst,reg_exp} transformation to get
the codec ID from the line », </span></tt><span
lang="EN-US">What do you mean by codec ID (codec NAME ?)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I’ trying to use
codec_delete function (codec_delete(“G729”), but it delete
only one time the both aline (even if you try run several
time), </span><span class="tlid-translation"><span
lang="EN-US">and, on the other hand it delete all payload
(18) from the mline (and I need to keep one).<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="tlid-translation"><span
lang="EN-US"><o:p> </o:p></span></span></p>
<p class="MsoNormal"><span class="tlid-translation"><span
lang="EN-US">Is there another way to delete an aline
without use codec_delete ?<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="tlid-translation"><span
lang="EN-US"><o:p> </o:p></span></span></p>
<p class="MsoNormal"><span class="tlid-translation"><span
lang="EN-US">Thanks</span></span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span 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">De : </span></b><span
style="font-size:12.0pt;color:black">Bogdan-Andrei Iancu
<a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a><br>
<b>Date : </b>jeudi 13 février 2020 à 10:19<br>
<b>À : </b>OpenSIPS users mailling list
<a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a>, Alain Bieuzent
<a class="moz-txt-link-rfc2396E" href="mailto:alain.bieuzent@free.fr"><alain.bieuzent@free.fr></a><br>
<b>Objet : </b>Re: [OpenSIPS-Users]
codec_delete_except_re<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><tt><span style="font-size:10.0pt">Hi
Alain,</span></tt><span
style="font-size:10.0pt;font-family:"Courier New""><br>
<br>
</span><tt><span style="font-size:10.0pt">Is is legal to have
same codec ID more than once in the the `m` line ?? I see
that 18 is mentioned like 3 times :-/.</span></tt><span
style="font-size:10.0pt;font-family:"Courier New""><br>
<br>
</span><tt><span style="font-size:10.0pt">Anyhow, for what you
need, what you should do is:</span></tt><span
style="font-size:10.0pt;font-family:"Courier New""><br>
</span><tt><span style="font-size:10.0pt">* iterate through
the `a` lines using the {sdp.line} transformation</span></tt><span
style="font-size:10.0pt;font-family:"Courier New""><br>
</span><tt><span style="font-size:10.0pt">* use a a regexp to
check if the current `a` line contains "annexb=yes"</span></tt><span
style="font-size:10.0pt;font-family:"Courier New""><br>
</span><tt><span style="font-size:10.0pt">* if such a line was
found, go back (decrementing the index of `a` lines) and
search (backwards) the first `rtpmap` line</span></tt><span
style="font-size:10.0pt;font-family:"Courier New""><br>
</span><tt><span style="font-size:10.0pt">* once the rtpmap
line found, use the {re.subst,reg_exp} transformation to
get the codec ID from the line</span></tt><span
style="font-size:10.0pt;font-family:"Courier New""><br>
</span><tt><span style="font-size:10.0pt">* after that, simply
use the codec delete function</span></tt><span
style="font-size:10.0pt;font-family:"Courier New""><br>
<br>
</span><tt><span style="font-size:10.0pt">Best regards,</span></tt><span
style="font-size:10.0pt;font-family:"Courier New""><br>
<br>
</span><o:p></o:p></p>
<pre>Bogdan-Andrei Iancu<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>OpenSIPS Founder and Developer<o:p></o:p></pre>
<pre> <a href="https://www.opensips-solutions.com" moz-do-not-send="true">https://www.opensips-solutions.com</a><o:p></o:p></pre>
<pre>OpenSIPS Summit, Amsterdam, May 2020<o:p></o:p></pre>
<pre> <a href="https://www.opensips.org/events/Summit-2020Amsterdam/" moz-do-not-send="true">https://www.opensips.org/events/Summit-2020Amsterdam/</a><o:p></o:p></pre>
<pre>OpenSIPS Bootcamp, Miami, March 2020<o:p></o:p></pre>
<pre> <a href="https://opensips.org/training/OpenSIPS_Bootcamp_2020/" moz-do-not-send="true">https://opensips.org/training/OpenSIPS_Bootcamp_2020/</a><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<div>
<p class="MsoNormal">On 2/11/20 3:35 PM, Alain Bieuzent wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-US">Hi all,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">I received an SDP with
several codec G729 (with annexb=yes and annexb=no)</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">=0</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">o=HNET
600152000 100017799 IN IP4 0.0.0.0</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">s=0_CALLMEDIA</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">i=HNET</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">c=IN IP4
0.0.0.0</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">t=0 0</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">m=audio
64976 RTP/AVP 18 18 18 8 101</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">a=rtpmap:18
G729/8000</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">a=fmtp:18
annexb=yes</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">a=ptime:20</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">a=rtpmap:18
G729/8000</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">a=fmtp:18
annexb=no</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">a=rtpmap:18
G729/8000</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">a=fmtp:18
annexb=yes</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">a=rtpmap:8
PCMA/8000</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">a=rtpmap:101
telephone-event/8000</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">a=fmtp:101
0-15</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt">a=sendonly</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">How can I delete codec
where annexb=yes ?</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Thanks for your help</span><o:p></o:p></p>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Users mailing list<o:p></o:p></pre>
<pre><a href="mailto:Users@lists.opensips.org" moz-do-not-send="true">Users@lists.opensips.org</a><o:p></o:p></pre>
<pre><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
</div>
</blockquote>
<br>
</body>
</html>