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 <miconda@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 List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- 
Daniel-Constantin Mierla -- www.asipto.com
www.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.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com