Hi Denys, AFAIK read and writes rtpengine the complete sdp. So manipulating with the "classic" textops tools is more for RtpProxy. You can search for things but writing will done by rtpengine. I remove for example an codec with codec-mask. Or you can manipulate the avp you read from rtpengine (via modparam) in the request.
Did you try to *codec-mask= in the rtpengine calls (answer / manage)? * *So rtpengine takes care for the removal. * *It needs to know what to remove. * https://www.kamailio.org/docs/modules/5.3.x/modules/rtpengine.html#idm1459 Cheers Karsten Denys Pozniak <denys.pozn...@gmail.com> schrieb am Fr., 1. Nov. 2019, 15:10: > If I put route(SDP_VIDEO_REMOVER) into the section route[NATMANAGE] ( > https://github.com/kamailio/kamailio/blob/master/etc/kamailio.cfg#L820 ), > Kamailio shows the error I posted below. > > route[SDP_VIDEO_REMOVER] { > if ( is_request() && has_body("application/sdp") && > sdp_with_media("video") ) { > sdp_remove_media("video"); > msg_apply_changes(); > xlog("L_WARN","[$cfg(route)] *m=video detected* | > $rm/$rs/$avp(sdp_mvideo_line)/ \n"); > } > } > > 16(15993) DEBUG: sdpops [sdpops_mod.c:883]: sdp_with_media(): attempting > to search for media type: [video] > 16(15993) DEBUG: sdpops [sdpops_mod.c:898]: sdp_with_media(): stream 0 of > 0 - media [audio] > 16(15993) DEBUG: sdpops [sdpops_mod.c:898]: sdp_with_media(): stream 1 of > 0 - media [video] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1038]: sdp_remove_media(): > attempting to search for media type: [video] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1055]: sdp_remove_media(): stream 0 > of 0 - media [audio] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1055]: sdp_remove_media(): stream 1 > of 0 - media [video] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1061]: sdp_remove_media(): removing > media stream: video16(15993) *ERROR: textopsx [textopsx.c:181]: > ki_msg_apply_changes(): invalid usage - not in request route or a reply* > 16(15993) WARNING: <script>: [SDP_VIDEO_REMOVER] *m=video detected* | > INVITE/<null>/m=video 0 RTP/AVP 97 99 98 110 > / > 16(15993) DEBUG: sdpops [sdpops_mod.c:1133]: sdp_with_transport(): > attempting to search for transport type: [RTP/SAVP] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1148]: sdp_with_transport(): stream > 0 of 0 - transport [RTP/AVP] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1148]: sdp_with_transport(): stream > 1 of 0 - transport [RTP/AVP] > 16(15993) DEBUG: sdpops [sdpops_data.c:222]: sdpops_build_ids_list(): > codecs list [PCMA] - at name [PCMA] with list ids [8] > 16(15993) DEBUG: sdpops [sdpops_data.c:255]: sdpops_build_ids_list(): > codecs list [PCMA] - ids list [8] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1433]: sdp_with_codecs_by_id(): > attempting to search codecs in sdp: [8] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1448]: sdp_with_codecs_by_id(): > stream 0 of 0 - payloads [121 122 123 124 9 0 8 18 101] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1465]: sdp_with_codecs_by_id(): > codecs [121 122 123 124 9 0 8 18 101] - found [8] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1448]: sdp_with_codecs_by_id(): > stream 1 of 0 - payloads [97 99 98 110] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1460]: sdp_with_codecs_by_id(): > codecs [97 99 98 110] - not found [8] > 16(15993) DEBUG: sdpops [sdpops_data.c:222]: sdpops_build_ids_list(): > codecs list [PCMU] - at name [PCMU] with list ids [0] > 16(15993) DEBUG: sdpops [sdpops_data.c:255]: sdpops_build_ids_list(): > codecs list [PCMU] - ids list [0] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1433]: sdp_with_codecs_by_id(): > attempting to search codecs in sdp: [0] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1448]: sdp_with_codecs_by_id(): > stream 0 of 0 - payloads [121 122 123 124 9 0 8 18 101] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1465]: sdp_with_codecs_by_id(): > codecs [121 122 123 124 9 0 8 18 101] - found [0] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1448]: sdp_with_codecs_by_id(): > stream 1 of 0 - payloads [97 99 98 110] > 16(15993) DEBUG: sdpops [sdpops_mod.c:1460]: sdp_with_codecs_by_id(): > codecs [97 99 98 110] - not found [0] > > > > > пт, 1 нояб. 2019 г. в 14:38, Daniel-Constantin Mierla <mico...@gmail.com>: > >> Hello, >> >> that's strange, because the condition in the c code is: >> >> if(msg->first_line.type != SIP_REPLY && get_route_type() != >> REQUEST_ROUTE) { >> LM_ERR("invalid usage - not in request route or a reply\n"); >> return -1; >> } >> >> Which is clear about whether the message is a SIP reply or function is >> executed in request_route. There is a condition later about the >> record_route(), but it didn't get to that code... >> >> Maybe you can share the entire request_route you had when the error was >> exposed. >> >> Cheers, >> Daniel >> On 01.11.19 12:14, Denys Pozniak wrote: >> >> Got message in debug=3: >> *13(2141) ERROR: textopsx [textopsx.c:181]: ki_msg_apply_changes(): >> invalid usage - not in request route or a reply* >> >> But definitely msg_apply_changes() is placed in request_route section. >> I have just moved code part before calling record_route() function and it >> helped. >> >> Interesting, but as I remember Kamailio should display in such cases >> something like below: >> "...cannot apply msg changes after adding record-route header..." >> >> Thanks for the hint. >> >> >> >> >> пт, 1 нояб. 2019 г. в 11:35, Daniel-Constantin Mierla <mico...@gmail.com >> >: >> >>> Hello, >>> >>> run with debug=3 and what the logs to see if there are error/warning >>> messages. >>> >>> Cheers, >>> Daniel >>> On 01.11.19 10:26, Denys Pozniak wrote: >>> >>> Hello! >>> >>> I'm trying to remove m=video stream from incoming SIP/SDP request in th >>> way below: >>> >>> modparam("rtpengine", "read_sdp_pv", "$avp(read_sdp_pv)") >>> modparam("rtpengine", "write_sdp_pv", "$avp(write_sdp_pv)") >>> ... >>> sdp_remove_media("video"); >>> msg_apply_changes(); >>> sdp_get("$avp(read_sdp_pv)"); >>> xlog("L_WARN","[$cfg(route)] *m=video removed* ci| rb=/$rb/ \n"); >>> xlog("L_WARN","[$cfg(route)] *m=video removed* ci| >>> avp(read_sdp_pv)=/$avp(read_sdp_pv)/ \n"); >>> rtpengine_manage("$avp(rtpengine_offer)"); >>> set_body("$avp(write_sdp_pv)", "application/sdp"); >>> >>> But no luck, xlog shows m=video in $rb and $avp(rtp_sdp_read) as well. >>> >>> -- >>> >>> BR, >>> Denys Pozniak >>> >>> >>> >>> _______________________________________________ >>> Kamailio (SER) - Users Mailing >>> Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >>> >>> -- >>> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- >>> www.linkedin.com/in/miconda >>> Kamailio World Conference - April 27-29, 2020, in Berlin -- >>> www.kamailioworld.com >>> >>> >> >> -- >> >> BR, >> Denys Pozniak >> >> >> -- >> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- >> www.linkedin.com/in/miconda >> Kamailio World Conference - April 27-29, 2020, in Berlin -- >> www.kamailioworld.com >> >> > > -- > > BR, > Denys Pozniak > > > _______________________________________________ > Kamailio (SER) - Users Mailing List > sr-users@lists.kamailio.org > https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users >
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users