<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>that's strange, because the condition in the c code is:</p>
    <p>    if(msg->first_line.type != SIP_REPLY &&
      get_route_type() != REQUEST_ROUTE) {<br>
              LM_ERR("invalid usage - not in request route or a
      reply\n");<br>
              return -1;<br>
          }</p>
    <p>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...</p>
    <p>Maybe you can share the entire request_route you had when the
      error was exposed.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 01.11.19 12:14, Denys Pozniak wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+x3AxrratunYthGBthaXMHTwFuXDuXrXyCpfznP+ueHWhTMyQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Got message in debug=3:<br>
        <div><i>13(2141) ERROR: textopsx [textopsx.c:181]:
            ki_msg_apply_changes(): invalid usage - not in request route
            or a reply</i><br>
        </div>
        <div><br>
        </div>
        But definitely msg_apply_changes() is placed in request_route
        section.<br>
        I have just moved code part before calling record_route()
        function and it helped. <br>
        <br>
        <div>Interesting, but as I remember Kamailio should display in
          such cases something like below:<br>
          "...cannot apply msg changes after adding record-route
          header..." <br>
          <br>
          Thanks for the hint.<br>
           
          <div><br>
          </div>
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">пт, 1 нояб. 2019 г. в 11:35,
          Daniel-Constantin Mierla <<a
            href="mailto:miconda@gmail.com" moz-do-not-send="true">miconda@gmail.com</a>>:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF">
            <p>Hello,</p>
            <p>run with debug=3 and what the logs to see if there are
              error/warning messages.</p>
            <p>Cheers,<br>
              Daniel<br>
            </p>
            <div>On 01.11.19 10:26, Denys Pozniak wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div>Hello!</div>
                <br>
                I'm trying to remove m=video stream from incoming
                SIP/SDP request in th way below:<br>
                <br>
                modparam("rtpengine", "read_sdp_pv",
                "$avp(read_sdp_pv)")<br>
                modparam("rtpengine", "write_sdp_pv",
                "$avp(write_sdp_pv)")<br>
                ...<br>
                  sdp_remove_media("video");<br>
                  msg_apply_changes();<br>
                <div>  sdp_get("$avp(read_sdp_pv)");<br>
                    xlog("L_WARN","[$cfg(route)] *m=video removed* ci|
                  rb=/$rb/ \n");<br>
                    xlog("L_WARN","[$cfg(route)] *m=video removed* ci|
                  avp(read_sdp_pv)=/$avp(read_sdp_pv)/ \n");<br>
                    rtpengine_manage("$avp(rtpengine_offer)");<br>
                    set_body("$avp(write_sdp_pv)", "application/sdp");<br>
                  <br>
                  But no luck, xlog shows m=video in $rb and
                  $avp(rtp_sdp_read) as well.<br>
                  <br>
                  --
                  <div dir="ltr">
                    <div dir="ltr"><br>
                      <div>
                        <div>BR,</div>
                        <div>Denys Pozniak<br>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
            </blockquote>
            <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank" moz-do-not-send="true">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a href="http://www.kamailioworld.com" target="_blank" moz-do-not-send="true">www.kamailioworld.com</a></pre>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr" class="gmail_signature">
        <div dir="ltr"><br>
          <div>
            <div>BR,</div>
            <div>Denys Pozniak<br>
            </div>
            <div><br>
            </div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>