### Description
In plain Kamailio language, we used the following line:
```
if ( sdp_with_transport("RTP/SAVP") ) {
```
Now we wanted to convert that to Kemi. Turns out, the `sdp_with_transport()` function is
not exported to Kemi. So we thought, we could use `sdp_transport()` to work around the
missing function. This works as long as there is only one transport in SDP.
But if a phone sends two media streams in SDP, one with RTP/AVP and one with RTP/SAVP,
`sdp_transport()` will return `-2`.
### Troubleshooting
#### Reproduction
Send an INVITE to Kamailio and try to get the transport type into a variable with `
sdp_transport()`. This can be done for example with a snom phone where in the rtp section
of the identity configuration the parameter "RTP/SAVP" is set to
"optional".
#### Log Messages
```
Jan 10 13:08:13 hagi /usr/sbin/kamailio[7136]: DEBUG: app_jsdt [app_jsdt_api.c:996]:
sr_kemi_jsdt_exec_func_ex(): param[0] for: sdp_transport is str: $avp(mediaTransport)
Jan 10 13:08:13 hagi /usr/sbin/kamailio[7136]: DEBUG: <core> [core/usr_avp.c:887]:
parse_avp_ident(): Parsing 'mediaTransport'
Jan 10 13:08:13 hagi /usr/sbin/kamailio[7136]: DEBUG: <core> [core/pvapi.c:368]:
pv_cache_add(): pvar [$avp(mediaTransport)] added in cache
Jan 10 13:08:13 hagi /usr/sbin/kamailio[7136]: DEBUG: sdpops [sdpops_mod.c:1214]:
sdp_transport_helper(): stream 0 of 0 - transport [RTP/SAVP]
Jan 10 13:08:13 hagi /usr/sbin/kamailio[7136]: DEBUG: sdpops [sdpops_mod.c:1214]:
sdp_transport_helper(): stream 1 of 0 - transport [RTP/AVP]
Jan 10 13:08:13 hagi /usr/sbin/kamailio[7136]: DEBUG: sdpops [sdpops_mod.c:1219]:
sdp_transport_helper(): no common transport
```
### Additional Information
We are still running Kamailio 5.1.x, but as far as I could see, the behavior has not
changed since then.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2194