[OpenSIPS-Users] codec_delete_except_re

Bogdan-Andrei Iancu bogdan at opensips.org
Thu Aug 13 15:00:01 EST 2020


Hi Alain,

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.

Regards

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
   https://www.opensips-solutions.com
OpenSIPS Summit 2020 online
   https://www.opensips.org/events/Summit-2020Distributed/

On 8/11/20 11:54 AM, Alain Bieuzent wrote:
>
> Hi Bogdan,
>
> When you said « once the rtpmap line found, use the {re.subst,reg_exp} 
> transformation to get the codec ID from the line », What do you mean 
> by codec ID (codec NAME ?)
>
> 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), and, on the other hand it delete all payload (18) from the 
> mline (and I need to keep one).
>
> Is there another way to delete an aline without use codec_delete ?
>
> Thanks
>
> *De : *Bogdan-Andrei Iancu <bogdan at opensips.org>
> *Date : *jeudi 13 février 2020 à 10:19
> *À : *OpenSIPS users mailling list <users at lists.opensips.org>, Alain 
> Bieuzent <alain.bieuzent at free.fr>
> *Objet : *Re: [OpenSIPS-Users] codec_delete_except_re
>
> Hi Alain,
>
> 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 :-/.
>
> Anyhow, for what you need, what you should do is:
> * iterate through the `a` lines using the {sdp.line} transformation
> * use a a regexp to check if the current `a` line contains "annexb=yes"
> * if such a line was found, go back (decrementing the index of `a` 
> lines) and search (backwards) the first `rtpmap` line
> * once the rtpmap line found, use the {re.subst,reg_exp} 
> transformation to get the codec ID from the line
> * after that, simply use the codec delete function
>
> Best regards,
>
> Bogdan-Andrei Iancu
> OpenSIPS Founder and Developer
>    https://www.opensips-solutions.com
> OpenSIPS Summit, Amsterdam, May 2020
>    https://www.opensips.org/events/Summit-2020Amsterdam/
> OpenSIPS Bootcamp, Miami, March 2020
>    https://opensips.org/training/OpenSIPS_Bootcamp_2020/
>
> On 2/11/20 3:35 PM, Alain Bieuzent wrote:
>
>     Hi all,
>
>     I received an SDP with several codec G729 (with annexb=yes and
>     annexb=no)
>
>     =0
>
>     o=HNET 600152000 100017799 IN IP4 0.0.0.0
>
>     s=0_CALLMEDIA
>
>     i=HNET
>
>     c=IN IP4 0.0.0.0
>
>     t=0 0
>
>     m=audio 64976 RTP/AVP 18 18 18 8 101
>
>     a=rtpmap:18 G729/8000
>
>     a=fmtp:18 annexb=yes
>
>     a=ptime:20
>
>     a=rtpmap:18 G729/8000
>
>     a=fmtp:18 annexb=no
>
>     a=rtpmap:18 G729/8000
>
>     a=fmtp:18 annexb=yes
>
>     a=rtpmap:8 PCMA/8000
>
>     a=rtpmap:101 telephone-event/8000
>
>     a=fmtp:101 0-15
>
>     a=sendonly
>
>     How can I delete codec where annexb=yes ?
>
>     Thanks for your help
>
>
>
>     _______________________________________________
>
>     Users mailing list
>
>     Users at lists.opensips.org  <mailto:Users at lists.opensips.org>
>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20200813/da742d8b/attachment.html>


More information about the Users mailing list