### Description
Newer rtpengine versions support manipulating SDP "a=" lines directly. Although kamailio is quite versatile when it comes to editing SIP message body, this functionality is often rather frail, especially when forking and having to use msg_apply_changes several times. I believe it would be beneficial to be able to offload such functionality to rtpengine, especially if one wants to apply different manipulations per outgoing branch.
### Expected behavior There should be a way to issue rtpengine ng-control protocol commands compatible with the sdp-attr dictionary syntax.
#### Actual observed behavior Currently sdp-attr tokens are not properly evaluated. For example, **doing**:
rtpengine_manage("ICE=remove rtcp-mux-demux trust-address replace-origin replace-session-connection replace-SDP-version direction=internal direction=external sdp-attr-audio-substitute=$avp(fmtp_line) sdp-attr-audio-substitute=fmtp:101 0-15");
_[NOTE: $avp(fmtp_line) seems to expand in empty string here, which is a config error, but it doesn't affect the syntax demonstration in this example IMO]_ **results in**: ``` { "supports": [ "load limit" ], "sdp": "...", "ICE": "remove", "sdp-attr-audio-substitute": "", "sdp-attr-audio-substitute": "fmtp:101", "direction": [ "internal", "external" ], "flags": [ "trust-address", "0-15" ], "replace": [ "origin", "session-connection", "SDP-version" ], "rtcp-mux": [ "demux" ], "call-id": "...", "received-from": [ "IP4", "..." ], "from-tag": "...", "to-tag": "...", "command": "answer" } ```
### Possible Solutions Support the special syntax of sdp-attr as documented here: https://github.com/sipwise/rtpengine/blob/master/docs/ng_control_protocol.md
Here's one way to do it (I guess). In order to get this: ``` "sdp-attr" : { "audio" : { "add" : [ "ptime:20", "sendrecv" ], "substitute": [["fmtp:101 0-15" , "fmtp:126 0-16" ]] }, "video": { "remove" : [ "rtpmap:101 telephone-event/8000" ] }, "none" : { "substitute": [[ "sendrecv" , "sendonly" ], [ "ptime:20" , "ptime:40" ]] } } ``` Use a syntax similar to the following:
rtpengine_manage("... sdp-attr-audio-add=ptime:20 sdp-attr-audio-add=sendrecv sdp-attr-audio-substitute=fmtp:101 0-15 sdp-attr-audio-substitute=fmtp:101 0-16 sdp-attr-video-remove=rtpmap:101 telephone-event/8000 sdp-attr-none-substitute=sendrecv sdp-attr-none-substitute=sendonly sdp-attr-none-substitute=ptime:20 sdp-attr-none-substitute=ptime:40 ...");
It's not very pretty, but it could work. Caveats: * How to handle whitespace (e.g. there's a space in "fmtp:101 0-15" and in "rtpmap:101 telephone-event/8000" ) * substitute commands must always be in pairs, data type is a list of lists containing exactly two items as value in "substitute" key
Unfortunately my C skills are not up to this task, but if I can provide any other kind of help please let me know. Thanks!
There's supposed to be a compatibility layer in rtpengine to make it possible to add these attributes to the signalling from Kamailio without requiring explicit support from the control module, but that's not implemented yet. It should be coming soon. Stay tuned.
As for adding explicit support for this to the Kamailio control module: In general yes, but the number of different flags and options with various formats that can be signalled to rtpengine have already become quite extensive, so I'd rather be in favour of completely refactoring the syntax and moving towards a JSON-esque style syntax, as this reflects much more the native format and would instantly be able to support any and all new options and flags. It's just a matter of finding the time to actually do it...
FTR this is now available in rtpengine master. Syntax is described in the docs. For example `sdp-attr-add-audio-ptime:20`
That is great news, thanks! Any chance this will make it into the 11.4 release train or should one expect it in >=11.5.x?
This issue is stale because it has been open 6 weeks with no activity. Remove stale label or comment or this will be closed in 2 weeks.
Closed #3509 as not planned.