[SR-Users] Split audio and video into different calls

Rick van Rein rick+kamailio.org at vanrein.org
Tue May 17 07:57:14 CEST 2022


Hello Christoph,

I held back responding, but since it does not seem directly possible with Kamailio here's what I what try.

RTP frames have a Payload Type which is usually negotiated in rtpmap attributes in SDP, but there are static mappings for many codecs.  I would first figure out if you can find a common pattern in your (local) traffic that separates the two kinds of payload.

Since the Payload Type is at a fixed offset (the lower 7 bits of the second RTP byte, the 8th bit is an M-bit) you could instruct a firewall to mangle/redirect traffic to your video wall.  You can easily ignore the M bit in the same byte by specifying two values for the M-bit + Payload Type byte.
For NFT on Linux, see https://manpages.debian.org/bullseye/nftables/nft.8.en.html#RAW_PAYLOAD_EXPRESSION

If this seems workable, I would look into the sdpops module in Kamailio, to modify any SDP attachments coming in and going out, to strip and add video codecs.  You may or may not need to dynamically alter the firewall bypassing.  But in general, you can set where the Payload Type on the local end receives video streams -- possibly with different codecs.
http://www.kamailio.net/docs/modules/5.6.x/modules/sdpops.html

You may or may not need to use Kamailio to fork a connection to your video software, depending on whether it wants SIP to talk to it.

This probably gives you the control you need, but it is a bit of a hack.  Which is why I held back to see if others knew a more direct method of doing what you want.

It would be interesting to hear if / how this works for you, by the way.  It might even be a nice blog article.


Cheers,
 -Rick



More information about the sr-users mailing list