[OpenSIPS-Users] codec_delete_except_re

Alain Bieuzent alain.bieuzent at free.fr
Tue Aug 11 08:54:09 EST 2020

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 ?





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
OpenSIPS Summit, Amsterdam, May 2020
OpenSIPS Bootcamp, Miami, March 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)



o=HNET 600152000 100017799 IN IP4



c=IN IP4

t=0 0

m=audio 64976 RTP/AVP 18 18 18 8 101

a=rtpmap:18 G729/8000

a=fmtp:18 annexb=yes


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



How can I delete codec where annexb=yes ?


Thanks for your help

Users mailing list
Users at lists.opensips.org

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

More information about the Users mailing list