### 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!
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3509
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3509(a)github.com>