#45 Inverse Codec Match

trunk
open
Andrei Dragus
modules (91)
5
2009-11-15
2009-11-06
Ryan Bullock
No

The new codec functions in textops are awesome. However there is one feature I would like to see.

Currently there is codec_delete_re() and codec_exists_re that lets you delete and check for any codecs that match a regular expression.

If would be nice if there was the ability to also delete codecs that do NOT match an expression, perhaps through a option. This would allow you to enforce a list of supported codecs only. Right now to remove all other codecs would need an exhaustive list of what to remove (or some really awful inverse regex that would be confusing to write/read, if it is even possible to write)

For example, if you only want to permit G711 and G729 you could do something like the following to remove any other codecs:

codec_delete_re("[gG]711|[gG]729", v)

And the only codecs left would be G711 and G729 in the message. Or if it had only g711 and say speex, you would be left with only g711.

One would of course have to be careful to not remove telephony-events as well, but that should be up to the script writer.

I think this would be useful only for the codec_exists_re and codec_delete_re, so you could check for, and remove any foreign codecs.

codec_move_up_re and codec_move_down_re are already their inverses (for the most part).

Also a case insensitive option for the regex might be nice. But that would just be more icing on the cake.

Discussion

    • labels: --> modules
    • milestone: --> trunk
    • assigned_to: nobody --> andreidragus
     
  • Andrei Dragus
    Andrei Dragus
    2009-11-23

    Added "codec_delete_except_re( regexp ) " in r 6356.
    This function deletes all codecs except those matching the regular expression.

    As for the case insensitive option I don't think it will be implemented, I will leave it open for now and we will see.